mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'apim420' of https://repository.entgra.net/community/device-mgt-core into apim420
This commit is contained in:
commit
938190deca
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>grafana-mgt</artifactId>
|
<artifactId>grafana-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>grafana-mgt</artifactId>
|
<artifactId>grafana-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>grafana-mgt</artifactId>
|
<artifactId>grafana-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>analytics-mgt</artifactId>
|
<artifactId>analytics-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>apimgt-extensions</artifactId>
|
<artifactId>apimgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -44,6 +44,11 @@
|
|||||||
<artifactId>powermock-api-mockito2</artifactId>
|
<artifactId>powermock-api-mockito2</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mockito</groupId>
|
||||||
|
<artifactId>mockito-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.testng</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>testng</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
<EveryOneRoleName>everyone</EveryOneRoleName>
|
<EveryOneRoleName>everyone</EveryOneRoleName>
|
||||||
<ReadOnly>false</ReadOnly>
|
<ReadOnly>false</ReadOnly>
|
||||||
<MaxUserNameListLength>500</MaxUserNameListLength>
|
<MaxUserNameListLength>500</MaxUserNameListLength>
|
||||||
<Property name="url">jdbc:h2:target/databasetest/CARBON_TEST</Property>
|
<Property name="url">jdbc:h2:./target/databasetest/CARBON_TEST</Property>
|
||||||
<Property name="driverName">org.h2.Driver</Property>
|
<Property name="driverName">org.h2.Driver</Property>
|
||||||
<Property name="maxActive">50</Property>
|
<Property name="maxActive">50</Property>
|
||||||
<Property name="maxWait">60000</Property>
|
<Property name="maxWait">60000</Property>
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>application-mgt</artifactId>
|
<artifactId>application-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>application-mgt</artifactId>
|
<artifactId>application-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>certificate-mgt</artifactId>
|
<artifactId>certificate-mgt</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>certificate-mgt</artifactId>
|
<artifactId>certificate-mgt</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>certificate-mgt</artifactId>
|
<artifactId>certificate-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -825,8 +825,9 @@ public class CertificateGenerator {
|
|||||||
X500Name issuerName = new X500Name(subjectDn);
|
X500Name issuerName = new X500Name(subjectDn);
|
||||||
String commonName = certificationRequest.getSubject().getRDNs(BCStyle.CN)[0].getFirst()
|
String commonName = certificationRequest.getSubject().getRDNs(BCStyle.CN)[0].getFirst()
|
||||||
.getValue().toString();
|
.getValue().toString();
|
||||||
X500Name subjectName = new X500Name("O=" + commonName + "O=AndroidDevice,CN=" +
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
serialNumber);
|
X500Name subjectName = new X500Name("O=" + commonName + " ,CN=" +
|
||||||
|
serialNumber + ", OU=tenant_" + tenantId);
|
||||||
Date startDate = new Date(System.currentTimeMillis());
|
Date startDate = new Date(System.currentTimeMillis());
|
||||||
Date endDate = new Date(System.currentTimeMillis()
|
Date endDate = new Date(System.currentTimeMillis()
|
||||||
+ TimeUnit.DAYS.toMillis(365 * 100));
|
+ TimeUnit.DAYS.toMillis(365 * 100));
|
||||||
@ -847,7 +848,7 @@ public class CertificateGenerator {
|
|||||||
io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate certificate =
|
io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate certificate =
|
||||||
new io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate();
|
new io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate();
|
||||||
List<io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate> certificates = new ArrayList<>();
|
List<io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate> certificates = new ArrayList<>();
|
||||||
certificate.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
|
certificate.setTenantId(tenantId);
|
||||||
certificate.setCertificate(issuedCert);
|
certificate.setCertificate(issuedCert);
|
||||||
certificates.add(certificate);
|
certificates.add(certificate);
|
||||||
saveCertInKeyStore(certificates);
|
saveCertInKeyStore(certificates);
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -16,24 +16,6 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
|
||||||
* Version 2.0 (the "License"); you may not use this file except
|
|
||||||
* in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS REG_CLUSTER_LOCK (
|
CREATE TABLE IF NOT EXISTS REG_CLUSTER_LOCK (
|
||||||
REG_LOCK_NAME VARCHAR (20),
|
REG_LOCK_NAME VARCHAR (20),
|
||||||
REG_LOCK_STATUS VARCHAR (20),
|
REG_LOCK_STATUS VARCHAR (20),
|
||||||
@ -104,7 +86,6 @@ CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_PATH_ID_NAME ON REG_RESOURCE(REG_
|
|||||||
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_UUID ON REG_RESOURCE(REG_UUID);
|
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_UUID ON REG_RESOURCE(REG_UUID);
|
||||||
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_TENANT ON REG_RESOURCE(REG_TENANT_ID, REG_UUID);
|
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_TENANT ON REG_RESOURCE(REG_TENANT_ID, REG_UUID);
|
||||||
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_TYPE ON REG_RESOURCE(REG_TENANT_ID, REG_MEDIA_TYPE);
|
CREATE INDEX IF NOT EXISTS REG_RESOURCE_IND_BY_TYPE ON REG_RESOURCE(REG_TENANT_ID, REG_MEDIA_TYPE);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS REG_RESOURCE_HISTORY (
|
CREATE TABLE IF NOT EXISTS REG_RESOURCE_HISTORY (
|
||||||
REG_PATH_ID INTEGER NOT NULL,
|
REG_PATH_ID INTEGER NOT NULL,
|
||||||
REG_NAME VARCHAR(256),
|
REG_NAME VARCHAR(256),
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<DataSourceConfig>
|
<DataSourceConfig>
|
||||||
<Url>jdbc:h2:mem:smart-meter-test-db;DB_CLOSE_ON_EXIT=FALSE;MVCC=true</Url>
|
<Url>jdbc:h2:mem:smart-meter-test-db;DB_CLOSE_ON_EXIT=FALSE</Url>
|
||||||
<DriverClassName>org.h2.Driver</DriverClassName>
|
<DriverClassName>org.h2.Driver</DriverClassName>
|
||||||
<User>wso2carbon</User>
|
<User>wso2carbon</User>
|
||||||
<Password>wso2carbon</Password>
|
<Password>wso2carbon</Password>
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt-extensions</artifactId>
|
<artifactId>device-mgt-extensions</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -38,6 +38,10 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@ -151,16 +155,25 @@
|
|||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-bundle-jaxrs</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-httpclient.wso2</groupId>
|
<groupId>commons-httpclient.wso2</groupId>
|
||||||
<artifactId>commons-httpclient</artifactId>
|
<artifactId>commons-httpclient</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>jsr311-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon</groupId>
|
<groupId>org.wso2.carbon</groupId>
|
||||||
<artifactId>org.wso2.carbon.utils</artifactId>
|
<artifactId>org.wso2.carbon.utils</artifactId>
|
||||||
@ -179,6 +192,10 @@
|
|||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>jcl-over-slf4j</artifactId>
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.ops4j.pax.logging</groupId>
|
||||||
|
<artifactId>pax-logging-log4j2</artifactId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -213,6 +230,14 @@
|
|||||||
<groupId>javassist</groupId>
|
<groupId>javassist</groupId>
|
||||||
<artifactId>javassist</artifactId>
|
<artifactId>javassist</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>jsr311-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>javax.ws.rs-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -295,6 +320,10 @@
|
|||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>jsr311-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -329,6 +358,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon.registry</groupId>
|
<groupId>org.wso2.carbon.registry</groupId>
|
||||||
<artifactId>org.wso2.carbon.registry.resource</artifactId>
|
<artifactId>org.wso2.carbon.registry.resource</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>javax.ws.rs-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@ -1736,7 +1736,6 @@ public interface DeviceManagementService {
|
|||||||
@ApiParam(
|
@ApiParam(
|
||||||
name = "owner",
|
name = "owner",
|
||||||
value = "Provides the owner of the required device.",
|
value = "Provides the owner of the required device.",
|
||||||
required = true,
|
|
||||||
defaultValue = "")
|
defaultValue = "")
|
||||||
@QueryParam("owner")
|
@QueryParam("owner")
|
||||||
String owner,
|
String owner,
|
||||||
|
|||||||
@ -533,7 +533,14 @@ public interface GroupManagementService {
|
|||||||
defaultValue = "1")
|
defaultValue = "1")
|
||||||
@DefaultValue("1")
|
@DefaultValue("1")
|
||||||
@QueryParam("depth")
|
@QueryParam("depth")
|
||||||
int depth);
|
int depth,
|
||||||
|
@ApiParam(
|
||||||
|
name = "allowed",
|
||||||
|
value = "Whether to return allowed group",
|
||||||
|
defaultValue = "false")
|
||||||
|
@QueryParam("allowed")
|
||||||
|
@DefaultValue("false")
|
||||||
|
boolean allowed);
|
||||||
|
|
||||||
@Path("/name/{groupName}")
|
@Path("/name/{groupName}")
|
||||||
@GET
|
@GET
|
||||||
|
|||||||
@ -1113,10 +1113,11 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
@QueryParam("operationStatus") List<String> status) {
|
@QueryParam("operationStatus") List<String> status) {
|
||||||
OperationList operationsList = new OperationList();
|
OperationList operationsList = new OperationList();
|
||||||
RequestValidationUtil requestValidationUtil = new RequestValidationUtil();
|
RequestValidationUtil requestValidationUtil = new RequestValidationUtil();
|
||||||
RequestValidationUtil.validateOwnerParameter(owner);
|
|
||||||
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
||||||
PaginationRequest request = new PaginationRequest(offset, limit);
|
PaginationRequest request = new PaginationRequest(offset, limit);
|
||||||
|
if(owner != null){
|
||||||
request.setOwner(owner);
|
request.setOwner(owner);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
//validating the operation log filters
|
//validating the operation log filters
|
||||||
OperationLogFilters olf = requestValidationUtil.validateOperationLogFilters(operationCode, createdFrom,
|
OperationLogFilters olf = requestValidationUtil.validateOperationLogFilters(operationCode, createdFrom,
|
||||||
|
|||||||
@ -169,10 +169,11 @@ public class GroupManagementServiceImpl implements GroupManagementService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Response getGroup(int groupId, boolean requireGroupProps, int depth) {
|
public Response getGroup(int groupId, boolean requireGroupProps, int depth, boolean allowed) {
|
||||||
try {
|
try {
|
||||||
GroupManagementProviderService service = DeviceMgtAPIUtils.getGroupManagementProviderService();
|
GroupManagementProviderService service = DeviceMgtAPIUtils.getGroupManagementProviderService();
|
||||||
DeviceGroup deviceGroup = service.getGroup(groupId, requireGroupProps, depth);
|
DeviceGroup deviceGroup = allowed ? service.getUserOwnGroup(groupId, requireGroupProps, depth):
|
||||||
|
service.getGroup(groupId, requireGroupProps, depth);
|
||||||
if (deviceGroup != null) {
|
if (deviceGroup != null) {
|
||||||
return Response.status(Response.Status.OK).entity(deviceGroup).build();
|
return Response.status(Response.Status.OK).entity(deviceGroup).build();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -146,11 +146,14 @@ public class RoleManagementServiceImpl implements RoleManagementService {
|
|||||||
List<String> visibleRoles;
|
List<String> visibleRoles;
|
||||||
RoleList visibleRoleList = new RoleList();
|
RoleList visibleRoleList = new RoleList();
|
||||||
try {
|
try {
|
||||||
|
boolean decision = false;
|
||||||
|
if(DeviceMgtAPIUtils.getMetadataManagementService().retrieveMetadata(metaKey) != null){
|
||||||
metadata = DeviceMgtAPIUtils.getMetadataManagementService().retrieveMetadata(metaKey);
|
metadata = DeviceMgtAPIUtils.getMetadataManagementService().retrieveMetadata(metaKey);
|
||||||
String metaValue = metadata.getMetaValue();
|
String metaValue = metadata.getMetaValue();
|
||||||
JSONParser parser = new JSONParser();
|
JSONParser parser = new JSONParser();
|
||||||
JSONObject jsonObject = (JSONObject) parser.parse(metaValue);
|
JSONObject jsonObject = (JSONObject) parser.parse(metaValue);
|
||||||
boolean decision = (boolean) jsonObject.get(Constants.IS_USER_ABLE_TO_VIEW_ALL_ROLES);
|
decision = (boolean) jsonObject.get(Constants.IS_USER_ABLE_TO_VIEW_ALL_ROLES);
|
||||||
|
}
|
||||||
if (decision) {
|
if (decision) {
|
||||||
if (Strings.isNullOrEmpty(userStore)){
|
if (Strings.isNullOrEmpty(userStore)){
|
||||||
userStore = PRIMARY_USER_STORE;
|
userStore = PRIMARY_USER_STORE;
|
||||||
|
|||||||
@ -43,10 +43,11 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* This is a test class for {@link ConfigurationServiceImpl}.
|
* This is a test class for {@link ConfigurationServiceImpl}.
|
||||||
*/
|
*/
|
||||||
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"})
|
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*", "org.mockito.*"})
|
||||||
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
||||||
"org.wso2.carbon.context.CarbonContext"})
|
"org.wso2.carbon.context.CarbonContext"})
|
||||||
@PrepareForTest({DeviceMgtAPIUtils.class, PolicyManagerUtil.class})
|
@PrepareForTest({DeviceMgtAPIUtils.class, PolicyManagerUtil.class})
|
||||||
|
//@PowerMockIgnore("org.mockito.*")
|
||||||
public class ConfigurationServiceImplTest {
|
public class ConfigurationServiceImplTest {
|
||||||
private ConfigurationManagementService configurationManagementService;
|
private ConfigurationManagementService configurationManagementService;
|
||||||
private PlatformConfigurationManagementService platformConfigurationManagementService;
|
private PlatformConfigurationManagementService platformConfigurationManagementService;
|
||||||
|
|||||||
@ -69,7 +69,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
|
|||||||
/**
|
/**
|
||||||
* This class holds the unit tests for the class {@link DeviceAgentServiceImpl}
|
* This class holds the unit tests for the class {@link DeviceAgentServiceImpl}
|
||||||
*/
|
*/
|
||||||
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"})
|
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*", "org.mockito.*"})
|
||||||
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
||||||
"org.wso2.carbon.context.CarbonContext", "org.wso2.carbon.context.internal.CarbonContextDataHolder"})
|
"org.wso2.carbon.context.CarbonContext", "org.wso2.carbon.context.internal.CarbonContextDataHolder"})
|
||||||
@PrepareForTest({DeviceMgtAPIUtils.class, DeviceManagementProviderService.class,
|
@PrepareForTest({DeviceMgtAPIUtils.class, DeviceManagementProviderService.class,
|
||||||
|
|||||||
@ -72,7 +72,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
|
|||||||
/**
|
/**
|
||||||
* This class includes unit tests for testing the functionality of {@link DeviceManagementServiceImpl}
|
* This class includes unit tests for testing the functionality of {@link DeviceManagementServiceImpl}
|
||||||
*/
|
*/
|
||||||
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"})
|
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*", "org.mockito.*"})
|
||||||
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
||||||
"org.wso2.carbon.context.CarbonContext", "org.wso2.carbon.user.core.service.RealmService"})
|
"org.wso2.carbon.context.CarbonContext", "org.wso2.carbon.user.core.service.RealmService"})
|
||||||
@PrepareForTest({DeviceMgtAPIUtils.class, MultitenantUtils.class, CarbonContext.class, RealmService.class})
|
@PrepareForTest({DeviceMgtAPIUtils.class, MultitenantUtils.class, CarbonContext.class, RealmService.class})
|
||||||
|
|||||||
@ -51,7 +51,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
|
|||||||
/**
|
/**
|
||||||
* This class holds the unit tests for the class {@link DeviceTypeManagementAdminService}
|
* This class holds the unit tests for the class {@link DeviceTypeManagementAdminService}
|
||||||
*/
|
*/
|
||||||
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"})
|
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*", "org.mockito.*"})
|
||||||
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
||||||
"org.wso2.carbon.context.PrivilegedCarbonContext"})
|
"org.wso2.carbon.context.PrivilegedCarbonContext"})
|
||||||
@PrepareForTest({DeviceMgtAPIUtils.class, DeviceManagementProviderService.class, CarbonContext.class})
|
@PrepareForTest({DeviceMgtAPIUtils.class, DeviceManagementProviderService.class, CarbonContext.class})
|
||||||
|
|||||||
@ -48,7 +48,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
|
|||||||
/**
|
/**
|
||||||
* This class holds the unit tests for the class {@link DeviceTypeManagementService}
|
* This class holds the unit tests for the class {@link DeviceTypeManagementService}
|
||||||
*/
|
*/
|
||||||
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"})
|
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*", "org.mockito.*"})
|
||||||
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils"})
|
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils"})
|
||||||
@PrepareForTest({DeviceMgtAPIUtils.class, DeviceManagementProviderService.class})
|
@PrepareForTest({DeviceMgtAPIUtils.class, DeviceManagementProviderService.class})
|
||||||
public class DeviceTypeManagementServiceTest {
|
public class DeviceTypeManagementServiceTest {
|
||||||
@ -129,8 +129,9 @@ public class DeviceTypeManagementServiceTest {
|
|||||||
FeatureManager featureManager = Mockito.mock(FeatureManager.class);
|
FeatureManager featureManager = Mockito.mock(FeatureManager.class);
|
||||||
Mockito.when(this.deviceManagementProviderService.getFeatureManager(Mockito.anyString())).thenReturn
|
Mockito.when(this.deviceManagementProviderService.getFeatureManager(Mockito.anyString())).thenReturn
|
||||||
(featureManager);
|
(featureManager);
|
||||||
Mockito.when((featureManager).getFeatures(Mockito.anyString())).thenThrow(new DeviceManagementException());
|
Mockito.when(featureManager.getFeatures(Mockito.anyString())).thenThrow(new DeviceManagementException());
|
||||||
Mockito.when((featureManager).getFeatures(Mockito.anyString(), Mockito.anyBoolean())).thenThrow(new DeviceManagementException());
|
Mockito.when(featureManager.getFeatures(Mockito.anyString(), Mockito.anyBoolean())).thenThrow(new DeviceManagementException());
|
||||||
|
Mockito.when(featureManager.getFeatures(Mockito.any(), Mockito.anyBoolean())).thenThrow(new DeviceManagementException());
|
||||||
Response response = this.deviceTypeManagementService.getFeatures(TEST_DEVICE_TYPE, null, "false", MODIFIED_SINCE);
|
Response response = this.deviceTypeManagementService.getFeatures(TEST_DEVICE_TYPE, null, "false", MODIFIED_SINCE);
|
||||||
Assert.assertNotNull(response, "The response object is null.");
|
Assert.assertNotNull(response, "The response object is null.");
|
||||||
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
|
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
|
||||||
|
|||||||
@ -51,7 +51,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* This is a test case for {@link GroupManagementServiceImpl}.
|
* This is a test case for {@link GroupManagementServiceImpl}.
|
||||||
*/
|
*/
|
||||||
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*", "javax.xml.parsers"})
|
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*", "javax.xml.parsers", "org.mockito.*"})
|
||||||
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
||||||
"org.wso2.carbon.context.PrivilegedCarbonContext"})
|
"org.wso2.carbon.context.PrivilegedCarbonContext"})
|
||||||
@PrepareForTest({DeviceMgtAPIUtils.class, CarbonContext.class})
|
@PrepareForTest({DeviceMgtAPIUtils.class, CarbonContext.class})
|
||||||
@ -125,13 +125,13 @@ public class GroupManagementServiceImplTest {
|
|||||||
PowerMockito.stub(PowerMockito.method(PrivilegedCarbonContext.class, "getThreadLocalCarbonContext"))
|
PowerMockito.stub(PowerMockito.method(PrivilegedCarbonContext.class, "getThreadLocalCarbonContext"))
|
||||||
.toReturn(context);
|
.toReturn(context);
|
||||||
Mockito.doReturn(2).when(groupManagementProviderService)
|
Mockito.doReturn(2).when(groupManagementProviderService)
|
||||||
.getGroupCount(Mockito.anyString(), Mockito.anyString());
|
.getGroupCount(Mockito.anyString(), Mockito.any());
|
||||||
Response response = groupManagementService.getGroupCount();
|
Response response = groupManagementService.getGroupCount();
|
||||||
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
|
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
|
||||||
"GetGroupCount request failed with valid parameters");
|
"GetGroupCount request failed with valid parameters");
|
||||||
Mockito.reset(groupManagementProviderService);
|
Mockito.reset(groupManagementProviderService);
|
||||||
Mockito.doThrow(new GroupManagementException()).when(groupManagementProviderService)
|
Mockito.doThrow(new GroupManagementException()).when(groupManagementProviderService)
|
||||||
.getGroupCount(Mockito.anyString(), Mockito.anyString());
|
.getGroupCount(Mockito.anyString(), Mockito.any());
|
||||||
response = groupManagementService.getGroupCount();
|
response = groupManagementService.getGroupCount();
|
||||||
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
|
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
|
||||||
"GetGroupCount request succeeded with in-valid parameters");
|
"GetGroupCount request succeeded with in-valid parameters");
|
||||||
@ -172,13 +172,13 @@ public class GroupManagementServiceImplTest {
|
|||||||
Mockito.doReturn(new DeviceGroup()).when(groupManagementProviderService).getGroup(1, false, 1);
|
Mockito.doReturn(new DeviceGroup()).when(groupManagementProviderService).getGroup(1, false, 1);
|
||||||
Mockito.doReturn(null).when(groupManagementProviderService).getGroup(2, false, 1);
|
Mockito.doReturn(null).when(groupManagementProviderService).getGroup(2, false, 1);
|
||||||
Mockito.doThrow(new GroupManagementException()).when(groupManagementProviderService).getGroup(3, false, 1);
|
Mockito.doThrow(new GroupManagementException()).when(groupManagementProviderService).getGroup(3, false, 1);
|
||||||
Response response = groupManagementService.getGroup(1, false, 1);
|
Response response = groupManagementService.getGroup(1, false, 1, false);
|
||||||
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
|
Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode(),
|
||||||
"getGroup request failed for a request with valid parameters");
|
"getGroup request failed for a request with valid parameters");
|
||||||
response = groupManagementService.getGroup(2, false, 1);
|
response = groupManagementService.getGroup(2, false, 1, false);
|
||||||
Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode(),
|
Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode(),
|
||||||
"getGroup request returned a group for a non-existing group");
|
"getGroup request returned a group for a non-existing group");
|
||||||
response = groupManagementService.getGroup(3, false, 1);
|
response = groupManagementService.getGroup(3, false, 1, false);
|
||||||
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
|
Assert.assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),
|
||||||
"getGroup request returned a group for a in-valid request");
|
"getGroup request returned a group for a in-valid request");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
|
|||||||
/**
|
/**
|
||||||
* This is a test class for {@link NotificationManagementServiceImpl}.
|
* This is a test class for {@link NotificationManagementServiceImpl}.
|
||||||
*/
|
*/
|
||||||
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"})
|
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*", "org.mockito.*"})
|
||||||
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
||||||
"org.wso2.carbon.context.CarbonContext"})
|
"org.wso2.carbon.context.CarbonContext"})
|
||||||
@PrepareForTest({DeviceMgtAPIUtils.class, MultitenantUtils.class, CarbonContext.class})
|
@PrepareForTest({DeviceMgtAPIUtils.class, MultitenantUtils.class, CarbonContext.class})
|
||||||
|
|||||||
@ -61,7 +61,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
|
|||||||
/**
|
/**
|
||||||
* This is a test case for {@link UserManagementService}.
|
* This is a test case for {@link UserManagementService}.
|
||||||
*/
|
*/
|
||||||
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*"})
|
@PowerMockIgnore({"javax.ws.rs.*", "org.apache.log4j.*", "org.mockito.*"})
|
||||||
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
@SuppressStaticInitializationFor({"io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils",
|
||||||
"org.wso2.carbon.context.CarbonContext"})
|
"org.wso2.carbon.context.CarbonContext"})
|
||||||
@PrepareForTest({DeviceMgtAPIUtils.class, MultitenantUtils.class, CarbonContext.class})
|
@PrepareForTest({DeviceMgtAPIUtils.class, MultitenantUtils.class, CarbonContext.class})
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -514,7 +514,16 @@
|
|||||||
<artifactId>jaxb-api</artifactId>
|
<artifactId>jaxb-api</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|||||||
@ -245,6 +245,15 @@ public interface GroupDAO {
|
|||||||
List<DeviceGroup> getGroups(GroupPaginationRequest paginationRequest, List<Integer> deviceGroupIds,
|
List<DeviceGroup> getGroups(GroupPaginationRequest paginationRequest, List<Integer> deviceGroupIds,
|
||||||
int tenantId) throws GroupManagementDAOException;
|
int tenantId) throws GroupManagementDAOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of Device Groups in tenant.
|
||||||
|
*
|
||||||
|
* @param tenantId of user's tenant.
|
||||||
|
* @return List of all Device Groups in tenant.
|
||||||
|
* @throws GroupManagementDAOException
|
||||||
|
*/
|
||||||
|
List<DeviceGroup> getGroups(List<Integer> deviceGroupIds, int tenantId) throws GroupManagementDAOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of Device Groups in tenant.
|
* Get the list of Device Groups in tenant.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -169,6 +169,46 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
|
|||||||
throw new GroupManagementDAOException(msg, e);
|
throw new GroupManagementDAOException(msg, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceGroup> getGroups(List<Integer> deviceGroupIds, int tenantId) throws GroupManagementDAOException {
|
||||||
|
int deviceGroupIdsCount = deviceGroupIds.size();
|
||||||
|
if (deviceGroupIdsCount == 0) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Connection conn = GroupManagementDAOFactory.getConnection();
|
||||||
|
String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH, PARENT_GROUP_ID FROM DM_GROUP WHERE TENANT_ID = ?";
|
||||||
|
|
||||||
|
sql += " AND ID IN (";
|
||||||
|
for (int i = 0; i < deviceGroupIdsCount; i++) {
|
||||||
|
sql += (deviceGroupIdsCount - 1 != i) ? "?," : "?";
|
||||||
|
}
|
||||||
|
sql += ")";
|
||||||
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||||
|
int paramIndex = 1;
|
||||||
|
stmt.setInt(paramIndex++, tenantId);
|
||||||
|
|
||||||
|
for (Integer deviceGroupId : deviceGroupIds) {
|
||||||
|
stmt.setInt(paramIndex++, deviceGroupId);
|
||||||
|
}
|
||||||
|
List<DeviceGroup> deviceGroupList = new ArrayList<>();
|
||||||
|
try (ResultSet resultSet = stmt.executeQuery()) {
|
||||||
|
while (resultSet.next()) {
|
||||||
|
deviceGroupList.add(GroupManagementDAOUtil.loadGroup(resultSet));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return deviceGroupList;
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "Error occurred while retrieving groups of groups IDs " + deviceGroupIds
|
||||||
|
+ " in tenant: " + tenantId;
|
||||||
|
log.error(msg);
|
||||||
|
throw new GroupManagementDAOException(msg, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceGroup> getGroups(GroupPaginationRequest request, List<Integer> deviceGroupIds,
|
public List<DeviceGroup> getGroups(GroupPaginationRequest request, List<Integer> deviceGroupIds,
|
||||||
int tenantId, boolean isWithParentPath) throws GroupManagementDAOException {
|
int tenantId, boolean isWithParentPath) throws GroupManagementDAOException {
|
||||||
@ -1313,7 +1353,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
|
|||||||
+ "FROM DM_DEVICE d, "
|
+ "FROM DM_DEVICE d, "
|
||||||
+ "(SELECT dgm.DEVICE_ID "
|
+ "(SELECT dgm.DEVICE_ID "
|
||||||
+ "FROM DM_DEVICE_GROUP_MAP dgm "
|
+ "FROM DM_DEVICE_GROUP_MAP dgm "
|
||||||
+ "WHERE dgm.GROUP_ID = (SELECT ID FROM DM_GROUP WHERE GROUP_NAME = ? )) dgm1 "
|
+ "WHERE dgm.GROUP_ID = (SELECT ID FROM DM_GROUP WHERE GROUP_NAME = ? AND TENANT_ID = ?)) dgm1 "
|
||||||
+ "WHERE d.ID = dgm1.DEVICE_ID AND d.TENANT_ID = ?) gd, DM_DEVICE_TYPE t "
|
+ "WHERE d.ID = dgm1.DEVICE_ID AND d.TENANT_ID = ?) gd, DM_DEVICE_TYPE t "
|
||||||
+ "WHERE gd.DEVICE_TYPE_ID = t.ID) d1 "
|
+ "WHERE gd.DEVICE_TYPE_ID = t.ID) d1 "
|
||||||
+ "WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?";
|
+ "WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?";
|
||||||
@ -1322,6 +1362,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
|
|||||||
stmt.setString(1, groupName);
|
stmt.setString(1, groupName);
|
||||||
stmt.setInt(2, tenantId);
|
stmt.setInt(2, tenantId);
|
||||||
stmt.setInt(3, tenantId);
|
stmt.setInt(3, tenantId);
|
||||||
|
stmt.setInt(4, tenantId);
|
||||||
try (ResultSet rs = stmt.executeQuery()) {
|
try (ResultSet rs = stmt.executeQuery()) {
|
||||||
devices = new ArrayList<>();
|
devices = new ArrayList<>();
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|||||||
@ -637,23 +637,34 @@ public class OperationManagerImpl implements OperationManager {
|
|||||||
deviceId.getType() + "' device, which carries the identifier '" +
|
deviceId.getType() + "' device, which carries the identifier '" +
|
||||||
deviceId.getId() + "' of owner '" + owner + "'");
|
deviceId.getId() + "' of owner '" + owner + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paginationResult = new PaginationResult();
|
||||||
|
int enrolmentId = 0;
|
||||||
|
List<? extends io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation> operationList;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
if (owner != null) {
|
||||||
EnrolmentInfo enrolmentInfo = this.getEnrolmentInfo(deviceId, request);
|
EnrolmentInfo enrolmentInfo = this.getEnrolmentInfo(deviceId, request);
|
||||||
if (enrolmentInfo == null) {
|
if (enrolmentInfo == null) {
|
||||||
throw new OperationManagementException("Enrollment info not found for given device which has device "
|
throw new OperationManagementException("Enrollment info not found for given device which has device "
|
||||||
+ "Identifier:" + deviceId.getId() + " and device type: " + deviceId.getType() + "Further, device "
|
+ "Identifier:" + deviceId.getId() + " and device type: " + deviceId.getType() + "Further, device "
|
||||||
+ "is own to: " + owner);
|
+ "is own to: " + owner);
|
||||||
}
|
}
|
||||||
int enrolmentId = enrolmentInfo.getId();
|
enrolmentId = enrolmentInfo.getId();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
OperationManagementDAOFactory.openConnection();
|
OperationManagementDAOFactory.openConnection();
|
||||||
List<? extends io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation> operationList =
|
if (owner != null) {
|
||||||
operationDAO.getOperationsForDevice(enrolmentId, request);
|
operationList = operationDAO.getOperationsForDevice(enrolmentId, request);
|
||||||
|
count = operationDAO.getOperationCountForDevice(enrolmentId, request);
|
||||||
|
} else {
|
||||||
|
operationList = operationDAO.getOperationsForDeviceByDeviceIdentifier(deviceId, request);
|
||||||
|
count = operationDAO.getOperationCountForDeviceWithDeviceIdentifier(deviceId, request);
|
||||||
|
}
|
||||||
for (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation dtoOperation : operationList) {
|
for (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation dtoOperation : operationList) {
|
||||||
Operation operation = OperationDAOUtil.convertOperation(dtoOperation);
|
Operation operation = OperationDAOUtil.convertOperation(dtoOperation);
|
||||||
operations.add(operation);
|
operations.add(operation);
|
||||||
}
|
}
|
||||||
paginationResult = new PaginationResult();
|
|
||||||
int count = operationDAO.getOperationCountForDevice(enrolmentId, request);
|
|
||||||
paginationResult.setData(operations);
|
paginationResult.setData(operations);
|
||||||
paginationResult.setRecordsTotal(count);
|
paginationResult.setRecordsTotal(count);
|
||||||
paginationResult.setRecordsFiltered(count);
|
paginationResult.setRecordsFiltered(count);
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao;
|
package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao;
|
||||||
|
|
||||||
import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest;
|
import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest;
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier;
|
||||||
import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest;
|
import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest;
|
||||||
import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity;
|
import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity;
|
||||||
import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationResponse;
|
import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationResponse;
|
||||||
@ -46,8 +47,12 @@ public interface OperationDAO {
|
|||||||
|
|
||||||
int getOperationCountForDevice(int enrolmentId, PaginationRequest request) throws OperationManagementDAOException;
|
int getOperationCountForDevice(int enrolmentId, PaginationRequest request) throws OperationManagementDAOException;
|
||||||
|
|
||||||
|
int getOperationCountForDeviceWithDeviceIdentifier(DeviceIdentifier deviceId, PaginationRequest request) throws OperationManagementDAOException;
|
||||||
|
|
||||||
List<? extends Operation> getOperationsForDevice(int enrolmentId, PaginationRequest request) throws OperationManagementDAOException;
|
List<? extends Operation> getOperationsForDevice(int enrolmentId, PaginationRequest request) throws OperationManagementDAOException;
|
||||||
|
|
||||||
|
List<? extends Operation> getOperationsForDeviceByDeviceIdentifier(DeviceIdentifier deviceId, PaginationRequest request) throws OperationManagementDAOException;
|
||||||
|
|
||||||
Operation getNextOperation(int enrolmentId, Operation.Status status) throws OperationManagementDAOException;
|
Operation getNextOperation(int enrolmentId, Operation.Status status) throws OperationManagementDAOException;
|
||||||
|
|
||||||
boolean updateOperationStatus(int enrolmentId, int operationId,Operation.Status status)
|
boolean updateOperationStatus(int enrolmentId, int operationId,Operation.Status status)
|
||||||
|
|||||||
@ -1478,6 +1478,146 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
return operations;
|
return operations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends Operation> getOperationsForDeviceByDeviceIdentifier(DeviceIdentifier deviceId, PaginationRequest request)
|
||||||
|
throws OperationManagementDAOException {
|
||||||
|
Operation operation;
|
||||||
|
List<Operation> operations = new ArrayList<>();
|
||||||
|
String createdTo = null;
|
||||||
|
String createdFrom = null;
|
||||||
|
DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
|
boolean isCreatedDayProvided = false;
|
||||||
|
boolean isUpdatedDayProvided = false; //updated day = received day
|
||||||
|
boolean isOperationCodeProvided = false;
|
||||||
|
boolean isStatusProvided = false;
|
||||||
|
if (request.getOperationLogFilters().getCreatedDayFrom() != null) {
|
||||||
|
createdFrom = simple.format(request.getOperationLogFilters().getCreatedDayFrom());
|
||||||
|
}
|
||||||
|
if (request.getOperationLogFilters().getCreatedDayTo() != null) {
|
||||||
|
createdTo = simple.format(request.getOperationLogFilters().getCreatedDayTo());
|
||||||
|
}
|
||||||
|
Long updatedFrom = request.getOperationLogFilters().getUpdatedDayFrom();
|
||||||
|
Long updatedTo = request.getOperationLogFilters().getUpdatedDayTo();
|
||||||
|
List<String> operationCode = request.getOperationLogFilters().getOperationCode();
|
||||||
|
List<String> status = request.getOperationLogFilters().getStatus();
|
||||||
|
StringBuilder sql = new StringBuilder("SELECT " +
|
||||||
|
"o.ID, " +
|
||||||
|
"TYPE, " +
|
||||||
|
"o.CREATED_TIMESTAMP, " +
|
||||||
|
"o.RECEIVED_TIMESTAMP, " +
|
||||||
|
"o.OPERATION_CODE, " +
|
||||||
|
"o.INITIATED_BY, " +
|
||||||
|
"om.STATUS, " +
|
||||||
|
"om.ID AS OM_MAPPING_ID, " +
|
||||||
|
"om.UPDATED_TIMESTAMP " +
|
||||||
|
"FROM " +
|
||||||
|
"DM_OPERATION o " +
|
||||||
|
"INNER JOIN " +
|
||||||
|
"(SELECT dm.OPERATION_ID, " +
|
||||||
|
"dm.ID, " +
|
||||||
|
"dm.STATUS, " +
|
||||||
|
"dm.UPDATED_TIMESTAMP " +
|
||||||
|
"FROM " +
|
||||||
|
"DM_ENROLMENT_OP_MAPPING dm " +
|
||||||
|
"WHERE " +
|
||||||
|
"dm.DEVICE_IDENTIFICATION = ?");
|
||||||
|
|
||||||
|
if (updatedFrom != null && updatedFrom != 0 && updatedTo != null && updatedTo != 0) {
|
||||||
|
sql.append(" AND dm.UPDATED_TIMESTAMP BETWEEN ? AND ?");
|
||||||
|
isUpdatedDayProvided = true;
|
||||||
|
}
|
||||||
|
sql.append(") om ON o.ID = om.OPERATION_ID ");
|
||||||
|
if (createdFrom != null && !createdFrom.isEmpty() && createdTo != null && !createdTo.isEmpty()) {
|
||||||
|
sql.append(" WHERE o.CREATED_TIMESTAMP BETWEEN ? AND ?");
|
||||||
|
isCreatedDayProvided = true;
|
||||||
|
}
|
||||||
|
if ((isCreatedDayProvided) && (status != null && !status.isEmpty())) {
|
||||||
|
int size = status.size();
|
||||||
|
sql.append(" AND (om.STATUS = ? ");
|
||||||
|
for (int i = 0; i < size - 1; i++) {
|
||||||
|
sql.append(" OR om.STATUS = ?");
|
||||||
|
}
|
||||||
|
sql.append(")");
|
||||||
|
isStatusProvided = true;
|
||||||
|
} else if ((!isCreatedDayProvided) && (status != null && !status.isEmpty())) {
|
||||||
|
int size = status.size();
|
||||||
|
sql.append(" WHERE (om.STATUS = ? ");
|
||||||
|
for (int i = 0; i < size - 1; i++) {
|
||||||
|
sql.append(" OR om.STATUS = ?");
|
||||||
|
}
|
||||||
|
sql.append(")");
|
||||||
|
isStatusProvided = true;
|
||||||
|
}
|
||||||
|
if ((isCreatedDayProvided || isStatusProvided) && (operationCode != null && !operationCode.isEmpty())) {
|
||||||
|
int size = operationCode.size();
|
||||||
|
sql.append(" AND (o.OPERATION_CODE = ? ");
|
||||||
|
for (int i = 0; i < size - 1; i++) {
|
||||||
|
sql.append(" OR o.OPERATION_CODE = ?");
|
||||||
|
}
|
||||||
|
sql.append(")");
|
||||||
|
isOperationCodeProvided = true;
|
||||||
|
} else if ((!isCreatedDayProvided && !isStatusProvided) && (operationCode != null && !operationCode.isEmpty())) {
|
||||||
|
int size = operationCode.size();
|
||||||
|
sql.append(" WHERE (o.OPERATION_CODE = ? ");
|
||||||
|
for (int i = 0; i < size - 1; i++) {
|
||||||
|
sql.append(" OR o.OPERATION_CODE = ?");
|
||||||
|
}
|
||||||
|
sql.append(")");
|
||||||
|
isOperationCodeProvided = true;
|
||||||
|
}
|
||||||
|
sql.append(" ORDER BY o.CREATED_TIMESTAMP DESC LIMIT ?,?");
|
||||||
|
try {
|
||||||
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
|
try (PreparedStatement stmt = conn.prepareStatement(sql.toString())) {
|
||||||
|
int paramIndex = 1;
|
||||||
|
stmt.setString(paramIndex++, deviceId.getId());
|
||||||
|
if (isUpdatedDayProvided) {
|
||||||
|
stmt.setLong(paramIndex++, updatedFrom);
|
||||||
|
stmt.setLong(paramIndex++, updatedTo);
|
||||||
|
}
|
||||||
|
if (isCreatedDayProvided) {
|
||||||
|
stmt.setString(paramIndex++, createdFrom);
|
||||||
|
stmt.setString(paramIndex++, createdTo);
|
||||||
|
}
|
||||||
|
if (isStatusProvided) {
|
||||||
|
for (String s : status) {
|
||||||
|
stmt.setString(paramIndex++, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOperationCodeProvided) {
|
||||||
|
for (String s : operationCode) {
|
||||||
|
stmt.setString(paramIndex++, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stmt.setInt(paramIndex++, request.getStartIndex());
|
||||||
|
stmt.setInt(paramIndex, request.getRowCount());
|
||||||
|
try (ResultSet rs = stmt.executeQuery()) {
|
||||||
|
while (rs.next()) {
|
||||||
|
operation = new Operation();
|
||||||
|
operation.setId(rs.getInt("ID"));
|
||||||
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
||||||
|
operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString());
|
||||||
|
if (rs.getLong("UPDATED_TIMESTAMP") == 0) {
|
||||||
|
operation.setReceivedTimeStamp("");
|
||||||
|
} else {
|
||||||
|
operation.setReceivedTimeStamp(
|
||||||
|
new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString());
|
||||||
|
}
|
||||||
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
||||||
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
||||||
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
||||||
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
||||||
|
operations.add(operation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " +
|
||||||
|
"available for the device'" + deviceId + "' with status '", e);
|
||||||
|
}
|
||||||
|
return operations;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getOperationCountForDevice(int enrolmentId, PaginationRequest request)
|
public int getOperationCountForDevice(int enrolmentId, PaginationRequest request)
|
||||||
throws OperationManagementDAOException {
|
throws OperationManagementDAOException {
|
||||||
@ -1584,6 +1724,112 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOperationCountForDeviceWithDeviceIdentifier(DeviceIdentifier deviceId, PaginationRequest request)
|
||||||
|
throws OperationManagementDAOException {
|
||||||
|
String createdTo = null;
|
||||||
|
String createdFrom = null;
|
||||||
|
DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
|
if (request.getOperationLogFilters().getCreatedDayFrom() != null) {
|
||||||
|
createdFrom = simple.format(request.getOperationLogFilters().getCreatedDayFrom());
|
||||||
|
}
|
||||||
|
if (request.getOperationLogFilters().getCreatedDayTo() != null) {
|
||||||
|
createdTo = simple.format(request.getOperationLogFilters().getCreatedDayTo());
|
||||||
|
}
|
||||||
|
|
||||||
|
Long updatedFrom = request.getOperationLogFilters().getUpdatedDayFrom();
|
||||||
|
Long updatedTo = request.getOperationLogFilters().getUpdatedDayTo();
|
||||||
|
List<String> operationCodes = request.getOperationLogFilters().getOperationCode();
|
||||||
|
List<String> status = request.getOperationLogFilters().getStatus();
|
||||||
|
boolean isCreatedDayProvided = false;
|
||||||
|
boolean isUpdatedDayProvided = false;
|
||||||
|
boolean isOperationCodeProvided = false;
|
||||||
|
boolean isStatusProvided = false;
|
||||||
|
|
||||||
|
String sql = "SELECT "
|
||||||
|
+ "COUNT(o.ID) AS OPERATION_COUNT "
|
||||||
|
+ "FROM "
|
||||||
|
+ "DM_OPERATION o "
|
||||||
|
+ "INNER JOIN "
|
||||||
|
+ "(SELECT dm.OPERATION_ID, "
|
||||||
|
+ "dm.ID, "
|
||||||
|
+ "dm.STATUS, "
|
||||||
|
+ "dm.UPDATED_TIMESTAMP "
|
||||||
|
+ "FROM "
|
||||||
|
+ "DM_ENROLMENT_OP_MAPPING dm "
|
||||||
|
+ "WHERE "
|
||||||
|
+ "dm.DEVICE_IDENTIFICATION = ?";
|
||||||
|
|
||||||
|
if (updatedFrom != null && updatedFrom != 0 && updatedTo != null && updatedTo != 0) {
|
||||||
|
sql += " AND dm.UPDATED_TIMESTAMP BETWEEN ? AND ?";
|
||||||
|
isUpdatedDayProvided = true;
|
||||||
|
}
|
||||||
|
sql += ") om ON o.ID = om.OPERATION_ID ";
|
||||||
|
if (createdFrom != null && !createdFrom.isEmpty() && createdTo != null && !createdTo.isEmpty()) {
|
||||||
|
sql += " WHERE o.CREATED_TIMESTAMP BETWEEN ? AND ?";
|
||||||
|
isCreatedDayProvided = true;
|
||||||
|
}
|
||||||
|
if (status != null && !status.isEmpty()) {
|
||||||
|
if (isCreatedDayProvided) {
|
||||||
|
sql += " AND (om.STATUS = ? ";
|
||||||
|
} else {
|
||||||
|
sql += " WHERE (om.STATUS = ? ";
|
||||||
|
}
|
||||||
|
sql = IntStream.range(0, status.size() - 1).mapToObj(i -> " OR om.STATUS = ?")
|
||||||
|
.collect(Collectors.joining("", sql, ""));
|
||||||
|
sql += ")";
|
||||||
|
isStatusProvided = true;
|
||||||
|
}
|
||||||
|
if (operationCodes != null && !operationCodes.isEmpty()) {
|
||||||
|
if (isCreatedDayProvided || isStatusProvided) {
|
||||||
|
sql += " AND (o.OPERATION_CODE = ? ";
|
||||||
|
} else {
|
||||||
|
sql += " WHERE (o.OPERATION_CODE = ? ";
|
||||||
|
}
|
||||||
|
sql = IntStream.range(0, operationCodes.size() - 1).mapToObj(i -> " OR o.OPERATION_CODE = ?")
|
||||||
|
.collect(Collectors.joining("", sql, ""));
|
||||||
|
sql += ")";
|
||||||
|
isOperationCodeProvided = true;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||||
|
int paramIndex = 1;
|
||||||
|
stmt.setString(paramIndex++, deviceId.getId());
|
||||||
|
if (isUpdatedDayProvided) {
|
||||||
|
stmt.setLong(paramIndex++, updatedFrom);
|
||||||
|
stmt.setLong(paramIndex++, updatedTo);
|
||||||
|
}
|
||||||
|
if (isCreatedDayProvided) {
|
||||||
|
stmt.setString(paramIndex++, createdFrom);
|
||||||
|
stmt.setString(paramIndex++, createdTo);
|
||||||
|
}
|
||||||
|
if (isStatusProvided) {
|
||||||
|
for (String s : status) {
|
||||||
|
stmt.setString(paramIndex++, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOperationCodeProvided) {
|
||||||
|
for (String s : operationCodes) {
|
||||||
|
stmt.setString(paramIndex++, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try (ResultSet rs = stmt.executeQuery()) {
|
||||||
|
if (rs.next()) {
|
||||||
|
return rs.getInt("OPERATION_COUNT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "SQL error occurred while retrieving the operation count of the device" + deviceId
|
||||||
|
+ " for search query";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new OperationManagementDAOException(msg, e);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Operation getNextOperation(int enrolmentId, Operation.Status status) throws OperationManagementDAOException {
|
public Operation getNextOperation(int enrolmentId, Operation.Status status) throws OperationManagementDAOException {
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
|
|||||||
@ -120,6 +120,7 @@ public class OperationDAOUtil {
|
|||||||
operation.setEnabled(dtoOperation.isEnabled());
|
operation.setEnabled(dtoOperation.isEnabled());
|
||||||
operation.setProperties(dtoOperation.getProperties());
|
operation.setProperties(dtoOperation.getProperties());
|
||||||
operation.setActivityId(dtoOperation.getActivityId());
|
operation.setActivityId(dtoOperation.getActivityId());
|
||||||
|
operation.setInitiatedBy(dtoOperation.getInitiatedBy());
|
||||||
|
|
||||||
|
|
||||||
return operation;
|
return operation;
|
||||||
|
|||||||
@ -345,4 +345,6 @@ public interface GroupManagementProviderService {
|
|||||||
* @throws GroupManagementException
|
* @throws GroupManagementException
|
||||||
*/
|
*/
|
||||||
DeviceTypesOfGroups getDeviceTypesOfGroups(List<String> identifiers) throws GroupManagementException;
|
DeviceTypesOfGroups getDeviceTypesOfGroups(List<String> identifiers) throws GroupManagementException;
|
||||||
|
|
||||||
|
DeviceGroup getUserOwnGroup(int groupId, boolean requireGroupProps, int depth) throws GroupManagementException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,11 +45,7 @@ import org.wso2.carbon.user.api.UserStoreException;
|
|||||||
import org.wso2.carbon.user.api.UserStoreManager;
|
import org.wso2.carbon.user.api.UserStoreManager;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -552,24 +548,19 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|||||||
throw new GroupManagementException(msg);
|
throw new GroupManagementException(msg);
|
||||||
}
|
}
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Get groups with hierarchy " + request.toString());
|
log.debug("Get groups with hierarchy " + request);
|
||||||
}
|
}
|
||||||
boolean isWithParentPath = false;
|
|
||||||
DeviceManagerUtil.validateGroupListPageSize(request);
|
DeviceManagerUtil.validateGroupListPageSize(request);
|
||||||
List<DeviceGroup> rootGroups;
|
List<DeviceGroup> rootGroups;
|
||||||
try {
|
try {
|
||||||
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
request.setParentPath(DeviceGroupConstants.HierarchicalGroup.SEPERATOR);
|
request.setParentPath(DeviceGroupConstants.HierarchicalGroup.SEPERATOR);
|
||||||
if (StringUtils.isBlank(username)) {
|
|
||||||
GroupManagementDAOFactory.openConnection();
|
|
||||||
rootGroups = groupDAO.getGroups(request, tenantId);
|
|
||||||
} else {
|
|
||||||
List<Integer> allDeviceGroupIdsOfUser = getGroupIds(username);
|
|
||||||
GroupManagementDAOFactory.openConnection();
|
|
||||||
rootGroups = this.groupDAO.getGroups(request, allDeviceGroupIdsOfUser, tenantId, isWithParentPath);
|
|
||||||
}
|
|
||||||
String parentPath;
|
String parentPath;
|
||||||
List<DeviceGroup> childrenGroups;
|
List<DeviceGroup> childrenGroups;
|
||||||
|
if (StringUtils.isBlank(username)) {
|
||||||
|
try {
|
||||||
|
GroupManagementDAOFactory.openConnection();
|
||||||
|
rootGroups = groupDAO.getGroups(request, tenantId);
|
||||||
for (DeviceGroup rootGroup : rootGroups) {
|
for (DeviceGroup rootGroup : rootGroups) {
|
||||||
parentPath = DeviceManagerUtil.createParentPath(rootGroup);
|
parentPath = DeviceManagerUtil.createParentPath(rootGroup);
|
||||||
childrenGroups = groupDAO.getChildrenGroups(parentPath, tenantId);
|
childrenGroups = groupDAO.getChildrenGroups(parentPath, tenantId);
|
||||||
@ -579,10 +570,6 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|||||||
populateGroupProperties(rootGroup, tenantId);
|
populateGroupProperties(rootGroup, tenantId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (GroupManagementDAOException e) {
|
|
||||||
String msg = "Error occurred while retrieving all groups with hierarchy";
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new GroupManagementException(msg, e);
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
String msg = "Error occurred while opening a connection to the data source to retrieve all groups "
|
String msg = "Error occurred while opening a connection to the data source to retrieve all groups "
|
||||||
+ "with hierarchy";
|
+ "with hierarchy";
|
||||||
@ -591,6 +578,21 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|||||||
} finally {
|
} finally {
|
||||||
GroupManagementDAOFactory.closeConnection();
|
GroupManagementDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
List<Integer> allDeviceGroupIdsOfUser = getGroupIds(username);
|
||||||
|
rootGroups = this.getGroups(allDeviceGroupIdsOfUser, tenantId);
|
||||||
|
if (requireGroupProps) {
|
||||||
|
for (DeviceGroup rootGroup : rootGroups) {
|
||||||
|
populateGroupProperties(rootGroup, tenantId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (GroupManagementDAOException e) {
|
||||||
|
String msg = "Error occurred while retrieving all groups with hierarchy";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new GroupManagementException(msg, e);
|
||||||
|
}
|
||||||
|
|
||||||
PaginationResult groupResult = new PaginationResult();
|
PaginationResult groupResult = new PaginationResult();
|
||||||
groupResult.setData(rootGroups);
|
groupResult.setData(rootGroups);
|
||||||
if (StringUtils.isBlank(username)) {
|
if (StringUtils.isBlank(username)) {
|
||||||
@ -601,6 +603,127 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|||||||
return groupResult;
|
return groupResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<DeviceGroup> getGroups(List<Integer> groupIds, int tenantId) throws GroupManagementException {
|
||||||
|
try {
|
||||||
|
GroupManagementDAOFactory.openConnection();
|
||||||
|
List<DeviceGroup >groups = groupDAO.getGroups(groupIds, tenantId);
|
||||||
|
if (groups == null) {
|
||||||
|
String msg = "Retrieved null when getting groups for group ids " + groupIds.toString();
|
||||||
|
log.error(msg);
|
||||||
|
throw new GroupManagementException(msg);
|
||||||
|
}
|
||||||
|
if (groups.isEmpty()) return groups;
|
||||||
|
groups.sort(Comparator.comparing(DeviceGroup::getGroupId));
|
||||||
|
return getTree(groups);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "Error occurred while opening a connection to the data source to retrieve all groups "
|
||||||
|
+ "with hierarchy";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new GroupManagementException(msg, e);
|
||||||
|
} catch (GroupManagementDAOException ex) {
|
||||||
|
String msg = "Error occurred while getting groups for group ids " + groupIds.toString();
|
||||||
|
log.error(msg, ex);
|
||||||
|
throw new GroupManagementException(msg, ex);
|
||||||
|
} finally {
|
||||||
|
GroupManagementDAOFactory.closeConnection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DeviceGroup> getTree(List<DeviceGroup> groups) {
|
||||||
|
List<DeviceGroup> tree = new ArrayList<>();
|
||||||
|
for (DeviceGroup deviceGroup : groups) {
|
||||||
|
DeviceGroup treeNode = tree.stream().
|
||||||
|
filter(node -> Arrays.stream(deviceGroup.getParentPath().split("/")).
|
||||||
|
collect(Collectors.toList()).contains(Integer.toString(node.getGroupId()))).
|
||||||
|
findFirst().orElse(null);
|
||||||
|
if (treeNode != null) {
|
||||||
|
if (Objects.equals(treeNode.getParentPath(), deviceGroup.getParentPath())) {
|
||||||
|
tree.add(deviceGroup);
|
||||||
|
} else {
|
||||||
|
List<DeviceGroup> tempGroups = treeNode.getChildrenGroups();
|
||||||
|
if (tempGroups == null) {
|
||||||
|
tempGroups = new ArrayList<>();
|
||||||
|
}
|
||||||
|
tempGroups.add(deviceGroup);
|
||||||
|
treeNode.setChildrenGroups(getTree(tempGroups));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tree.add(deviceGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DeviceGroup findGroupFromTree(List<DeviceGroup> tree, int groupId) {
|
||||||
|
for (DeviceGroup node: tree) {
|
||||||
|
if (node.getGroupId() == groupId) return node;
|
||||||
|
if (node.getChildrenGroups() != null) {
|
||||||
|
DeviceGroup tempNode = findGroupFromTree(node.getChildrenGroups(), groupId);
|
||||||
|
if (tempNode != null) {
|
||||||
|
return tempNode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAdminUser(String username, UserStoreManager userStoreManager)
|
||||||
|
throws GroupManagementException {
|
||||||
|
try {
|
||||||
|
if (!userStoreManager.isExistingUser(username)) {
|
||||||
|
String msg = "User doesn't exists with given username " + username;
|
||||||
|
throw new GroupManagementException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
String []currentRoles = userStoreManager.getRoleListOfUser(username);
|
||||||
|
for (String role : currentRoles) {
|
||||||
|
if (role.equals("admin")) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} catch (UserStoreException e) {
|
||||||
|
String msg = "Error occurred while requesting user details";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new GroupManagementException(msg, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceGroup getUserOwnGroup(int groupId, boolean requireGroupProps, int depth) throws GroupManagementException {
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
String username = ctx.getUsername();
|
||||||
|
int tenantId = ctx.getTenantId();
|
||||||
|
try {
|
||||||
|
UserStoreManager userStoreManager = DeviceManagementDataHolder.getInstance().
|
||||||
|
getRealmService().getTenantUserRealm(tenantId).getUserStoreManager();
|
||||||
|
if (isAdminUser(username, userStoreManager)) {
|
||||||
|
return getGroup(groupId, requireGroupProps);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Integer> userOwnGroupIds = this.getGroupIds(username);
|
||||||
|
if (userOwnGroupIds == null) {
|
||||||
|
String msg = "Retrieved null when getting group ids for user " + username;
|
||||||
|
log.error(msg);
|
||||||
|
throw new GroupManagementException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceGroup deviceGroup = findGroupFromTree(
|
||||||
|
getGroups(userOwnGroupIds, tenantId), groupId);
|
||||||
|
if (deviceGroup != null && requireGroupProps)
|
||||||
|
populateGroupProperties(deviceGroup, tenantId);
|
||||||
|
|
||||||
|
return deviceGroup;
|
||||||
|
} catch (UserStoreException e) {
|
||||||
|
String msg = "Error occurred while getting user store manager service";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new GroupManagementException(msg, e);
|
||||||
|
} catch (GroupManagementDAOException e) {
|
||||||
|
String msg = "Error occurred while obtaining group '" + groupId + "'";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new GroupManagementException(msg, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceGroup> getGroups(String username, boolean requireGroupProps) throws GroupManagementException {
|
public List<DeviceGroup> getGroups(String username, boolean requireGroupProps) throws GroupManagementException {
|
||||||
if (username == null || username.isEmpty()) {
|
if (username == null || username.isEmpty()) {
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionMana
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.powermock.api.mockito.PowerMockito;
|
import org.powermock.api.mockito.PowerMockito;
|
||||||
|
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.IObjectFactory;
|
import org.testng.IObjectFactory;
|
||||||
@ -40,6 +41,9 @@ import static org.mockito.MockitoAnnotations.initMocks;
|
|||||||
* This contains unit tests for PermissionManagerService class.
|
* This contains unit tests for PermissionManagerService class.
|
||||||
*/
|
*/
|
||||||
@PrepareForTest(PermissionUtils.class)
|
@PrepareForTest(PermissionUtils.class)
|
||||||
|
@PowerMockIgnore("org.mockito.*")
|
||||||
|
|
||||||
|
//@PowerMockIgnore({"javax.management.*", "javax.script.*", "com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
|
||||||
public class PermissionManagerServiceTest {
|
public class PermissionManagerServiceTest {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(PermissionManagerServiceTest.class);;
|
private static final Log log = LogFactory.getLog(PermissionManagerServiceTest.class);;
|
||||||
|
|||||||
@ -29,7 +29,6 @@ import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementServic
|
|||||||
import io.entgra.device.mgt.core.device.mgt.core.search.mgt.InvalidOperatorException;
|
import io.entgra.device.mgt.core.device.mgt.core.search.mgt.InvalidOperatorException;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.search.mgt.SearchMgtException;
|
import io.entgra.device.mgt.core.device.mgt.core.search.mgt.SearchMgtException;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.search.mgt.impl.ProcessorImpl;
|
import io.entgra.device.mgt.core.device.mgt.core.search.mgt.impl.ProcessorImpl;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.search.util.ChangeEnumValues;
|
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.search.util.Utils;
|
import io.entgra.device.mgt.core.device.mgt.core.search.util.Utils;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService;
|
import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl;
|
import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl;
|
||||||
@ -131,8 +130,6 @@ public class ProcessorImplTest extends BaseDeviceManagementTest {
|
|||||||
public void testInvalidState() throws SearchMgtException {
|
public void testInvalidState() throws SearchMgtException {
|
||||||
SearchContext context = new SearchContext();
|
SearchContext context = new SearchContext();
|
||||||
List<Condition> conditions = new ArrayList<>();
|
List<Condition> conditions = new ArrayList<>();
|
||||||
ChangeEnumValues.addEnum(Condition.State.class, "BLA");
|
|
||||||
Condition.State state = Condition.State.valueOf("BLA");
|
|
||||||
|
|
||||||
Condition cond = new Condition();
|
Condition cond = new Condition();
|
||||||
cond.setKey("batteryLevel");
|
cond.setKey("batteryLevel");
|
||||||
@ -152,7 +149,7 @@ public class ProcessorImplTest extends BaseDeviceManagementTest {
|
|||||||
cond3.setKey("batteryLevel");
|
cond3.setKey("batteryLevel");
|
||||||
cond3.setOperator("=");
|
cond3.setOperator("=");
|
||||||
cond3.setValue("23.0");
|
cond3.setValue("23.0");
|
||||||
cond3.setState(state);
|
cond3.setState(Condition.State.AND);
|
||||||
conditions.add(cond3);
|
conditions.add(cond3);
|
||||||
|
|
||||||
context.setConditions(conditions);
|
context.setConditions(conditions);
|
||||||
|
|||||||
@ -1,122 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
|
||||||
* Version 2.0 (the "License"); you may not use this file except
|
|
||||||
* in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package io.entgra.device.mgt.core.device.mgt.core.search.util;
|
|
||||||
|
|
||||||
import io.entgra.device.mgt.core.device.mgt.common.search.Condition;
|
|
||||||
import sun.reflect.ConstructorAccessor;
|
|
||||||
import sun.reflect.FieldAccessor;
|
|
||||||
import sun.reflect.ReflectionFactory;
|
|
||||||
|
|
||||||
import java.lang.reflect.AccessibleObject;
|
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Changes the Enum values of a given class.
|
|
||||||
*/
|
|
||||||
public class ChangeEnumValues {
|
|
||||||
|
|
||||||
private static ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
|
|
||||||
|
|
||||||
public ChangeEnumValues() {}
|
|
||||||
|
|
||||||
private static void setFailSafeFieldValue(Field field, Object target, Object value) throws NoSuchFieldException,
|
|
||||||
IllegalAccessException {
|
|
||||||
field.setAccessible(true);
|
|
||||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
|
||||||
modifiersField.setAccessible(true);
|
|
||||||
int modifiers = modifiersField.getInt(field);
|
|
||||||
modifiers &= ~Modifier.FINAL;
|
|
||||||
modifiersField.setInt(field, modifiers);
|
|
||||||
FieldAccessor fa = reflectionFactory.newFieldAccessor(field, false);
|
|
||||||
fa.set(target, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void blankField(Class<?> enumClass, String fieldName) throws NoSuchFieldException,
|
|
||||||
IllegalAccessException {
|
|
||||||
for (Field field : Class.class.getDeclaredFields()) {
|
|
||||||
if (field.getName().contains(fieldName)) {
|
|
||||||
AccessibleObject.setAccessible(new Field[]{field}, true);
|
|
||||||
setFailSafeFieldValue(field, enumClass, null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void cleanEnumCache(Class<?> enumClass) throws NoSuchFieldException, IllegalAccessException {
|
|
||||||
blankField(enumClass, "enumConstantDirectory");
|
|
||||||
blankField(enumClass, "enumConstants");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ConstructorAccessor getConstructorAccessor(Class<?> enumClass, Class<?>[] additionalParameterTypes)
|
|
||||||
throws NoSuchMethodException {
|
|
||||||
Class<?>[] parameterTypes = new Class[additionalParameterTypes.length + 2];
|
|
||||||
parameterTypes[0] = String.class;
|
|
||||||
parameterTypes[1] = int.class;
|
|
||||||
System.arraycopy(additionalParameterTypes, 0, parameterTypes, 2, additionalParameterTypes.length);
|
|
||||||
return reflectionFactory.newConstructorAccessor(enumClass.getDeclaredConstructor(parameterTypes));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Object makeEnum(Class<?> enumClass, String value, int ordinal, Class<?>[] additionalTypes,
|
|
||||||
Object[] additionalValues) throws Exception {
|
|
||||||
Object[] parms = new Object[additionalValues.length + 2];
|
|
||||||
parms[0] = value;
|
|
||||||
parms[1] = ordinal;
|
|
||||||
System.arraycopy(additionalValues, 0, parms, 2, additionalValues.length);
|
|
||||||
return enumClass.cast(getConstructorAccessor(enumClass, additionalTypes).newInstance(parms));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add an enum instance to the enum class given as argument
|
|
||||||
*
|
|
||||||
* @param <T> the type of the enum
|
|
||||||
* @param enumType the class of the enum to be modified
|
|
||||||
* @param enumName the name of the new enum instance to be added to the class.
|
|
||||||
*/
|
|
||||||
public static <T extends Enum<?>> void addEnum(Class<T> enumType, String enumName) {
|
|
||||||
|
|
||||||
if (!Enum.class.isAssignableFrom(enumType)) {
|
|
||||||
throw new RuntimeException("class " + enumType + " is not an instance of Enum");
|
|
||||||
}
|
|
||||||
|
|
||||||
Field valuesField = null;
|
|
||||||
Field[] fields = Condition.State.class.getDeclaredFields();
|
|
||||||
for (Field field : fields) {
|
|
||||||
if (field.getName().contains("$VALUES")) {
|
|
||||||
valuesField = field;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AccessibleObject.setAccessible(new Field[]{valuesField}, true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
T[] previousValues = (T[]) valuesField.get(enumType);
|
|
||||||
List<T> values = new ArrayList<T>(Arrays.asList(previousValues));
|
|
||||||
T newValue = (T) makeEnum(enumType, enumName, values.size(), new Class<?>[]{}, new Object[]{});
|
|
||||||
values.add(newValue);
|
|
||||||
setFailSafeFieldValue(valuesField, null, values.toArray((T[]) Array.newInstance(enumType, 0)));
|
|
||||||
cleanEnumCache(enumType);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -18,7 +18,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<DataSourceConfig>
|
<DataSourceConfig>
|
||||||
<Url>jdbc:h2:mem:cdm-test-db;DB_CLOSE_ON_EXIT=FALSE;MVCC=true</Url>
|
<Url>jdbc:h2:mem:cdm-test-db;DB_CLOSE_ON_EXIT=FALSE</Url>
|
||||||
<DriverClassName>io.entgra.device.mgt.core.device.mgt.core.mock.MockJDBCDriver</DriverClassName>
|
<DriverClassName>io.entgra.device.mgt.core.device.mgt.core.mock.MockJDBCDriver</DriverClassName>
|
||||||
<User>wso2carbon</User>
|
<User>wso2carbon</User>
|
||||||
<Password>wso2carbon</Password>
|
<Password>wso2carbon</Password>
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<DataSourceConfig>
|
<DataSourceConfig>
|
||||||
<Url>jdbc:h2:mem:nodb-test-db;DB_CLOSE_ON_EXIT=FALSE;MVCC=true</Url>
|
<Url>jdbc:h2:mem:nodb-test-db;DB_CLOSE_ON_EXIT=FALSE</Url>
|
||||||
<DriverClassName>org.h2.Driver</DriverClassName>
|
<DriverClassName>org.h2.Driver</DriverClassName>
|
||||||
<User>wso2carbon</User>
|
<User>wso2carbon</User>
|
||||||
<Password>wso2carbon</Password>
|
<Password>wso2carbon</Password>
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<DataSourceConfig>
|
<DataSourceConfig>
|
||||||
<Url>jdbc:h2:mem:cdm-test-db;DB_CLOSE_ON_EXIT=FALSE;MVCC=true</Url>
|
<Url>jdbc:h2:mem:cdm-test-db;DB_CLOSE_ON_EXIT=FALSE</Url>
|
||||||
<DriverClassName>org.h2.Driver</DriverClassName>
|
<DriverClassName>org.h2.Driver</DriverClassName>
|
||||||
<User>wso2carbon</User>
|
<User>wso2carbon</User>
|
||||||
<Password>wso2carbon</Password>
|
<Password>wso2carbon</Password>
|
||||||
|
|||||||
@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|||||||
ID INTEGER auto_increment NOT NULL,
|
ID INTEGER auto_increment NOT NULL,
|
||||||
DESCRIPTION TEXT DEFAULT NULL,
|
DESCRIPTION TEXT DEFAULT NULL,
|
||||||
NAME VARCHAR(100) DEFAULT NULL,
|
NAME VARCHAR(100) DEFAULT NULL,
|
||||||
DEVICE_TYPE_ID INT(11) DEFAULT NULL,
|
DEVICE_TYPE_ID INT DEFAULT NULL,
|
||||||
DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
|
DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
|
||||||
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
|
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
|
||||||
TENANT_ID INTEGER DEFAULT 0,
|
TENANT_ID INTEGER DEFAULT 0,
|
||||||
@ -180,16 +180,18 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_POLICY (
|
||||||
ID INT(11) NOT NULL AUTO_INCREMENT ,
|
ID INT NOT NULL AUTO_INCREMENT ,
|
||||||
NAME VARCHAR(45) DEFAULT NULL ,
|
NAME VARCHAR(45) DEFAULT NULL ,
|
||||||
DESCRIPTION VARCHAR(1000) NULL,
|
DESCRIPTION VARCHAR(1000) NULL,
|
||||||
TENANT_ID INT(11) NOT NULL ,
|
PAYLOAD_VERSION VARCHAR (45) NULL,
|
||||||
PROFILE_ID INT(11) NOT NULL ,
|
TENANT_ID INT NOT NULL ,
|
||||||
|
PROFILE_ID INT NOT NULL ,
|
||||||
OWNERSHIP_TYPE VARCHAR(45) NULL,
|
OWNERSHIP_TYPE VARCHAR(45) NULL,
|
||||||
COMPLIANCE VARCHAR(100) NULL,
|
COMPLIANCE VARCHAR(100) NULL,
|
||||||
PRIORITY INT NOT NULL,
|
PRIORITY INT NOT NULL,
|
||||||
ACTIVE INT(2) NOT NULL,
|
ACTIVE INT NOT NULL,
|
||||||
UPDATED INT(1) NULL,
|
UPDATED INT NULL,
|
||||||
|
POLICY_TYPE VARCHAR(45) NULL,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_DM_PROFILE_DM_POLICY
|
CONSTRAINT FK_DM_PROFILE_DM_POLICY
|
||||||
FOREIGN KEY (PROFILE_ID )
|
FOREIGN KEY (PROFILE_ID )
|
||||||
@ -199,11 +201,11 @@ CREATE TABLE IF NOT EXISTS DM_POLICY (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
||||||
ID INT(11) NOT NULL AUTO_INCREMENT ,
|
ID INT NOT NULL AUTO_INCREMENT ,
|
||||||
DEVICE_ID INT(11) NOT NULL ,
|
DEVICE_ID INT NOT NULL ,
|
||||||
ENROLMENT_ID INT(11) NOT NULL,
|
ENROLMENT_ID INT NOT NULL,
|
||||||
DEVICE BLOB NOT NULL,
|
DEVICE BLOB NOT NULL,
|
||||||
POLICY_ID INT(11) NOT NULL ,
|
POLICY_ID INT NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_POLICY_DEVICE_POLICY
|
CONSTRAINT FK_POLICY_DEVICE_POLICY
|
||||||
FOREIGN KEY (POLICY_ID )
|
FOREIGN KEY (POLICY_ID )
|
||||||
@ -218,9 +220,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
||||||
ID INT(11) NOT NULL ,
|
ID INT NOT NULL ,
|
||||||
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
POLICY_ID INT(11) NOT NULL ,
|
POLICY_ID INT NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
||||||
FOREIGN KEY (POLICY_ID )
|
FOREIGN KEY (POLICY_ID )
|
||||||
@ -230,11 +232,11 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
||||||
ID INT(11) NOT NULL AUTO_INCREMENT,
|
ID INT NOT NULL AUTO_INCREMENT,
|
||||||
PROFILE_ID INT(11) NOT NULL,
|
PROFILE_ID INT NOT NULL,
|
||||||
FEATURE_CODE VARCHAR(100) NOT NULL,
|
FEATURE_CODE VARCHAR(100) NOT NULL,
|
||||||
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
||||||
TENANT_ID INT(11) NOT NULL ,
|
TENANT_ID INT NOT NULL ,
|
||||||
CONTENT BLOB NULL DEFAULT NULL,
|
CONTENT BLOB NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES
|
CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES
|
||||||
@ -245,9 +247,9 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
|
||||||
ID INT(11) NOT NULL AUTO_INCREMENT ,
|
ID INT NOT NULL AUTO_INCREMENT ,
|
||||||
ROLE_NAME VARCHAR(45) NOT NULL ,
|
ROLE_NAME VARCHAR(45) NOT NULL ,
|
||||||
POLICY_ID INT(11) NOT NULL ,
|
POLICY_ID INT NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_ROLE_POLICY_POLICY
|
CONSTRAINT FK_ROLE_POLICY_POLICY
|
||||||
FOREIGN KEY (POLICY_ID )
|
FOREIGN KEY (POLICY_ID )
|
||||||
@ -271,11 +273,11 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
|
|||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
|
||||||
ID INT NOT NULL AUTO_INCREMENT ,
|
ID INT NOT NULL AUTO_INCREMENT ,
|
||||||
DEVICE_ID INT NOT NULL ,
|
DEVICE_ID INT NOT NULL ,
|
||||||
ENROLMENT_ID INT(11) NOT NULL,
|
ENROLMENT_ID INT NOT NULL,
|
||||||
POLICY_ID INT NOT NULL ,
|
POLICY_ID INT NOT NULL ,
|
||||||
POLICY_CONTENT BLOB NULL ,
|
POLICY_CONTENT BLOB NULL ,
|
||||||
TENANT_ID INT NOT NULL,
|
TENANT_ID INT NOT NULL,
|
||||||
APPLIED TINYINT(1) NULL ,
|
APPLIED TINYINT NULL ,
|
||||||
CREATED_TIME TIMESTAMP NULL ,
|
CREATED_TIME TIMESTAMP NULL ,
|
||||||
UPDATED_TIME TIMESTAMP NULL ,
|
UPDATED_TIME TIMESTAMP NULL ,
|
||||||
APPLIED_TIME TIMESTAMP NULL ,
|
APPLIED_TIME TIMESTAMP NULL ,
|
||||||
@ -328,7 +330,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
|
|||||||
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
||||||
ID INT NOT NULL AUTO_INCREMENT,
|
ID INT NOT NULL AUTO_INCREMENT,
|
||||||
DEVICE_ID INT NOT NULL,
|
DEVICE_ID INT NOT NULL,
|
||||||
ENROLMENT_ID INT(11) NOT NULL,
|
ENROLMENT_ID INT NOT NULL,
|
||||||
POLICY_ID INT NOT NULL,
|
POLICY_ID INT NOT NULL,
|
||||||
TENANT_ID INT NOT NULL,
|
TENANT_ID INT NOT NULL,
|
||||||
STATUS INT NULL,
|
STATUS INT NULL,
|
||||||
@ -343,7 +345,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
|||||||
ID INT NOT NULL AUTO_INCREMENT,
|
ID INT NOT NULL AUTO_INCREMENT,
|
||||||
POLICY_ID INT NOT NULL,
|
POLICY_ID INT NOT NULL,
|
||||||
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
TENANT_ID INT(11) NOT NULL,
|
TENANT_ID INT NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -372,7 +374,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
|
|||||||
LOCATION_URL VARCHAR(100) DEFAULT NULL,
|
LOCATION_URL VARCHAR(100) DEFAULT NULL,
|
||||||
IMAGE_URL VARCHAR(100) DEFAULT NULL,
|
IMAGE_URL VARCHAR(100) DEFAULT NULL,
|
||||||
APP_PROPERTIES BLOB NULL,
|
APP_PROPERTIES BLOB NULL,
|
||||||
MEMORY_USAGE INTEGER(10) NULL,
|
MEMORY_USAGE INTEGER NULL,
|
||||||
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
|
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
DEVICE_ID INTEGER NOT NULL,
|
DEVICE_ID INTEGER NOT NULL,
|
||||||
ENROLMENT_ID INTEGER NOT NULL,
|
ENROLMENT_ID INTEGER NOT NULL,
|
||||||
@ -439,7 +441,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
|
|||||||
STATE VARCHAR(45) NULL,
|
STATE VARCHAR(45) NULL,
|
||||||
COUNTRY VARCHAR(45) NULL,
|
COUNTRY VARCHAR(45) NULL,
|
||||||
GEO_HASH VARCHAR(45) NULL,
|
GEO_HASH VARCHAR(45) NULL,
|
||||||
UPDATE_TIMESTAMP BIGINT(15) NOT NULL,
|
UPDATE_TIMESTAMP BIGINT NOT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
CONSTRAINT DM_DEVICE_LOCATION_DEVICE
|
CONSTRAINT DM_DEVICE_LOCATION_DEVICE
|
||||||
FOREIGN KEY (DEVICE_ID)
|
FOREIGN KEY (DEVICE_ID)
|
||||||
@ -472,8 +474,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
|
|||||||
CPU_USAGE DECIMAL(5) NULL,
|
CPU_USAGE DECIMAL(5) NULL,
|
||||||
TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
|
TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
|
||||||
AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
|
AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
|
||||||
PLUGGED_IN INT(1) NULL,
|
PLUGGED_IN INT NULL,
|
||||||
UPDATE_TIMESTAMP BIGINT(15) NOT NULL,
|
UPDATE_TIMESTAMP BIGINT NOT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
|
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
|
||||||
FOREIGN KEY (DEVICE_ID)
|
FOREIGN KEY (DEVICE_ID)
|
||||||
@ -487,24 +489,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
|
|||||||
ON UPDATE NO ACTION
|
ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
|
||||||
* Version 2.0 (the "License"); you may not use this file except
|
|
||||||
* in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
-- POLICY AND DEVICE GROUP MAPPING --
|
-- POLICY AND DEVICE GROUP MAPPING --
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
|
||||||
ID INT NOT NULL AUTO_INCREMENT,
|
ID INT NOT NULL AUTO_INCREMENT,
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
<EveryOneRoleName>everyone</EveryOneRoleName>
|
<EveryOneRoleName>everyone</EveryOneRoleName>
|
||||||
<ReadOnly>false</ReadOnly>
|
<ReadOnly>false</ReadOnly>
|
||||||
<MaxUserNameListLength>500</MaxUserNameListLength>
|
<MaxUserNameListLength>500</MaxUserNameListLength>
|
||||||
<Property name="url">jdbc:h2:target/databasetest/CARBON_TEST</Property>
|
<Property name="url">jdbc:h2:./target/databasetest/CARBON_TEST</Property>
|
||||||
<Property name="driverName">org.h2.Driver</Property>
|
<Property name="driverName">org.h2.Driver</Property>
|
||||||
<Property name="maxActive">50</Property>
|
<Property name="maxActive">50</Property>
|
||||||
<Property name="maxWait">60000</Property>
|
<Property name="maxWait">60000</Property>
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -66,6 +66,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon</groupId>
|
<groupId>org.wso2.carbon</groupId>
|
||||||
<artifactId>org.wso2.carbon.utils</artifactId>
|
<artifactId>org.wso2.carbon.utils</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.eclipse.platform</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon</groupId>
|
<groupId>org.wso2.carbon</groupId>
|
||||||
@ -145,6 +151,11 @@
|
|||||||
<groupId>org.wso2.orbit.javax.xml.bind</groupId>
|
<groupId>org.wso2.orbit.javax.xml.bind</groupId>
|
||||||
<artifactId>jaxb-api</artifactId>
|
<artifactId>jaxb-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
|
<artifactId>io.entgra.device.mgt.core.notification.logger</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -263,8 +274,6 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -16,24 +16,6 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
|
||||||
* Version 2.0 (the "License"); you may not use this file except
|
|
||||||
* in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS REG_CLUSTER_LOCK (
|
CREATE TABLE IF NOT EXISTS REG_CLUSTER_LOCK (
|
||||||
REG_LOCK_NAME VARCHAR (20),
|
REG_LOCK_NAME VARCHAR (20),
|
||||||
REG_LOCK_STATUS VARCHAR (20),
|
REG_LOCK_STATUS VARCHAR (20),
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<DataSourceConfig>
|
<DataSourceConfig>
|
||||||
<Url>jdbc:h2:mem:cdm-test-db;DB_CLOSE_ON_EXIT=FALSE;MVCC=true</Url>
|
<Url>jdbc:h2:mem:cdm-test-db;DB_CLOSE_ON_EXIT=FALSE</Url>
|
||||||
<DriverClassName>org.h2.Driver</DriverClassName>
|
<DriverClassName>org.h2.Driver</DriverClassName>
|
||||||
<User>wso2carbon</User>
|
<User>wso2carbon</User>
|
||||||
<Password>wso2carbon</Password>
|
<Password>wso2carbon</Password>
|
||||||
|
|||||||
@ -31,7 +31,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|||||||
ID INTEGER auto_increment NOT NULL,
|
ID INTEGER auto_increment NOT NULL,
|
||||||
DESCRIPTION TEXT DEFAULT NULL,
|
DESCRIPTION TEXT DEFAULT NULL,
|
||||||
NAME VARCHAR(100) DEFAULT NULL,
|
NAME VARCHAR(100) DEFAULT NULL,
|
||||||
DEVICE_TYPE_ID INT(11) DEFAULT NULL,
|
DEVICE_TYPE_ID INT DEFAULT NULL,
|
||||||
DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
|
DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
|
||||||
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
|
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL,
|
||||||
TENANT_ID INTEGER DEFAULT 0,
|
TENANT_ID INTEGER DEFAULT 0,
|
||||||
@ -177,16 +177,16 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_POLICY (
|
||||||
ID INT(11) NOT NULL AUTO_INCREMENT ,
|
ID INT NOT NULL AUTO_INCREMENT ,
|
||||||
NAME VARCHAR(45) DEFAULT NULL ,
|
NAME VARCHAR(45) DEFAULT NULL ,
|
||||||
DESCRIPTION VARCHAR(1000) NULL,
|
DESCRIPTION VARCHAR(1000) NULL,
|
||||||
TENANT_ID INT(11) NOT NULL ,
|
TENANT_ID INT NOT NULL ,
|
||||||
PROFILE_ID INT(11) NOT NULL ,
|
PROFILE_ID INT NOT NULL ,
|
||||||
OWNERSHIP_TYPE VARCHAR(45) NULL,
|
OWNERSHIP_TYPE VARCHAR(45) NULL,
|
||||||
COMPLIANCE VARCHAR(100) NULL,
|
COMPLIANCE VARCHAR(100) NULL,
|
||||||
PRIORITY INT NOT NULL,
|
PRIORITY INT NOT NULL,
|
||||||
ACTIVE INT(2) NOT NULL,
|
ACTIVE INT NOT NULL,
|
||||||
UPDATED INT(1) NULL,
|
UPDATED INT NULL,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_DM_PROFILE_DM_POLICY
|
CONSTRAINT FK_DM_PROFILE_DM_POLICY
|
||||||
FOREIGN KEY (PROFILE_ID )
|
FOREIGN KEY (PROFILE_ID )
|
||||||
@ -196,11 +196,11 @@ CREATE TABLE IF NOT EXISTS DM_POLICY (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
||||||
ID INT(11) NOT NULL AUTO_INCREMENT ,
|
ID INT NOT NULL AUTO_INCREMENT ,
|
||||||
DEVICE_ID INT(11) NOT NULL ,
|
DEVICE_ID INT NOT NULL ,
|
||||||
ENROLMENT_ID INT(11) NOT NULL,
|
ENROLMENT_ID INT NOT NULL,
|
||||||
DEVICE BLOB NOT NULL,
|
DEVICE BLOB NOT NULL,
|
||||||
POLICY_ID INT(11) NOT NULL ,
|
POLICY_ID INT NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_POLICY_DEVICE_POLICY
|
CONSTRAINT FK_POLICY_DEVICE_POLICY
|
||||||
FOREIGN KEY (POLICY_ID )
|
FOREIGN KEY (POLICY_ID )
|
||||||
@ -215,9 +215,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
||||||
ID INT(11) NOT NULL ,
|
ID INT NOT NULL ,
|
||||||
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
POLICY_ID INT(11) NOT NULL ,
|
POLICY_ID INT NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
CONSTRAINT FK_DEVICE_TYPE_POLICY
|
||||||
FOREIGN KEY (POLICY_ID )
|
FOREIGN KEY (POLICY_ID )
|
||||||
@ -227,11 +227,11 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
||||||
ID INT(11) NOT NULL AUTO_INCREMENT,
|
ID INT NOT NULL AUTO_INCREMENT,
|
||||||
PROFILE_ID INT(11) NOT NULL,
|
PROFILE_ID INT NOT NULL,
|
||||||
FEATURE_CODE VARCHAR(100) NOT NULL,
|
FEATURE_CODE VARCHAR(100) NOT NULL,
|
||||||
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
||||||
TENANT_ID INT(11) NOT NULL ,
|
TENANT_ID INT NOT NULL ,
|
||||||
CONTENT BLOB NULL DEFAULT NULL,
|
CONTENT BLOB NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES
|
CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES
|
||||||
@ -242,9 +242,9 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
|
|||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
|
CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY (
|
||||||
ID INT(11) NOT NULL AUTO_INCREMENT ,
|
ID INT NOT NULL AUTO_INCREMENT ,
|
||||||
ROLE_NAME VARCHAR(45) NOT NULL ,
|
ROLE_NAME VARCHAR(45) NOT NULL ,
|
||||||
POLICY_ID INT(11) NOT NULL ,
|
POLICY_ID INT NOT NULL ,
|
||||||
PRIMARY KEY (ID) ,
|
PRIMARY KEY (ID) ,
|
||||||
CONSTRAINT FK_ROLE_POLICY_POLICY
|
CONSTRAINT FK_ROLE_POLICY_POLICY
|
||||||
FOREIGN KEY (POLICY_ID )
|
FOREIGN KEY (POLICY_ID )
|
||||||
@ -268,11 +268,11 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY (
|
|||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED (
|
||||||
ID INT NOT NULL AUTO_INCREMENT ,
|
ID INT NOT NULL AUTO_INCREMENT ,
|
||||||
DEVICE_ID INT NOT NULL ,
|
DEVICE_ID INT NOT NULL ,
|
||||||
ENROLMENT_ID INT(11) NOT NULL,
|
ENROLMENT_ID INT NOT NULL,
|
||||||
POLICY_ID INT NOT NULL ,
|
POLICY_ID INT NOT NULL ,
|
||||||
POLICY_CONTENT BLOB NULL ,
|
POLICY_CONTENT BLOB NULL ,
|
||||||
TENANT_ID INT NOT NULL,
|
TENANT_ID INT NOT NULL,
|
||||||
APPLIED TINYINT(1) NULL ,
|
APPLIED TINYINT NULL ,
|
||||||
CREATED_TIME TIMESTAMP NULL ,
|
CREATED_TIME TIMESTAMP NULL ,
|
||||||
UPDATED_TIME TIMESTAMP NULL ,
|
UPDATED_TIME TIMESTAMP NULL ,
|
||||||
APPLIED_TIME TIMESTAMP NULL ,
|
APPLIED_TIME TIMESTAMP NULL ,
|
||||||
@ -325,7 +325,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
|
|||||||
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
||||||
ID INT NOT NULL AUTO_INCREMENT,
|
ID INT NOT NULL AUTO_INCREMENT,
|
||||||
DEVICE_ID INT NOT NULL,
|
DEVICE_ID INT NOT NULL,
|
||||||
ENROLMENT_ID INT(11) NOT NULL,
|
ENROLMENT_ID INT NOT NULL,
|
||||||
POLICY_ID INT NOT NULL,
|
POLICY_ID INT NOT NULL,
|
||||||
TENANT_ID INT NOT NULL,
|
TENANT_ID INT NOT NULL,
|
||||||
STATUS INT NULL,
|
STATUS INT NULL,
|
||||||
@ -340,7 +340,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
|||||||
ID INT NOT NULL AUTO_INCREMENT,
|
ID INT NOT NULL AUTO_INCREMENT,
|
||||||
POLICY_ID INT NOT NULL,
|
POLICY_ID INT NOT NULL,
|
||||||
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
DEVICE_TYPE VARCHAR(300) NOT NULL ,
|
||||||
TENANT_ID INT(11) NOT NULL,
|
TENANT_ID INT NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -369,10 +369,22 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
|
|||||||
LOCATION_URL VARCHAR(100) DEFAULT NULL,
|
LOCATION_URL VARCHAR(100) DEFAULT NULL,
|
||||||
IMAGE_URL VARCHAR(100) DEFAULT NULL,
|
IMAGE_URL VARCHAR(100) DEFAULT NULL,
|
||||||
APP_PROPERTIES BLOB NULL,
|
APP_PROPERTIES BLOB NULL,
|
||||||
MEMORY_USAGE INTEGER(10) NULL,
|
MEMORY_USAGE INTEGER NULL,
|
||||||
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
|
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
DEVICE_ID INTEGER NOT NULL,
|
||||||
|
ENROLMENT_ID INTEGER NOT NULL,
|
||||||
TENANT_ID INTEGER NOT NULL,
|
TENANT_ID INTEGER NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID),
|
||||||
|
CONSTRAINT fk_dm_device
|
||||||
|
FOREIGN KEY (DEVICE_ID)
|
||||||
|
REFERENCES DM_DEVICE (ID)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT fk_dm_enrolement
|
||||||
|
FOREIGN KEY (ENROLMENT_ID)
|
||||||
|
REFERENCES DM_ENROLMENT (ID)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
|
||||||
@ -380,34 +392,15 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
|
|||||||
DEVICE_ID INTEGER NOT NULL,
|
DEVICE_ID INTEGER NOT NULL,
|
||||||
APPLICATION_ID INTEGER NOT NULL,
|
APPLICATION_ID INTEGER NOT NULL,
|
||||||
APP_PROPERTIES BLOB NULL,
|
APP_PROPERTIES BLOB NULL,
|
||||||
MEMORY_USAGE INTEGER(10) NULL,
|
MEMORY_USAGE INTEGER NULL,
|
||||||
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
|
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
TENANT_ID INTEGER NOT NULL,
|
TENANT_ID INTEGER NOT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
|
CONSTRAINT fk_dm_device_tb FOREIGN KEY (DEVICE_ID) REFERENCES
|
||||||
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||||
CONSTRAINT fk_dm_application FOREIGN KEY (APPLICATION_ID) REFERENCES
|
CONSTRAINT fk_dm_application FOREIGN KEY (APPLICATION_ID) REFERENCES
|
||||||
DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
|
||||||
* Version 2.0 (the "License"); you may not use this file except
|
|
||||||
* in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
-- POLICY RELATED TABLES FINISHED --
|
-- POLICY RELATED TABLES FINISHED --
|
||||||
|
|
||||||
-- NOTIFICATION TABLE --
|
-- NOTIFICATION TABLE --
|
||||||
@ -451,7 +444,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
|
|||||||
STATE VARCHAR(45) NULL,
|
STATE VARCHAR(45) NULL,
|
||||||
COUNTRY VARCHAR(45) NULL,
|
COUNTRY VARCHAR(45) NULL,
|
||||||
GEO_HASH VARCHAR(45) NULL,
|
GEO_HASH VARCHAR(45) NULL,
|
||||||
UPDATE_TIMESTAMP BIGINT(15) NOT NULL,
|
UPDATE_TIMESTAMP BIGINT NOT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
CONSTRAINT DM_DEVICE_LOCATION_DEVICE
|
CONSTRAINT DM_DEVICE_LOCATION_DEVICE
|
||||||
FOREIGN KEY (DEVICE_ID)
|
FOREIGN KEY (DEVICE_ID)
|
||||||
@ -463,6 +456,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION (
|
|||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
|
||||||
ID INT NOT NULL AUTO_INCREMENT,
|
ID INT NOT NULL AUTO_INCREMENT,
|
||||||
DEVICE_ID INT NOT NULL,
|
DEVICE_ID INT NOT NULL,
|
||||||
|
ENROLMENT_ID INT NOT NULL,
|
||||||
DEVICE_MODEL VARCHAR(45) NULL,
|
DEVICE_MODEL VARCHAR(45) NULL,
|
||||||
VENDOR VARCHAR(45) NULL,
|
VENDOR VARCHAR(45) NULL,
|
||||||
OS_VERSION VARCHAR(45) NULL,
|
OS_VERSION VARCHAR(45) NULL,
|
||||||
@ -477,13 +471,18 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
|
|||||||
CPU_USAGE DECIMAL(5) NULL,
|
CPU_USAGE DECIMAL(5) NULL,
|
||||||
TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
|
TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
|
||||||
AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
|
AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
|
||||||
PLUGGED_IN INT(1) NULL,
|
PLUGGED_IN INT NULL,
|
||||||
UPDATE_TIMESTAMP BIGINT(15) NOT NULL,
|
UPDATE_TIMESTAMP BIGINT NOT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
|
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
|
||||||
FOREIGN KEY (DEVICE_ID)
|
FOREIGN KEY (DEVICE_ID)
|
||||||
REFERENCES DM_DEVICE (ID)
|
REFERENCES DM_DEVICE (ID)
|
||||||
ON DELETE NO ACTION
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT FK_DM_ENROLMENT_DEVICE_DETAILS
|
||||||
|
FOREIGN KEY (ENROLMENT_ID)
|
||||||
|
REFERENCES DM_ENROLMENT (ID)
|
||||||
|
ON DELETE NO ACTION
|
||||||
ON UPDATE NO ACTION
|
ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
<EveryOneRoleName>everyone</EveryOneRoleName>
|
<EveryOneRoleName>everyone</EveryOneRoleName>
|
||||||
<ReadOnly>false</ReadOnly>
|
<ReadOnly>false</ReadOnly>
|
||||||
<MaxUserNameListLength>500</MaxUserNameListLength>
|
<MaxUserNameListLength>500</MaxUserNameListLength>
|
||||||
<Property name="url">jdbc:h2:target/databasetest/CARBON_TEST</Property>
|
<Property name="url">jdbc:h2:./target/databasetest/CARBON_TEST</Property>
|
||||||
<Property name="driverName">org.h2.Driver</Property>
|
<Property name="driverName">org.h2.Driver</Property>
|
||||||
<Property name="maxActive">50</Property>
|
<Property name="maxActive">50</Property>
|
||||||
<Property name="maxWait">60000</Property>
|
<Property name="maxWait">60000</Property>
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>device-mgt</artifactId>
|
<artifactId>device-mgt</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>heartbeat-management</artifactId>
|
<artifactId>heartbeat-management</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>identity-extensions</artifactId>
|
<artifactId>identity-extensions</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>identity-extensions</artifactId>
|
<artifactId>identity-extensions</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>logger</artifactId>
|
<artifactId>logger</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>io.entgra.device.mgt.core.notification.logger</artifactId>
|
<artifactId>io.entgra.device.mgt.core.notification.logger</artifactId>
|
||||||
@ -36,7 +36,6 @@
|
|||||||
<groupId>org.ops4j.pax.logging</groupId>
|
<groupId>org.ops4j.pax.logging</groupId>
|
||||||
<artifactId>pax-logging-api</artifactId>
|
<artifactId>pax-logging-api</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<!-- <version>${pax.logging.api.version}</version>-->
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.testng</groupId>
|
<groupId>org.testng</groupId>
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>operation-template-mgt</artifactId>
|
<artifactId>operation-template-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>policy-mgt</artifactId>
|
<artifactId>policy-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>policy-mgt</artifactId>
|
<artifactId>policy-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>policy-mgt</artifactId>
|
<artifactId>policy-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>policy-mgt</artifactId>
|
<artifactId>policy-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -126,9 +126,6 @@
|
|||||||
<suiteXmlFiles>
|
<suiteXmlFiles>
|
||||||
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
|
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
|
||||||
</suiteXmlFiles>
|
</suiteXmlFiles>
|
||||||
<classpathDependencyExcludes>
|
|
||||||
<classpathDependencyExclude>org.ops4j.pax.logging</classpathDependencyExclude>
|
|
||||||
</classpathDependencyExcludes>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -286,6 +283,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.notification.logger</artifactId>
|
<artifactId>io.entgra.device.mgt.core.notification.logger</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@ -642,8 +642,8 @@ public class PolicyManagerImpl implements PolicyManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void activatePolicy(int policyId) throws PolicyManagementException {
|
public void activatePolicy(int policyId) throws PolicyManagementException {
|
||||||
try {
|
|
||||||
Policy policy = this.getPolicy(policyId);
|
Policy policy = this.getPolicy(policyId);
|
||||||
|
try {
|
||||||
PolicyManagementDAOFactory.beginTransaction();
|
PolicyManagementDAOFactory.beginTransaction();
|
||||||
policyDAO.activatePolicy(policyId);
|
policyDAO.activatePolicy(policyId);
|
||||||
policyDAO.recordUpdatedPolicy(policy);
|
policyDAO.recordUpdatedPolicy(policy);
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>subtype-mgt</artifactId>
|
<artifactId>subtype-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
<artifactId>io.entgra.device.mgt.core.parent</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>task-manager</artifactId>
|
<artifactId>task-manager</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>task-manager</artifactId>
|
<artifactId>task-manager</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>task-mgt</artifactId>
|
<artifactId>task-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>task-watcher</artifactId>
|
<artifactId>task-watcher</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<artifactId>task-mgt</artifactId>
|
<artifactId>task-mgt</artifactId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>tenant-mgt</artifactId>
|
<artifactId>tenant-mgt</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>tenant-mgt</artifactId>
|
<artifactId>tenant-mgt</artifactId>
|
||||||
<groupId>io.entgra.device.mgt.core</groupId>
|
<groupId>io.entgra.device.mgt.core</groupId>
|
||||||
<version>5.0.27-SNAPSHOT</version>
|
<version>5.0.29-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user