diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 9cbd495b14..0000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 10 -# Don't close isssues or pulls -daysUntilClose: false -# Issues with these labels will never be considered stale -exemptLabels: - - Resolution/Postponed -# Label to use when marking an issue as stale -staleLabel: Resolution/Stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 2530bdcfa7..0000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,28 +0,0 @@ -image: charithag/docker-mvn-jdk8:latest - -variables: - MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode" - MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository" - -cache: - paths: - - .m2/repository/ - - target/ - -build: - stage: build - script: - - mvn $MAVEN_CLI_OPTS clean install -Dmaven.test.skip=true - -test: - stage: test - script: - - mvn $MAVEN_CLI_OPTS test - -deploy: - stage: deploy - script: - - mvn $MAVEN_CLI_OPTS deploy -Dmaven.test.skip=true - only: - - master@entgra/carbon-device-mgt - - kernel-4.6.x@entgra/carbon-device-mgt diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0cbd9fd904..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: java -jdk: - - oraclejdk8 -cache: - directories: - - .autoconf - - $HOME/.m2 -script: mvn clean install diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000..11676b7a12 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,127 @@ +pipeline { + agent { + label 'node-agent' + } + environment { + def isPendingUpstreamDependenciesExists = false + def triggeredViaPush = false + JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' + PATH = "${JAVA_HOME}/bin:${env.PATH}" + } + stages { + stage('Initialize Variables') { + steps { + script { + // Define swaggerEndPoint as a global variable + swaggerEndPoint = { + def matcher = (env.CHANGE_URL =~ /^(?https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b)(?[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/) + matcher.find() + return matcher.group('host') + '/api/v1/repos' + matcher.group('path') + } + + echo "Swagger Endpoint: ${swaggerEndPoint.call()}" + } + } + } + + stage('Tool Versioning') { + steps { + script { + sh 'java -version' + sh 'node --version' + sh 'npm --version' + sh 'jq --version' + } + } + } + + stage('Check Environment Variables') { + steps { + script { + echo "CHANGE_ID: ${env.CHANGE_ID}" + echo "CHANGE_URL: ${env.CHANGE_URL}" + echo "CHANGE_AUTHOR: ${env.CHANGE_AUTHOR}" + echo "CHANGE_BRANCH: ${env.CHANGE_BRANCH}" + echo "JAVA_HOME: ${JAVA_HOME}" + echo "PATH: ${PATH}" + } + } + } + + stage('Fetch Pending Upstream Dependencies') { + steps { + script { + if (env.CHANGE_ID) { + def url = swaggerEndPoint.call() + echo "Fetching from URL: ${url}" + withCredentials([usernamePassword(credentialsId: 'entgra-gitea-credentials', passwordVariable: 'password', usernameVariable: 'username')]) { + def response = sh(script: """curl -X GET "${url}" -H 'accept: application/json' -u \$username:\$password""", returnStdout: true).trim() + echo "API Response: ${response}" + isPendingUpstreamDependenciesExists = sh(script: "echo '${response}' | jq 'contains({\"labels\": [{ \"name\": \"pending upstream\"}]})'", returnStdout: true).trim().toBoolean() + } + } else { + echo '[Jenkinsfile] Triggered via a push request.' + echo '[Jenkinsfile] Skipping dependency checking.' + triggeredViaPush = true + } + } + } + } + + stage('Execute Test Suites') { + steps { + script { + if (!isPendingUpstreamDependenciesExists) { + echo '[Jenkinsfile] Pending upstream dependencies do not exist.' + echo '[Jenkinsfile] Entering testing phase.' + try { + checkout scm + withCredentials([usernamePassword(credentialsId: 'builder2-deployer-nexus', passwordVariable: 'password', usernameVariable: 'username')]) { + sh """/opt/scripts/run-test.sh -u \$username -p \$password""" + } + currentBuild.result = 'SUCCESS' + message = 'Tests approved' + } catch (error) { + currentBuild.result = 'FAILURE' + message = 'Tests cannot be approved' + } + } else { + echo '[Jenkinsfile] Pending upstream dependencies exist.' + echo '[Jenkinsfile] Entering waiting phase.' + currentBuild.result = 'NOT_BUILT' + message = 'PR waiting due to pending upstream dependencies' + } + } + } + } + + stage('Report Job Status') { + steps { + script { + if (true) { + withCredentials([usernamePassword(credentialsId: 'entgra-gitea-credentials', passwordVariable: 'password', usernameVariable: 'username')]) { + def url = swaggerEndPoint.call() + '/reviews' + echo "[Jenkinsfile] Notifying pull request build status to ${url}" + def response = sh(script: """curl -X POST "${url}" -H 'accept: application/json' -H 'Content-Type: application/json' -u \$username:\$password -d '{ "body": "${message}" }'""", returnStdout: true).trim() + echo "API Response: ${response}" + } + } + + def committerEmail = sh( + script: 'git --no-pager show -s --format=\'%ae\'', + returnStdout: true + ).trim() + + if (currentBuild.result == 'FAILURE') { + emailext( + subject: "${currentBuild.result}: Job ${env.JOB_NAME} [${env.BUILD_NUMBER}]", + body: 'Hi, Please find below.\n
${BUILD_LOG_REGEX, regex="BUILD FAILURE", linesAfter=30, showTruncatedLines=false, escapeHtml=true}
' + "Find more at : ${env.BUILD_URL}", + to: triggeredViaPush ? '$DEFAULT_RECIPIENTS' : committerEmail + ) + } + } + } + } + } +} + diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml index b5c5bd3ac2..fc7ad23766 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core grafana-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api war - Entgra - Grafana Proxy API - Entgra - Grafana Proxy API + Entgra Device Management - Grafana Proxy API + Entgra Device Management - Grafana Proxy API http://entgra.io diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml index b2a6031989..12194db89f 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core grafana-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common bundle - Entgra - Grafana API Handler Common - Entgra - Grafana API Handler Common + Entgra Device Management - Grafana API Handler Common + Entgra Device Management - Grafana API Handler Common http://entgra.io diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml index 4199ff7273..db015d3895 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core grafana-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core bundle - Entgra - Grafana API Handler Core - Entgra - Grafana API Handler Core + Entgra Device Management - Grafana API Handler Core + Entgra Device Management - Grafana API Handler Core http://entgra.io @@ -83,7 +83,7 @@ com.google.common.cache;version="[32.1,33)";resolution:=optional, com.google.gson;version="[2.9,3)", - io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common.exception;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.bean, io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.config, io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.config.xml.bean, @@ -96,16 +96,16 @@ io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.sql.query, io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.sql.query.encoder, io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.util, - io.entgra.device.mgt.core.application.mgt.common.exception;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.core.config;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.core.util;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.common.util;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config.datasource;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.dao;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.report.mgt.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.report.mgt.dao.common;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.core.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.core.util;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.common.util;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config.datasource;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.dao;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.report.mgt.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.report.mgt.dao.common;version="${io.entgra.device.mgt.core.version.range}", javax.xml.bind;version="[0.0,1)", javax.xml.bind.annotation;version="[0.0,1)", javax.xml.parsers, diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml index 456834371f..493dd39002 100644 --- a/components/analytics-mgt/grafana-mgt/pom.xml +++ b/components/analytics-mgt/grafana-mgt/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core analytics-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 grafana-mgt pom - Entgra - Grafana API Handler Component + Entgra Device Management - Grafana API Handler Component http://entgra.io diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml index 7de259bada..004e13c7c5 100644 --- a/components/analytics-mgt/pom.xml +++ b/components/analytics-mgt/pom.xml @@ -17,18 +17,19 @@ ~ under the License. --> - + - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 analytics-mgt pom - Entgra - Analytics Management Component + Entgra Device Management - Analytics Management Component http://entgra.io diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml index 866cb6ce57..5df5fc5c3b 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml @@ -20,13 +20,13 @@ apimgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT 4.0.0 io.entgra.device.mgt.core.apimgt.analytics.extension bundle - Entgra - API mgt analytics extension + Entgra Device Management - API mgt analytics extension https://entgra.io diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml index fba5591029..2f93aec028 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml @@ -22,15 +22,15 @@ apimgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.annotations bundle - WSO2 Carbon - API Management Annotations - WSO2 Carbon - API Management Custom Annotation Module + Entgra Device Management - API Management Annotations + Entgra Device Management - API Management Custom Annotation Module https://entgra.io diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml index 4be52ce94d..826c889929 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml @@ -21,14 +21,14 @@ apimgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.application.extension.api war - WSO2 Carbon - API Application Management API + Entgra Device Management - API Application Management API This module provides capability to create api manager application. https://entgra.io diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml index fdf9c2dd68..4e86ea95a3 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml @@ -22,14 +22,14 @@ apimgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.application.extension bundle - WSO2 Carbon - API Application Management + Entgra Device Management - API Application Management This module provides capability to create api manager application. https://entgra.io @@ -125,11 +125,11 @@ io.entgra.device.mgt.core.apimgt.application.extension.bean, io.entgra.device.mgt.core.apimgt.application.extension.dto, io.entgra.device.mgt.core.apimgt.application.extension.exception, - io.entgra.device.mgt.core.identity.jwt.client.extension;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension.dto;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension.exception;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension.service;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension.service;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", org.apache.commons.lang;version="[2.6,3)", org.apache.commons.logging;version="[1.2,2)", org.json.simple;version="[1.1,2)", diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java index d3f54d1247..3e612e5838 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -257,14 +257,12 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe MetadataManagementService metadataManagementService = APIApplicationManagerExtensionDataHolder.getInstance().getMetadataManagementService(); metadataManagementService.createMetadata(metaData); return apiApplicationKey; - } catch (MetadataManagementException e) { - String msg = "Error occurred while creating meta data for meta key: " + applicationName; + } catch (MetadataKeyAlreadyExistsException e) { + String msg = "Since meta key:" + applicationName + " already exists, meta data creating process failed."; log.error(msg, e); throw new APIManagerException(msg, e); - } catch (MetadataKeyAlreadyExistsException e) { - String msg = - "Since meta key:" + applicationName + " already exists, meta data creating process " + - "failed."; + } catch (MetadataManagementException e) { + String msg = "Error occurred while creating meta data for meta key: " + applicationName; log.error(msg, e); throw new APIManagerException(msg, e); } catch (BadRequestException e) { diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml index 7f6cf515e0..016f981d93 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml @@ -22,15 +22,15 @@ apimgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.extension.rest.api bundle - Entgra - Device Management Extension for APIM REST API - Entgra - Device Management Extension for APIM REST API + Entgra Device Management - Device Management Extension for APIM REST API + Entgra Device Management - Device Management Extension for APIM REST API https://entgra.io diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml index 14b4f62707..78b0053f8f 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml @@ -21,13 +21,13 @@ apimgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT 4.0.0 io.entgra.device.mgt.core.apimgt.keymgt.extension.api war - WSO2 Carbon - API Key Management API + Entgra Device Management - API Key Management API This module extends the API manager's key management apis. https://entgra.io diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml index 25c942800f..dcd47ba1f7 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml @@ -21,14 +21,14 @@ apimgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.keymgt.extension bundle - WSO2 Carbon - API Key Management + Entgra Device Management - API Key Management This module extends the API manager's key management. https://entgra.io @@ -88,10 +88,10 @@ io.entgra.device.mgt.core.apimgt.keymgt.extension, io.entgra.device.mgt.core.apimgt.keymgt.extension.exception, io.entgra.device.mgt.core.apimgt.keymgt.extension.service, - io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config.keymanager;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config.keymanager;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="${io.entgra.device.mgt.core.version.range}", javax.cache;version="[1.0,2)", javax.net.ssl,okhttp3;version="[4.9,5)", org.apache.commons.lang;version="[2.4,3)", diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index b211a15d26..82a630ed00 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -22,15 +22,15 @@ apimgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.webapp.publisher bundle - WSO2 Carbon - API Management Webapp Publisher - WSO2 Carbon - API Management Webapp Publisher + Entgra Device Management - API Management Webapp Publisher + Entgra Device Management - API Management Webapp Publisher https://entgra.io @@ -174,7 +174,7 @@ com.google.gson;version="[2.9,3)", com.google.gson.reflect;version="[2.9,3)", - io.entgra.device.mgt.core.apimgt.annotations;version="[5.0,6)", + io.entgra.device.mgt.core.apimgt.annotations;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.apimgt.extension.rest.api.*, io.entgra.device.mgt.core.apimgt.webapp.publisher.config, io.entgra.device.mgt.core.apimgt.webapp.publisher.dto, diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java index dcad2fa846..bd3451c4e3 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java @@ -196,10 +196,10 @@ public class APIPublisherStartupHandler implements ServerStartupObserver { APIPublisherDataHolder.getInstance().setPermScopeMapping(permScopeMap); log.info(Constants.PERM_SCOPE_MAPPING_META_KEY + "entry updated successfully"); - } catch (MetadataManagementException e) { - log.error("Error encountered while updating permission scope mapping metadata with default scopes"); } catch (MetadataKeyAlreadyExistsException e) { log.error("Metadata entry already exists for " + Constants.PERM_SCOPE_MAPPING_META_KEY); + } catch (MetadataManagementException e) { + log.error("Error encountered while updating permission scope mapping metadata with default scopes"); } } } diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 6bf36e1e82..3d2c974ad5 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions pom - WSO2 Carbon - API Management Extensions Component + Entgra Device Management - API Management Extensions Component https://entgra.io diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml index 482bc93ae9..6fc308d4b6 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core application-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.application.mgt.common bundle - Entgra - Application Management Common - Entgra - Application Management Common + Entgra Device Management - Application Management Common + Entgra Device Management - Application Management Common https://entgra.io @@ -61,10 +61,10 @@ io.entgra.device.mgt.core.application.mgt.common.exception, io.entgra.device.mgt.core.application.mgt.common.response, io.entgra.device.mgt.core.application.mgt.common.wrapper, - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.common.exception;version="${io.entgra.device.mgt.core.version.range}", io.swagger.annotations;version="[1.6,2)", javax.validation.constraints;version="[2.0,3)", javax.xml.bind.annotation;version="[0.0,1)" diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ReleaseVersionInfo.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ReleaseVersionInfo.java index 218f92187b..e1e7548d68 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ReleaseVersionInfo.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ReleaseVersionInfo.java @@ -22,7 +22,7 @@ package io.entgra.device.mgt.core.application.mgt.common; public class ReleaseVersionInfo { private String version; private String releaseType; - private String rating; + private double rating; private String state; private String uuid; @@ -38,11 +38,11 @@ public class ReleaseVersionInfo { return releaseType; } - public String getRating() { + public double getRating() { return rating; } - public void setRating(String rating) { + public void setRating(double rating) { this.rating = rating; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java index 1e70f1b9d6..fd16e70872 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java @@ -187,11 +187,14 @@ public interface SubscriptionManager { * @param subType subscription type of the application. * @param offsetValue offset value for get paginated request. * @param limitValue limit value for get paginated request. + * @param uninstalled a Boolean flag indicating the filter criteria for retrieve subscription data + * @param searchName an optional search term to filter the results by name. If null or empty, no filtering by name is applied. * @return {@link PaginationResult} pagination result of the category details. * @throws {@link ApplicationManagementException} Exception of the application management */ PaginationResult getAppInstalledSubscribers(int offsetValue, int limitValue, String appUUID, - String subType) throws ApplicationManagementException; + String subType, Boolean uninstalled, String searchName) + throws ApplicationManagementException; /** * This method is responsible to provide application subscription data for given application release UUID. diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml index 171fa4557d..5f663268d1 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core application-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.application.mgt.core bundle - Entgra - Application Management Core - Entgra - Application Management Core + Entgra Device Management - Application Management Core + Entgra Device Management - Application Management Core https://entgra.io @@ -57,16 +57,16 @@ com.dd.plist;version="[1.21,2)", com.google.gson;version="[2.9,3)", com.google.gson.reflect;version="[2.9,3)", - io.entgra.device.mgt.core.apimgt.application.extension;version="[5.0,6)", - io.entgra.device.mgt.core.apimgt.application.extension.dto;version="[5.0,6)", - io.entgra.device.mgt.core.apimgt.application.extension.exception;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.common.config;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.common.dto;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.common.exception;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.common.response;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.common.services;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.common.wrapper;version="[5.0,6)", + io.entgra.device.mgt.core.apimgt.application.extension;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.apimgt.application.extension.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.apimgt.application.extension.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.common.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.common.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.common.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.common.response;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.common.services;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.common.wrapper;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.application.mgt.core.config, io.entgra.device.mgt.core.application.mgt.core.dao, io.entgra.device.mgt.core.application.mgt.core.dao.common, @@ -80,25 +80,25 @@ io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility, io.entgra.device.mgt.core.application.mgt.core.exception, io.entgra.device.mgt.core.application.mgt.core.serviceprovider, - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.app.mgt.android;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.common.exception;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.common.util;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.dto;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.operation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.task.impl;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.util;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension.dto;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension.exception;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.app.mgt.android;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.common.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.common.util;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.operation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.service;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.task.impl;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.util;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension.service;version="${io.entgra.device.mgt.core.version.range}", javax.annotation;version="[1.0,2)", javax.naming, javax.sql, diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java index c35c4a5251..cd1755fc21 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java @@ -198,14 +198,33 @@ public interface SubscriptionDAO { * @param offsetValue offset value for get paginated result * @param limitValue limit value for get paginated result * @param appReleaseId id of the application release. + * @param uninstalled a Boolean flag indicating the filter criteria for getting users: + * - `true` to get only unsubscribed users, + * - `false` to get only subscribed users, + * - `null` to get all users regardless of their unsubscription status. + * @param searchName an optional search term to filter the results by username. * @return subscribedUsers - list of app subscribed users. * @throws {@link ApplicationManagementDAOException} if connections establishment fails. */ List getAppSubscribedUsers(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException; - int getSubscribedUserCount(int appReleaseId, int tenantId) throws ApplicationManagementDAOException; + /** + * This method is used to get the count of users who are subscribed or unsubscribed to a specific application release. + * + * @param appReleaseId the ID of the application release for which the user count is to be retrieved. + * @param tenantId the ID of the current tenant. + * @param uninstalled a Boolean flag indicating the filter criteria for counting users: + * - `true` to count only unsubscribed users, + * - `false` to count only subscribed users, + * - `null` to count all users regardless of their unsubscription status. + * @param searchName an optional search term to filter the results by username. + * @return the count of users based on the specified criteria. + * @throws ApplicationManagementDAOException if an error occurs while establishing a database connection or executing the query. + */ + int getSubscribedUserCount(int appReleaseId, int tenantId, Boolean uninstalled, String searchName) + throws ApplicationManagementDAOException; /** * This method is used to get the details of roles @@ -214,14 +233,34 @@ public interface SubscriptionDAO { * @param offsetValue offset value for get paginated request. * @param limitValue limit value for get paginated request. * @param appReleaseId id of the application release. + * @param uninstalled a Boolean flag indicating the filter criteria for getting roles: + * - `true` to get only unsubscribed roles, + * - `false` to get only subscribed roles, + * - `null` to get all roles regardless of their unsubscription status. + * @param searchName an optional search term to filter the results by role name. * @return subscribedRoles - list of app subscribed roles. * @throws {@link ApplicationManagementDAOException} if connections establishment fails. */ List getAppSubscribedRoles(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException; - int getSubscribedRoleCount(int appReleaseId, int tenantId) throws ApplicationManagementDAOException; + /** + * This method retrieves the count of roles subscribed to a given application release. + * The count can be filtered based on the unsubscription status. + * + * @param appReleaseId the ID of the application release for which the subscribed roles are counted. + * @param tenantId the ID of the current tenant. + * @param uninstalled a Boolean flag indicating the filter criteria for counting roles: + * - `true` to count only unsubscribed roles, + * - `false` to count only subscribed roles, + * - `null` to count all roles regardless of their unsubscription status. + * @param searchName an optional search term to filter the results by role name. + * @return the count of roles that match the specified criteria. + * @throws ApplicationManagementDAOException if there is an error while accessing the database or processing the request. + */ + int getSubscribedRoleCount(int appReleaseId, int tenantId, Boolean uninstalled, String searchName) + throws ApplicationManagementDAOException; /** * This method is used to get the details of subscribed groups @@ -230,13 +269,33 @@ public interface SubscriptionDAO { * @param offsetValue offset value for get paginated request. * @param limitValue limit value for get paginated request. * @param appReleaseId id of the application release. + * @param uninstalled a Boolean flag indicating the filter criteria for getting groups: + * - `true` to get only unsubscribed groups, + * - `false` to get only subscribed groups, + * - `null` to get all groups regardless of their unsubscription status. + * @param searchName an optional search term to filter the results by group name. * @return subscribedGroups - list of app subscribed groups. * @throws {@link ApplicationManagementDAOException} if connections establishment fails. */ - List getAppSubscribedGroups(int offsetValue, int limitValue, int appReleaseId, int tenantId) + List getAppSubscribedGroups(int offsetValue, int limitValue, int appReleaseId, int tenantId, + Boolean uninstalled, String searchName) throws ApplicationManagementDAOException; - int getSubscribedGroupCount(int appReleaseId, int tenantId) throws ApplicationManagementDAOException; + /** + * This method is used to get the count of subscribed groups + * + * @param tenantId id of the current tenant + * @param appReleaseId id of the application release. + * @param uninstalled a Boolean flag indicating the filter criteria for counting groups: + * - `true` to count only unsubscribed groups, + * - `false` to count only subscribed groups, + * - `null` to count all groups regardless of their unsubscription status. + * @param searchName an optional search term to filter the results by group name. + * @return subscribedGroups - list of app subscribed groups. + * @throws {@link ApplicationManagementDAOException} if connections establishment fails. + */ + int getSubscribedGroupCount(int appReleaseId, int tenantId,Boolean uninstalled, String searchName) + throws ApplicationManagementDAOException; /** * This method is used to get the details of subscribed groups diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index b327d9803d..c99a06eeb4 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -2075,7 +2075,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic releaseVersionInfo = new ReleaseVersionInfo(); releaseVersionInfo.setVersion(resultSet.getString("VERSION")); releaseVersionInfo.setReleaseType(resultSet.getString("RELEASE_TYPE")); - releaseVersionInfo.setRating(resultSet.getString("RATING")); + releaseVersionInfo.setRating(resultSet.getDouble("RATING")); releaseVersionInfo.setState(resultSet.getString("CURRENT_STATE")); releaseVersionInfo.setUuid(resultSet.getString("UUID")); releaseVersionInfos.add(releaseVersionInfo); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java index 66aec68576..a5701cfdfb 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java @@ -967,25 +967,37 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc @Override public List getAppSubscribedUsers(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed users for " + - "given app release id."); + log.debug("Request received in DAO Layer to get subscribed/unsubscribed users for the given app release ID."); } try { Connection conn = this.getDBConnection(); List subscribedUsers = new ArrayList<>(); - String sql = "SELECT " - + "US.USER_NAME AS USER_NAME " - + "FROM AP_USER_SUBSCRIPTION US " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? LIMIT ? OFFSET ?"; + String sql = "SELECT US.USER_NAME AS USER_NAME " + + "FROM AP_USER_SUBSCRIPTION US " + + "WHERE AP_APP_RELEASE_ID = ? " + + "AND TENANT_ID = ? "; + if (uninstalled != null) { + sql += "AND UNSUBSCRIBED = ? "; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += "AND US.USER_NAME LIKE ? "; + } + sql += "LIMIT ? OFFSET ?"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, appReleaseId); - stmt.setInt(2, tenantId); - stmt.setInt(3, limitValue); - stmt.setInt(4, offsetValue); + int index = 1; + stmt.setInt(index++, appReleaseId); + stmt.setInt(index++, tenantId); + if (uninstalled != null) { + stmt.setBoolean(index++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + stmt.setString(index++, "%" + searchName + "%"); + } + stmt.setInt(index++, limitValue); + stmt.setInt(index, offsetValue); try (ResultSet rs = stmt.executeQuery()) { while (rs.next()) { subscribedUsers.add(rs.getString("USER_NAME")); @@ -994,50 +1006,62 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc return subscribedUsers; } } catch (DBConnectionException e) { - String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed users for given app release id."; + String msg = "Error occurred while obtaining the DB connection to get subscribed/unsubscribed users for the " + + "given app release ID."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed users for given app release id."; + String msg = "SQL Error occurred while getting subscribed/unsubscribed users for the given app release ID."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } } @Override - public int getSubscribedUserCount(int appReleaseId, int tenantId) + public int getSubscribedUserCount(int appReleaseId, int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed users for " + + log.debug("Request received in DAO Layer to get already subscribed/unsubscribed users for " + "given app release id."); } try { Connection conn = this.getDBConnection(); - String sql = "SELECT " - + "COUNT(US.USER_NAME) AS USER_NAME " - + "FROM AP_USER_SUBSCRIPTION US " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ?"; + String sql = "SELECT COUNT(US.USER_NAME) AS USER_COUNT " + + "FROM AP_USER_SUBSCRIPTION US " + + "WHERE AP_APP_RELEASE_ID = ? " + + "AND TENANT_ID = ?"; + if (uninstalled != null) { + sql += " AND UNSUBSCRIBED = ?"; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += " AND US.USER_NAME LIKE ?"; + } try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, appReleaseId); - stmt.setInt(2, tenantId); + int index = 1; + stmt.setInt(index++, appReleaseId); + stmt.setInt(index++, tenantId); + if (uninstalled != null) { + stmt.setBoolean(index++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + stmt.setString(index++, "%" + searchName + "%"); + } try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { - return rs.getInt("USER_NAME"); + return rs.getInt("USER_COUNT"); } } return 0; } } catch (DBConnectionException e) { String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed users count for given app release id."; + "subscribed/unsubscribed users count for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed users for given app release id."; + String msg = "SQL Error occurred while getting subscribed/unsubscribed users count for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } @@ -1151,25 +1175,40 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc @Override public List getAppSubscribedRoles(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed roles for " + + log.debug("Request received in DAO Layer to get already subscribed/unsubscribed roles for " + "given app release id."); } try { Connection conn = this.getDBConnection(); List subscribedRoles = new ArrayList<>(); String sql = "SELECT " - + "RS.ROLE_NAME AS ROLE " - + "FROM AP_ROLE_SUBSCRIPTION RS " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? LIMIT ? OFFSET ?"; + + "RS.ROLE_NAME AS ROLE " + + "FROM AP_ROLE_SUBSCRIPTION RS " + + "WHERE AP_APP_RELEASE_ID = ? " + + "AND TENANT_ID = ?"; + if (uninstalled != null) { + sql += " AND UNSUBSCRIBED = ?"; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += " AND RS.ROLE_NAME LIKE ?"; + } + sql += " LIMIT ? OFFSET ?"; try (PreparedStatement ps = conn.prepareStatement(sql)) { - ps.setInt(1, appReleaseId); - ps.setInt(2, tenantId); - ps.setInt(3, limitValue); - ps.setInt(4, offsetValue); + int paramIndex = 1; + ps.setInt(paramIndex++, appReleaseId); + ps.setInt(paramIndex++, tenantId); + + if (uninstalled != null) { + ps.setBoolean(paramIndex++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + ps.setString(paramIndex++, "%" + searchName + "%"); + } + ps.setInt(paramIndex++, limitValue); + ps.setInt(paramIndex, offsetValue); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { subscribedRoles.add(rs.getString("ROLE")); @@ -1179,49 +1218,61 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } } catch (DBConnectionException e) { String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed roles for given app release id."; + "subscribed/unsubscribed roles for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed roles for given app release id."; + String msg = "SQL Error occurred while getting subscribed/unsubscribed roles for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } } @Override - public int getSubscribedRoleCount(int appReleaseId, int tenantId) + public int getSubscribedRoleCount(int appReleaseId, int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed roles for " + + log.debug("Request received in DAO Layer to get already subscribed/unsubscribed roles for " + "given app release id."); } try { Connection conn = this.getDBConnection(); String sql = "SELECT " - + "COUNT(RS.ROLE_NAME) AS ROLE_NAME " - + "FROM AP_ROLE_SUBSCRIPTION RS " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ?"; + + "COUNT(RS.ROLE_NAME) AS ROLE_COUNT " + + "FROM AP_ROLE_SUBSCRIPTION RS " + + "WHERE AP_APP_RELEASE_ID = ? " + + "AND TENANT_ID = ?"; + if (uninstalled != null) { + sql += " AND UNSUBSCRIBED = ?"; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += " AND RS.ROLE_NAME LIKE ?"; + } try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, appReleaseId); - stmt.setInt(2, tenantId); - + int paramIndex = 1; + stmt.setInt(paramIndex++, appReleaseId); + stmt.setInt(paramIndex++, tenantId); + if (uninstalled != null) { + stmt.setBoolean(paramIndex++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + stmt.setString(paramIndex++, "%" + searchName + "%"); + } try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { - return rs.getInt("ROLE_NAME"); + return rs.getInt("ROLE_COUNT"); } + return 0; } - return 0; } } catch (DBConnectionException e) { String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed roles count for given app release id."; + "subscribed/unsubscribed roles count for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed roles for given app release id."; + String msg = "SQL Error occurred while getting subscribed/unsubscribed roles count for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } @@ -1269,25 +1320,37 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc @Override public List getAppSubscribedGroups(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed groups for " + + log.debug("Request received in DAO Layer to get already subscribed/unsubscribed groups for " + "given app release id."); } try { Connection conn = this.getDBConnection(); List subscribedGroups = new ArrayList<>(); - String sql = "SELECT " - + "GS.GROUP_NAME AS APP_GROUPS " - + "FROM AP_GROUP_SUBSCRIPTION GS " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? LIMIT ? OFFSET ?"; + String sql = "SELECT GS.GROUP_NAME AS APP_GROUPS " + + "FROM AP_GROUP_SUBSCRIPTION GS " + + "WHERE AP_APP_RELEASE_ID = ? AND TENANT_ID = ?"; + if (uninstalled != null) { + sql += " AND UNSUBSCRIBED = ?"; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += " AND GS.GROUP_NAME LIKE ?"; + } + sql += " LIMIT ? OFFSET ?"; try (PreparedStatement ps = conn.prepareStatement(sql)) { - ps.setInt(1, appReleaseId); - ps.setInt(2, tenantId); - ps.setInt(3, limitValue); - ps.setInt(4, offsetValue); + int paramIndex = 1; + ps.setInt(paramIndex++, appReleaseId); + ps.setInt(paramIndex++, tenantId); + if (uninstalled != null) { + ps.setBoolean(paramIndex++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + ps.setString(paramIndex++, "%" + searchName + "%"); + } + ps.setInt(paramIndex++, limitValue); + ps.setInt(paramIndex, offsetValue); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { subscribedGroups.add(rs.getString("APP_GROUPS")); @@ -1297,11 +1360,11 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } } catch (DBConnectionException e) { String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed groups for given app release id."; + "subscribed/unsubscribed groups for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed groups for given " + + String msg = "SQL Error occurred while getting subscribed/unsubscribed groups for given " + "app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); @@ -1309,24 +1372,34 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } @Override - public int getSubscribedGroupCount(int appReleaseId, int tenantId) + public int getSubscribedGroupCount(int appReleaseId, int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed groups for " + - "given app release id."); + log.debug("Request received in DAO Layer to get the count of subscribed/unsubscribed groups for " + + "given app release id."); } try { Connection conn = this.getDBConnection(); - String sql = "SELECT " - + "COUNT(GS.GROUP_NAME) AS APP_GROUPS_COUNT " - + "FROM AP_GROUP_SUBSCRIPTION GS " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ?"; + String sql = "SELECT COUNT(GS.GROUP_NAME) AS APP_GROUPS_COUNT " + + "FROM AP_GROUP_SUBSCRIPTION GS " + + "WHERE AP_APP_RELEASE_ID = ? AND TENANT_ID = ?"; + if (uninstalled != null) { + sql += " AND UNSUBSCRIBED = ?"; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += " AND GS.GROUP_NAME LIKE ?"; + } try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, appReleaseId); - stmt.setInt(2, tenantId); - + int paramIndex = 1; + stmt.setInt(paramIndex++, appReleaseId); + stmt.setInt(paramIndex++, tenantId); + if (uninstalled != null) { + stmt.setBoolean(paramIndex++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + stmt.setString(paramIndex++, "%" + searchName + "%"); + } try (ResultSet rs = stmt.executeQuery()) { if (rs.next()) { return rs.getInt("APP_GROUPS_COUNT"); @@ -1335,12 +1408,13 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc return 0; } } catch (DBConnectionException e) { - String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed groups count for given app release id."; + String msg = "Error occurred while obtaining the DB connection to get the count of " + + "subscribed/unsubscribed groups for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed groups for given app release id."; + String msg = "SQL Error occurred while getting the count of subscribed/unsubscribed groups for given " + + "app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/OracleSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/OracleSubscriptionDAOImpl.java index f66051e308..a074672a55 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/OracleSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/OracleSubscriptionDAOImpl.java @@ -43,10 +43,10 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { @Override public List getAppSubscribedUsers(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed users for " + + log.debug("Request received in DAO Layer to get already subscribed/unsubscribed users for " + "given app release id."); } try { @@ -55,13 +55,28 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { String sql = "SELECT " + "US.USER_NAME AS USER " + "FROM AP_USER_SUBSCRIPTION US " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY US.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + + "WHERE AP_APP_RELEASE_ID = ? " + + "AND TENANT_ID = ? "; + if (uninstalled != null) { + sql += "AND UNSUBSCRIBED = ? "; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += "AND US.USER_NAME LIKE ? "; + } + sql += "ORDER BY US.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, appReleaseId); - stmt.setInt(2, tenantId); - stmt.setInt(3, offsetValue); - stmt.setInt(4, limitValue); + int index = 1; + stmt.setInt(index++, appReleaseId); + stmt.setInt(index++, tenantId); + if (uninstalled != null) { + stmt.setBoolean(index++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + stmt.setString(index++, "%" + searchName + "%"); + } + stmt.setInt(index++, offsetValue); + stmt.setInt(index, limitValue); + try (ResultSet rs = stmt.executeQuery()) { while (rs.next()) { subscribedUsers.add(rs.getString("USER")); @@ -71,11 +86,11 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { } } catch (DBConnectionException e) { String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed users for given app release id."; + "subscribed/unsubscribed users for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed users for given app release id."; + String msg = "SQL Error occurred while getting subscribed/unsubscribed users for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } @@ -83,10 +98,10 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { @Override public List getAppSubscribedRoles(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed roles for " + + log.debug("Request received in DAO Layer to get already subscribed/unsubscribed roles for " + "given app release id."); } try { @@ -95,13 +110,27 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { String sql = "SELECT " + "RS.ROLE_NAME AS ROLE " + "FROM AP_ROLE_SUBSCRIPTION RS " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY RS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + + "WHERE AP_APP_RELEASE_ID = ? " + + "AND TENANT_ID = ? "; + if (uninstalled != null) { + sql += "AND UNSUBSCRIBED = ? "; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += "AND RS.ROLE_NAME LIKE ? "; + } + sql += "ORDER BY RS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; try (PreparedStatement ps = conn.prepareStatement(sql)) { - ps.setInt(1, appReleaseId); - ps.setInt(2, tenantId); - ps.setInt(3, offsetValue); - ps.setInt(4, limitValue); + int paramIndex = 1; + ps.setInt(paramIndex++, appReleaseId); + ps.setInt(paramIndex++, tenantId); + if (uninstalled != null) { + ps.setBoolean(paramIndex++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + ps.setString(paramIndex++, "%" + searchName + "%"); + } + ps.setInt(paramIndex++, offsetValue); + ps.setInt(paramIndex, limitValue); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { subscribedRoles.add(rs.getString("ROLE")); @@ -111,11 +140,11 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { } } catch (DBConnectionException e) { String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed roles for given app release id."; + "subscribed/unsubscribed roles for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed roles for given app release id."; + String msg = "SQL Error occurred while getting subscribed/unsubscribed roles for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } @@ -123,11 +152,10 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { @Override public List getAppSubscribedGroups(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed groups for " + - "given app release id."); + log.debug("Request received in DAO Layer to get subscribed/unsubscribed groups for the given app release ID."); } try { Connection conn = this.getDBConnection(); @@ -135,13 +163,26 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { String sql = "SELECT " + "GS.GROUP_NAME AS GROUPS " + "FROM AP_GROUP_SUBSCRIPTION GS " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY GS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + + "WHERE AP_APP_RELEASE_ID = ? AND TENANT_ID = ?"; + if (uninstalled != null) { + sql += " AND UNSUBSCRIBED = ?"; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += " AND GS.GROUP_NAME LIKE ?"; + } + sql += " ORDER BY GS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; try (PreparedStatement ps = conn.prepareStatement(sql)) { - ps.setInt(1, appReleaseId); - ps.setInt(2, tenantId); - ps.setInt(3, offsetValue); - ps.setInt(4, limitValue); + int paramIndex = 1; + ps.setInt(paramIndex++, appReleaseId); + ps.setInt(paramIndex++, tenantId); + if (uninstalled != null) { + ps.setBoolean(paramIndex++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + ps.setString(paramIndex++, "%" + searchName + "%"); + } + ps.setInt(paramIndex++, offsetValue); + ps.setInt(paramIndex, limitValue); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { subscribedGroups.add(rs.getString("GROUPS")); @@ -150,13 +191,12 @@ public class OracleSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { return subscribedGroups; } } catch (DBConnectionException e) { - String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed groups for given app release id."; + String msg = "Error occurred while obtaining the DB connection to get subscribed/unsubscribed groups" + + " for the given app release ID."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed groups for given " + - "app release id."; + String msg = "SQL Error occurred while getting subscribed/unsubscribed groups for the given app release ID."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/SQLServerSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/SQLServerSubscriptionDAOImpl.java index f715a244c5..622ce0c399 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/SQLServerSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/SQLServerSubscriptionDAOImpl.java @@ -39,10 +39,10 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { @Override public List getAppSubscribedUsers(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed users for " + + log.debug("Request received in DAO Layer to get already subscribed/unsubscribed users for " + "given app release id."); } try { @@ -51,13 +51,28 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { String sql = "SELECT " + "US.USER_NAME AS USER_NAME " + "FROM AP_USER_SUBSCRIPTION US " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY US.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + + "WHERE AP_APP_RELEASE_ID = ? " + + "AND TENANT_ID = ? "; + if (uninstalled != null) { + sql += "AND UNSUBSCRIBED = ? "; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += "AND US.USER_NAME LIKE ? "; + } + sql += "ORDER BY US.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, appReleaseId); - stmt.setInt(2, tenantId); - stmt.setInt(3, offsetValue); - stmt.setInt(4, limitValue); + int index = 1; + stmt.setInt(index++, appReleaseId); + stmt.setInt(index++, tenantId); + if (uninstalled != null) { + stmt.setBoolean(index++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + stmt.setString(index++, "%" + searchName + "%"); + } + stmt.setInt(index++, offsetValue); + stmt.setInt(index, limitValue); + try (ResultSet rs = stmt.executeQuery()) { while (rs.next()) { subscribedUsers.add(rs.getString("USER_NAME")); @@ -67,11 +82,11 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { } } catch (DBConnectionException e) { String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed users for given app release id."; + "subscribed/unsubscribed users for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed users for given app release id."; + String msg = "SQL Error occurred while getting subscribed/unsubscribed users for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } @@ -79,10 +94,10 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { @Override public List getAppSubscribedRoles(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed roles for " + + log.debug("Request received in DAO Layer to get already subscribed/unsubscribed roles for " + "given app release id."); } try { @@ -91,13 +106,29 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { String sql = "SELECT " + "RS.ROLE_NAME AS ROLE " + "FROM AP_ROLE_SUBSCRIPTION RS " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY RS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + + "WHERE AP_APP_RELEASE_ID = ? " + + "AND TENANT_ID = ? "; + if (uninstalled != null) { + sql += "AND UNSUBSCRIBED = ? "; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += "AND RS.ROLE_NAME LIKE ? "; + } + sql += "ORDER BY RS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + try (PreparedStatement ps = conn.prepareStatement(sql)) { - ps.setInt(1, appReleaseId); - ps.setInt(2, tenantId); - ps.setInt(3, offsetValue); - ps.setInt(4, limitValue); + int paramIndex = 1; + ps.setInt(paramIndex++, appReleaseId); + ps.setInt(paramIndex++, tenantId); + if (uninstalled != null) { + ps.setBoolean(paramIndex++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + ps.setString(paramIndex++, "%" + searchName + "%"); + } + ps.setInt(paramIndex++, offsetValue); + ps.setInt(paramIndex, limitValue); + try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { subscribedRoles.add(rs.getString("ROLE")); @@ -107,11 +138,11 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { } } catch (DBConnectionException e) { String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed roles for given app release id."; + "subscribed/unsubscribed roles for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed roles for given app release id."; + String msg = "SQL Error occurred while getting subscribed/unsubscribed roles for given app release id."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } @@ -119,11 +150,10 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { @Override public List getAppSubscribedGroups(int offsetValue, int limitValue, int appReleaseId, - int tenantId) + int tenantId, Boolean uninstalled, String searchName) throws ApplicationManagementDAOException { if (log.isDebugEnabled()) { - log.debug("Request received in DAO Layer to get already subscribed groups for " + - "given app release id."); + log.debug("Request received in DAO Layer to get subscribed/unsubscribed groups for the given app release ID."); } try { Connection conn = this.getDBConnection(); @@ -131,13 +161,26 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { String sql = "SELECT " + "GS.GROUP_NAME AS GROUPS " + "FROM AP_GROUP_SUBSCRIPTION GS " - + "WHERE " - + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY GS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + + "WHERE AP_APP_RELEASE_ID = ? AND TENANT_ID = ?"; + if (uninstalled != null) { + sql += " AND UNSUBSCRIBED = ?"; + } + if (searchName != null && !searchName.trim().isEmpty()) { + sql += " AND GS.GROUP_NAME LIKE ?"; + } + sql += " ORDER BY GS.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; try (PreparedStatement ps = conn.prepareStatement(sql)) { - ps.setInt(1, appReleaseId); - ps.setInt(2, tenantId); - ps.setInt(3, offsetValue); - ps.setInt(4, limitValue); + int paramIndex = 1; + ps.setInt(paramIndex++, appReleaseId); + ps.setInt(paramIndex++, tenantId); + if (uninstalled != null) { + ps.setBoolean(paramIndex++, uninstalled); + } + if (searchName != null && !searchName.trim().isEmpty()) { + ps.setString(paramIndex++, "%" + searchName + "%"); + } + ps.setInt(paramIndex++, offsetValue); + ps.setInt(paramIndex, limitValue); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { subscribedGroups.add(rs.getString("GROUPS")); @@ -146,13 +189,11 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { return subscribedGroups; } } catch (DBConnectionException e) { - String msg = "Error occurred while obtaining the DB connection to get already " + - "subscribed groups for given app release id."; + String msg = "Error occurred while obtaining the DB connection to get subscribed/unsubscribed groups for the given app release ID."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } catch (SQLException e) { - String msg = "SQL Error occurred while getting subscribed groups for given " + - "app release id."; + String msg = "SQL Error occurred while getting subscribed/unsubscribed groups for the given app release ID."; log.error(msg, e); throw new ApplicationManagementDAOException(msg, e); } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java index 0c5b4057ff..92f0734c9f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -1498,7 +1498,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { } @Override - public PaginationResult getAppInstalledSubscribers(int offsetValue, int limitValue, String appUUID, String subType) + public PaginationResult getAppInstalledSubscribers(int offsetValue, int limitValue, String appUUID, String subType, + Boolean uninstalled, String searchName) throws ApplicationManagementException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); @@ -1513,20 +1514,16 @@ public class SubscriptionManagerImpl implements SubscriptionManager { if (SubscriptionType.USER.toString().equalsIgnoreCase(subType)) { subscriptionList = subscriptionDAO - .getAppSubscribedUsers(offsetValue, limitValue, applicationReleaseId, tenantId); - count = subscriptionDAO.getSubscribedUserCount(applicationReleaseId, tenantId); - } else { - if (SubscriptionType.ROLE.toString().equalsIgnoreCase(subType)) { - subscriptionList = subscriptionDAO - .getAppSubscribedRoles(offsetValue, limitValue, applicationReleaseId, tenantId); - count = subscriptionDAO.getSubscribedRoleCount(applicationReleaseId, tenantId); - } else { - if (SubscriptionType.GROUP.toString().equalsIgnoreCase(subType)) { - subscriptionList = subscriptionDAO - .getAppSubscribedGroups(offsetValue, limitValue, applicationReleaseId, tenantId); - count = subscriptionDAO.getSubscribedGroupCount(applicationReleaseId, tenantId); - } - } + .getAppSubscribedUsers(offsetValue, limitValue, applicationReleaseId, tenantId, uninstalled, searchName); + count = subscriptionDAO.getSubscribedUserCount(applicationReleaseId, tenantId, uninstalled, searchName); + } else if (SubscriptionType.ROLE.toString().equalsIgnoreCase(subType)) { + subscriptionList = subscriptionDAO + .getAppSubscribedRoles(offsetValue, limitValue, applicationReleaseId, tenantId, uninstalled, searchName); + count = subscriptionDAO.getSubscribedRoleCount(applicationReleaseId, tenantId, uninstalled, searchName); + } else if (SubscriptionType.GROUP.toString().equalsIgnoreCase(subType)) { + subscriptionList = subscriptionDAO + .getAppSubscribedGroups(offsetValue, limitValue, applicationReleaseId, tenantId, uninstalled, searchName); + count = subscriptionDAO.getSubscribedGroupCount(applicationReleaseId, tenantId, uninstalled, searchName); } paginationResult.setData(subscriptionList); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java index 4a0687052a..2ac54352fe 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java @@ -48,6 +48,8 @@ import org.apache.commons.validator.routines.UrlValidator; import org.wso2.carbon.context.PrivilegedCarbonContext; import javax.ws.rs.core.Response; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -503,31 +505,29 @@ public class APIUtil { applicationRelease.setSupportedOsVersions(applicationReleaseDTO.getSupportedOsVersions()); applicationRelease.setRating(applicationReleaseDTO.getRating()); applicationRelease.setIconPath( - basePath + Constants.ICON_ARTIFACT + Constants.FORWARD_SLASH + applicationReleaseDTO.getIconName()); - - if (!StringUtils.isEmpty(applicationReleaseDTO.getBannerName())){ + basePath + Constants.ICON_ARTIFACT + Constants.FILE_NAME_PARAM + + URLEncoder.encode(applicationReleaseDTO.getIconName(), StandardCharsets.UTF_8)); + if (!StringUtils.isEmpty(applicationReleaseDTO.getBannerName())) { applicationRelease.setBannerPath( - basePath + Constants.BANNER_ARTIFACT + Constants.FORWARD_SLASH + applicationReleaseDTO - .getBannerName()); + basePath + Constants.BANNER_ARTIFACT + Constants.FILE_NAME_PARAM + + URLEncoder.encode(applicationReleaseDTO.getBannerName(), StandardCharsets.UTF_8)); } - - applicationRelease.setInstallerPath(constructInstallerPath(applicationReleaseDTO.getInstallerName(), - applicationReleaseDTO.getAppHashValue())); - + applicationRelease.setInstallerPath( + constructInstallerPath(applicationReleaseDTO.getInstallerName(), applicationReleaseDTO.getAppHashValue())); if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName1())) { - screenshotPaths - .add(basePath + Constants.SCREENSHOT_ARTIFACT + 1 + Constants.FORWARD_SLASH + applicationReleaseDTO - .getScreenshotName1()); + screenshotPaths.add( + basePath + Constants.SCREENSHOT_ARTIFACT + 1 + Constants.FILE_NAME_PARAM + + URLEncoder.encode(applicationReleaseDTO.getScreenshotName1(), StandardCharsets.UTF_8)); } if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName2())) { - screenshotPaths - .add(basePath + Constants.SCREENSHOT_ARTIFACT + 2 + Constants.FORWARD_SLASH + applicationReleaseDTO - .getScreenshotName2()); + screenshotPaths.add( + basePath + Constants.SCREENSHOT_ARTIFACT + 2 + Constants.FILE_NAME_PARAM + + URLEncoder.encode(applicationReleaseDTO.getScreenshotName2(), StandardCharsets.UTF_8)); } if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName3())) { - screenshotPaths - .add(basePath + Constants.SCREENSHOT_ARTIFACT + 3 + Constants.FORWARD_SLASH + applicationReleaseDTO - .getScreenshotName3()); + screenshotPaths.add( + basePath + Constants.SCREENSHOT_ARTIFACT + 3 + Constants.FILE_NAME_PARAM + + URLEncoder.encode(applicationReleaseDTO.getScreenshotName3(), StandardCharsets.UTF_8)); } applicationRelease.setScreenshots(screenshotPaths); return applicationRelease; @@ -543,9 +543,12 @@ public class APIUtil { public static String constructInstallerPath(String installerName, String appHash) throws ApplicationManagementException { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); UrlValidator urlValidator = new UrlValidator(); - String basePath = getArtifactDownloadBaseURL() + tenantId + Constants.FORWARD_SLASH + appHash + Constants.FORWARD_SLASH; - return urlValidator.isValid(installerName) ? installerName - : basePath + Constants.APP_ARTIFACT + Constants.FORWARD_SLASH + installerName; + String basePath = getArtifactDownloadBaseURL() + tenantId + Constants.FORWARD_SLASH + + appHash + Constants.FORWARD_SLASH; + return urlValidator.isValid(installerName) + ? installerName + : basePath + Constants.APP_ARTIFACT + Constants.FILE_NAME_PARAM + + URLEncoder.encode(installerName, StandardCharsets.UTF_8); } public static String getArtifactDownloadBaseURL() throws ApplicationManagementException { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java index 81e5bef788..57ed6b7189 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java @@ -140,6 +140,11 @@ public class Constants { public static final String DB_TYPE_POSTGRESQL = "PostgreSQL"; } + /** + * Query parameter for specifying the filename in the App artifact URL. + */ + public static final String FILE_NAME_PARAM = "?fileName="; + /** * Directory name of the icon artifact that are saved in the file system. */ diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/GroupBasedSubscriptionManagementHelperServiceImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/GroupBasedSubscriptionManagementHelperServiceImpl.java index 16834bf2a1..9b357a0a69 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/GroupBasedSubscriptionManagementHelperServiceImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/GroupBasedSubscriptionManagementHelperServiceImpl.java @@ -39,6 +39,7 @@ import io.entgra.device.mgt.core.application.mgt.core.util.HelperUtil; import io.entgra.device.mgt.core.application.mgt.core.util.subscription.mgt.SubscriptionManagementHelperUtil; import io.entgra.device.mgt.core.application.mgt.core.util.subscription.mgt.service.SubscriptionManagementHelperService; import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; import io.entgra.device.mgt.core.device.mgt.core.dto.GroupDetailsDTO; @@ -48,6 +49,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -119,13 +121,12 @@ public class GroupBasedSubscriptionManagementHelperServiceImpl implements Subscr } else { groupDetailsDTO = groupManagementProviderService.getGroupDetailsWithDevices(subscriptionInfo.getIdentifier(), applicationDTO.getDeviceTypeId(), deviceSubscriptionFilterCriteria.getOwner(), deviceSubscriptionFilterCriteria.getName(), - deviceSubscriptionFilterCriteria.getDeviceStatus(), offset, limit); - List paginatedDeviceIdsOwnByGroup = groupDetailsDTO.getDeviceIds(); + deviceSubscriptionFilterCriteria.getDeviceStatus(), -1, -1); + List nonPaginatedDeviceIdsOwnByGroup = groupDetailsDTO.getDeviceIds(); deviceSubscriptionDTOS = subscriptionDAO.getSubscriptionDetailsByDeviceIds(applicationReleaseDTO.getId(), - isUnsubscribe, tenantId, paginatedDeviceIdsOwnByGroup, dbSubscriptionStatus, + isUnsubscribe, tenantId, nonPaginatedDeviceIdsOwnByGroup, dbSubscriptionStatus, null, deviceSubscriptionFilterCriteria.getTriggeredBy(), -1, -1); - } deviceCount = SubscriptionManagementHelperUtil.getTotalDeviceSubscriptionCount(deviceSubscriptionDTOS, subscriptionInfo.getDeviceSubscriptionFilterCriteria(), applicationDTO.getDeviceTypeId()); @@ -146,7 +147,6 @@ public class GroupBasedSubscriptionManagementHelperServiceImpl implements Subscr } finally { ConnectionManagerUtil.closeDBConnection(); } - } @Override @@ -193,12 +193,14 @@ public class GroupBasedSubscriptionManagementHelperServiceImpl implements Subscr log.error(msg); throw new NotFoundException(msg); } - List devices = HelperUtil.getGroupManagementProviderService(). - getAllDevicesOfGroup(subscriptionInfo.getIdentifier(), false); + List deviceStatuses = Arrays.asList(EnrolmentInfo.Status.ACTIVE.name(), + EnrolmentInfo.Status.INACTIVE.name(), EnrolmentInfo.Status.UNREACHABLE.name()); + List devices = HelperUtil.getGroupManagementProviderService().getAllDevicesOfGroup(subscriptionInfo.getIdentifier(), deviceStatuses, false); List deviceIdsOwnByGroup = devices.stream().map(Device::getId).collect(Collectors.toList()); - SubscriptionStatisticDTO subscriptionStatisticDTO = subscriptionDAO. - getSubscriptionStatistic(deviceIdsOwnByGroup, isUnsubscribe, tenantId, applicationReleaseDTO.getId()); - int allDeviceCount = HelperUtil.getGroupManagementProviderService().getDeviceCount(subscriptionInfo.getIdentifier()); + SubscriptionStatisticDTO subscriptionStatisticDTO = subscriptionDAO.getSubscriptionStatistic + (deviceIdsOwnByGroup, isUnsubscribe, tenantId, applicationReleaseDTO.getId()); + int allDeviceCount = HelperUtil.getGroupManagementProviderService().getDeviceCountWithGroup(subscriptionInfo.getIdentifier(), + applicationDAO.getApplication(applicationReleaseDTO.getUuid(), tenantId).getDeviceTypeId()); return SubscriptionManagementHelperUtil.getSubscriptionStatistics(subscriptionStatisticDTO, allDeviceCount); } catch (ApplicationManagementDAOException e) { String msg = "Error encountered while getting subscription statistics for group: " + subscriptionInfo.getIdentifier(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/RoleBasedSubscriptionManagementHelperServiceImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/RoleBasedSubscriptionManagementHelperServiceImpl.java index b667198fd5..c78c27d261 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/RoleBasedSubscriptionManagementHelperServiceImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/RoleBasedSubscriptionManagementHelperServiceImpl.java @@ -40,6 +40,7 @@ import io.entgra.device.mgt.core.application.mgt.core.util.HelperUtil; import io.entgra.device.mgt.core.application.mgt.core.util.subscription.mgt.SubscriptionManagementHelperUtil; import io.entgra.device.mgt.core.application.mgt.core.util.subscription.mgt.service.SubscriptionManagementHelperService; import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -210,7 +211,8 @@ public class RoleBasedSubscriptionManagementHelperServiceImpl implements Subscri for (String user : usersWithRole) { PaginationRequest paginationRequest = new PaginationRequest(-1, -1); paginationRequest.setOwner(user); - paginationRequest.setStatusList(Arrays.asList("ACTIVE", "INACTIVE", "UNREACHABLE")); + paginationRequest.setStatusList(Arrays.asList(EnrolmentInfo.Status.ACTIVE.name(), + EnrolmentInfo.Status.INACTIVE.name(),EnrolmentInfo.Status.UNREACHABLE.name())); PaginationResult ownDeviceIds = HelperUtil.getDeviceManagementProviderService(). getAllDevicesIdList(paginationRequest); if (ownDeviceIds.getData() != null) { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/UserBasedSubscriptionManagementHelperServiceImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/UserBasedSubscriptionManagementHelperServiceImpl.java index b8978b1c7a..9b51d51ecd 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/UserBasedSubscriptionManagementHelperServiceImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/UserBasedSubscriptionManagementHelperServiceImpl.java @@ -39,6 +39,7 @@ import io.entgra.device.mgt.core.application.mgt.core.util.HelperUtil; import io.entgra.device.mgt.core.application.mgt.core.util.subscription.mgt.SubscriptionManagementHelperUtil; import io.entgra.device.mgt.core.application.mgt.core.util.subscription.mgt.service.SubscriptionManagementHelperService; import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -196,7 +197,8 @@ public class UserBasedSubscriptionManagementHelperServiceImpl implements Subscri List deviceListOwnByUser = new ArrayList<>(); PaginationRequest paginationRequest = new PaginationRequest(-1, -1); paginationRequest.setOwner(username); - paginationRequest.setStatusList(Arrays.asList("ACTIVE", "INACTIVE", "UNREACHABLE")); + paginationRequest.setStatusList(Arrays.asList(EnrolmentInfo.Status.ACTIVE.name(), + EnrolmentInfo.Status.INACTIVE.name(),EnrolmentInfo.Status.UNREACHABLE.name())); PaginationResult ownDeviceIds = HelperUtil.getDeviceManagementProviderService(). getAllDevicesIdList(paginationRequest); if (ownDeviceIds.getData() != null) { diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index c4a50c3705..d0702df536 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -21,16 +21,16 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 application-mgt pom - WSO2 Carbon - Application Management Component - WSO2 Carbon - Application Management Component + Entgra Device Management - Application Management Component + Entgra Device Management - Application Management Component https://entgra.io diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml index c75eae5479..0b28d6dfa5 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core cea-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.cea.mgt.admin.api war - Entgra IoT - CEA Management Admin API - Entgra IoT - Conditional Email Access Management Admin API + Entgra Device Management - CEA Management Admin API + Entgra Device Management - Conditional Email Access Management Admin API diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml index 9e8060e0b8..b560d70134 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml @@ -23,15 +23,15 @@ io.entgra.device.mgt.core cea-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.cea.mgt.common bundle - Entgra IoT - CEA Management Common - Entgra IoT - Conditional Email Access Management Common + Entgra Device Management - CEA Management Common + Entgra Device Management - Conditional Email Access Management Common diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml index a09c92436a..7055d7952a 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core cea-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.cea.mgt.core bundle - Entgra IoT - CEA Management Core - Entgra IoT - Conditional Email Access Management Core + Entgra Device Management - CEA Management Core + Entgra Device Management - Conditional Email Access Management Core diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml index c22f147d82..5f8eae52c7 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core cea-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml io.entgra.device.mgt.core.cea.mgt.enforce 4.0.0 bundle - Entgra IoT - CEA Management Enforcement Service - Entgra IoT - Conditional Email Access Management Enforcement Service + Entgra Device Management - CEA Management Enforcement Service + Entgra Device Management - Conditional Email Access Management Enforcement Service diff --git a/components/cea-mgt/pom.xml b/components/cea-mgt/pom.xml index 78b391bd6b..f1cc314598 100644 --- a/components/cea-mgt/pom.xml +++ b/components/cea-mgt/pom.xml @@ -21,16 +21,16 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 cea-mgt pom - Entgra IoT - CEA Management Component - Entgra IoT - Conditional Email Access Management Component + Entgra Device Management - CEA Management Component + Entgra Device Management - Conditional Email Access Management Component io.entgra.device.mgt.core.cea.mgt.core diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml index bf1dee7058..a2d8e37aa7 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml @@ -22,15 +22,15 @@ certificate-mgt io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.certificate.mgt.api war - WSO2 Carbon - Certificate Management API - WSO2 Carbon - Certificate Management API + Entgra Device Management - Certificate Management API + Entgra Device Management - Certificate Management API https://entgra.io diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml index 3f9de89f2d..536ef97716 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml @@ -22,15 +22,15 @@ certificate-mgt io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.certificate.mgt.cert.admin.api war - WSO2 Carbon - Admin Certificate Management API - WSO2 Carbon - Admin Certificate Management API + Entgra Device Management - Admin Certificate Management API + Entgra Device Management - Admin Certificate Management API https://entgra.io diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index ff7cc19498..29ba28fbef 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core certificate-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.certificate.mgt.core bundle - WSO2 Carbon - Certificate Management Core - WSO2 Carbon - Certificate Management Core + Entgra Device Management - Certificate Management Core + Entgra Device Management - Certificate Management Core https://entgra.io @@ -65,12 +65,12 @@ io.entgra.device.mgt.core.certificate.mgt.core.dao, io.entgra.device.mgt.core.certificate.mgt.core.dto, io.entgra.device.mgt.core.certificate.mgt.core.exception, - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config.cache;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config.cache;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.service;version="${io.entgra.device.mgt.core.version.range}", io.swagger.annotations;version="[1.6,2)", javax.cache;version="[1.0,2)", javax.naming, diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java index 92891754ed..26217b4667 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java @@ -139,7 +139,7 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl { isCertificateUsernameProvided = true; } - query += "ORDER BY ID LIMIT ?,?"; + query += "ORDER BY ID DESC LIMIT ?,?"; try (PreparedStatement stmt = conn.prepareStatement(query)) { int paramIdx = 1; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java index 9fd87d6ed0..716d5df388 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java @@ -78,7 +78,7 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl { isCertificateUsernameProvided = true; } - query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + query += "ORDER BY ID DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; try (PreparedStatement stmt = conn.prepareStatement(query)) { int paramIdx = 1; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java index ef06ec0000..2d1cc90851 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java @@ -78,7 +78,7 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl { isCertificateUsernameProvided = true; } - query += "ORDER BY ID LIMIT ? OFFSET ?"; + query += "ORDER BY ID DESC LIMIT ? OFFSET ?"; try (PreparedStatement stmt = conn.prepareStatement(query)) { int paramIdx = 1; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java index 22874dd7b7..a9f37a6143 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java @@ -78,7 +78,7 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl { isCertificateUsernameProvided = true; } - query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + query += "ORDER BY ID DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; try (PreparedStatement stmt = conn.prepareStatement(query)) { int paramIdx = 1; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java index e8a29ebc29..6147618664 100755 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java @@ -29,6 +29,7 @@ import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagement import io.entgra.device.mgt.core.certificate.mgt.core.util.CommonUtil; import io.entgra.device.mgt.core.certificate.mgt.core.util.Serializer; import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.bouncycastle.asn1.ASN1Encodable; @@ -429,19 +430,34 @@ public class CertificateGenerator { generateCertificate(byteArrayInputStream); if (reqCert != null && reqCert.getSerialNumber() != null) { - log.debug("looking up certificate for serial: " + reqCert.getSerialNumber().toString()); - CertificateResponse lookUpCertificate = keyStoreReader.getCertificateBySerial( - reqCert.getSerialNumber().toString()); + if (log.isDebugEnabled()) { + log.debug("looking up certificate for serial: " + reqCert.getSerialNumber().toString()); + } + String orgUnit = CommonUtil.getSubjectDnAttribute(reqCert, + CertificateManagementConstants.ORG_UNIT_ATTRIBUTE); + CertificateResponse lookUpCertificate; + if (StringUtils.isNotEmpty(orgUnit)) { + int tenantId = Integer.parseInt(orgUnit.split(("_"))[1]); + lookUpCertificate = keyStoreReader.getCertificateBySerial(reqCert.getSerialNumber().toString(), + tenantId); + } else { + lookUpCertificate = keyStoreReader.getCertificateBySerial( + reqCert.getSerialNumber().toString()); + } if (lookUpCertificate != null && lookUpCertificate.getCertificate() != null) { - log.debug("certificate found for serial: " + reqCert.getSerialNumber() - .toString()); + if (log.isDebugEnabled()) { + log.debug("certificate found for serial: " + reqCert.getSerialNumber() + .toString()); + } Certificate certificate = (Certificate) Serializer.deserialize(lookUpCertificate.getCertificate()); if (certificate instanceof X509Certificate) { return (X509Certificate) certificate; } } else { - log.debug("certificate not found for serial: " + reqCert.getSerialNumber() - .toString()); + if (log.isDebugEnabled()) { + log.debug("certificate not found for serial: " + reqCert.getSerialNumber() + .toString()); + } } } @@ -464,7 +480,6 @@ public class CertificateGenerator { log.error(errorMsg); throw new KeystoreException(errorMsg, e); } - return null; } @@ -823,8 +838,14 @@ public class CertificateGenerator { } String subjectDn = joiner.toString(); X500Name issuerName = new X500Name(subjectDn); + String commonName = certificationRequest.getSubject().getRDNs(BCStyle.CN)[0].getFirst() .getValue().toString(); + // CSR sent from a Windows device will have an '!' followed by the device ID in the CN + if (commonName.contains("!")) { + commonName = commonName.split("!")[1]; + } + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); X500Name subjectName = new X500Name("O=" + commonName + " ,CN=" + serialNumber + ", OU=tenant_" + tenantId); diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagementConstants.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagementConstants.java index f851bd05f0..35da404ef8 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagementConstants.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagementConstants.java @@ -35,6 +35,7 @@ public final class CertificateManagementConstants { public static final String DES_EDE = "DESede"; public static final String CONF_LOCATION = "conf.location"; public static final String DEFAULT_PRINCIPAL = "O=WSO2, OU=Mobile, C=LK"; + public static final String ORG_UNIT_ATTRIBUTE = "OU="; public static final String RSA_PRIVATE_KEY_BEGIN_TEXT = "-----BEGIN RSA PRIVATE KEY-----\n"; public static final String RSA_PRIVATE_KEY_END_TEXT = "-----END RSA PRIVATE KEY-----"; public static final String EMPTY_TEXT = ""; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CommonUtil.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CommonUtil.java index 0aee44954d..a18dd057fa 100755 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CommonUtil.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CommonUtil.java @@ -17,7 +17,10 @@ */ package io.entgra.device.mgt.core.certificate.mgt.core.util; +import org.apache.commons.lang.StringUtils; + import java.math.BigInteger; +import java.security.cert.X509Certificate; import java.util.Calendar; import java.util.Date; @@ -43,4 +46,26 @@ public class CommonUtil { return BigInteger.valueOf(System.currentTimeMillis()); } + /** + * Returns the value of the given attribute from the subject distinguished name. eg: "entgra.net" + * from "CN=entgra.net" + * @param requestCertificate {@link X509Certificate} that needs to extract an attribute from + * @param attribute the attribute name that needs to be extracted from the cert. eg: "CN=" + * @return the value of the attribute + */ + public static String getSubjectDnAttribute(X509Certificate requestCertificate, String attribute) { + String distinguishedName = requestCertificate.getSubjectDN().getName(); + if (StringUtils.isNotEmpty(distinguishedName)) { + String[] dnSplits = distinguishedName.split(","); + for (String dnSplit : dnSplits) { + if (dnSplit.contains(attribute)) { + String[] cnSplits = dnSplit.split("="); + if (StringUtils.isNotEmpty(cnSplits[1])) { + return cnSplits[1]; + } + } + } + } + return null; + } } diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index c733f7e373..36ade9905d 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 certificate-mgt pom - WSO2 Carbon - Certificate Management Component + Entgra Device Management - Certificate Management Component https://entgra.io diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml index 888af70f81..8a2b0c836c 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml @@ -22,15 +22,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager bundle - Entgra IoT - Default User Roles Management Module - Entgra IoT - Default User Roles Management Module Implementation + Entgra Device Management - Default User Roles Management Module + Entgra Device Management - Default User Roles Management Module Implementation http://entgra.io @@ -55,8 +55,8 @@ IoT - User Roles Management Bundle io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.internal - io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.bean;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.exception;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.bean;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.exception;version="${io.entgra.device.mgt.core.version.range}", javax.xml.bind;version="[0.0,1)", javax.xml.bind.annotation;version="[0.0,1)", javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml index 3cc512d792..a808eb1ab1 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml @@ -22,14 +22,14 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api war - Entgra IoT - API Device Organization Management API + Entgra Device Management - API Device Organization Management API This module extends the API manager's device organization management apis. http://entgra.io diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml index 61480722b1..b190b05aa7 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml @@ -22,15 +22,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.device.organization bundle - Entgra IoT - Device Organization Module - Entgra IoT - Device Organization Module Implementation + Entgra Device Management - Device Organization Module + Entgra Device Management - Device Organization Module Implementation http://entgra.io diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml index 2a04b62e41..9b06465acd 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,15 +22,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer bundle - WSO2 Carbon - Device Type Deployer - WSO2 Carbon - Device Type Deployer Implementation + Entgra Device Management - Device Type Deployer + Entgra Device Management - Device Type Deployer Implementation https://entgra.io @@ -151,11 +151,11 @@ io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.* - io.entgra.device.mgt.core.device.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.spi;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.util, - io.entgra.device.mgt.core.device.mgt.extensions.device.type.template;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception;version="${io.entgra.device.mgt.core.version.range}", javax.xml.bind;version="[0.0,1)", javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", org.apache.axis2.context;version="[1.6,2)", diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml index aa4b2c1cf1..7266341f34 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml @@ -21,15 +21,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.logger bundle - Entgra IoT - Logger Impl - Entgra IoT - Entgra Logger Implementation + Entgra Device Management - Logger Impl + Entgra Device Management - Entgra Logger Implementation http://entgra.io diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml index d1ea2bc255..48443f1491 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml @@ -22,15 +22,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.pull.notification bundle - WSO2 Carbon - Pull Notification Provider Implementation - WSO2 Carbon - Pull Notification Provider Implementation + Entgra Device Management - Pull Notification Provider Implementation + Entgra Device Management - Pull Notification Provider Implementation https://entgra.io @@ -84,14 +84,14 @@ com.google.gson;version="[2.9,3)", - io.entgra.device.mgt.core.application.mgt.common.exception;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.common.services;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.pull.notification;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", - io.entgra.device.mgt.core.policy.mgt.core;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.common.services;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.pull.notification;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.service;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.policy.mgt.core;version="${io.entgra.device.mgt.core.version.range}", org.apache.commons.logging;version="[1.2,2)", org.osgi.service.*;version="${imp.package.version.osgi.service}" diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml index 01e0074adf..b72f93840f 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,15 +22,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm bundle - WSO2 Carbon - FCM Based Push Notification Provider Implementation - WSO2 Carbon - FCM Based Push Notification Provider Implementation + Entgra Device Management - FCM Based Push Notification Provider Implementation + Entgra Device Management - FCM Based Push Notification Provider Implementation https://entgra.io diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml index 1ae1b328cf..c3dc7fa4cc 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,15 +22,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http bundle - WSO2 Carbon - HTTP Based Push Notification Provider Implementation - WSO2 Carbon - HTTP Based Push Notification Provider Implementation + Entgra Device Management - HTTP Based Push Notification Provider Implementation + Entgra Device Management - HTTP Based Push Notification Provider Implementation https://entgra.io @@ -127,8 +127,8 @@ com.google.gson;version="[2.9,3)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="${io.entgra.device.mgt.core.version.range}", org.apache.commons.httpclient;version="[3.1,4)", org.apache.commons.httpclient.methods;version="[3.1,4)", org.apache.commons.logging;version="[1.2,2)", diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 0477011b9f..c53a421ffa 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,15 +22,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt bundle - WSO2 Carbon - MQTT Based Push Notification Provider Implementation - WSO2 Carbon - MQTT Based Push Notification Provider Implementation + Entgra Device Management - MQTT Based Push Notification Provider Implementation + Entgra Device Management - MQTT Based Push Notification Provider Implementation https://entgra.io @@ -158,12 +158,12 @@ io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.* - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.operation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.operation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.service;version="${io.entgra.device.mgt.core.version.range}", org.apache.commons.logging;version="[1.2,2)", org.osgi.service.*;version="${imp.package.version.osgi.service}", org.wso2.carbon.context;version="[4.8,5)", diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index d22a7befe7..b54d6b8f92 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,15 +22,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp bundle - WSO2 Carbon - XMPP Based Push Notification Provider Implementation - WSO2 Carbon - XMPP Based Push Notification Provider Implementation + Entgra Device Management - XMPP Based Push Notification Provider Implementation + Entgra Device Management - XMPP Based Push Notification Provider Implementation https://entgra.io @@ -135,11 +135,11 @@ io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.* - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.service;version="${io.entgra.device.mgt.core.version.range}", org.apache.commons.logging;version="[1.2,2)", org.osgi.service.*;version="${imp.package.version.osgi.service}", org.wso2.carbon.event.output.adapter.core;version="[5.3,6)", diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml index 3cc4114dc9..c73865c166 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml @@ -22,15 +22,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.stateengine bundle - Entgra IoT - State Engine - Entgra IoT - State Engine Components + Entgra Device Management - State Engine + Entgra Device Management - State Engine Components http://entgra.io @@ -54,7 +54,7 @@ ${io.entgra.device.mgt.core.version} IoT Device Management State Engine Bundle - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.device.mgt.extensions.stateengine.dto, io.entgra.device.mgt.core.device.mgt.extensions.stateengine.exception, org.apache.commons.logging;version="[1.2,2)", diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml index a6b55859df..cc6ee9fc21 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml @@ -22,15 +22,15 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper bundle - Entgra IoT - User store role mapping Module - Entgra IoT - User store role mapping Module + Entgra Device Management - User store role mapping Module + Entgra Device Management - User store role mapping Module http://entgra.io diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 455aa0679c..daf2457a80 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -20,17 +20,17 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 device-mgt-extensions pom - WSO2 Carbon - Device Management Extensions - WSO2 Carbon - Device Management Extensions + Entgra Device Management - Device Management Extensions + Entgra Device Management - Device Management Extensions https://entgra.io diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml index 6ce3f3e666..e980421af9 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml @@ -22,15 +22,15 @@ device-mgt io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.api war - WSO2 Carbon - Mobile Device Management API - WSO2 Carbon - Mobile Device Management API + Entgra Device Management - Mobile Device Management API + Entgra Device Management - Mobile Device Management API https://entgra.io diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceStatusFilterService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceStatusFilterService.java index 7c0d84de1d..dc7c5a70fd 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceStatusFilterService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceStatusFilterService.java @@ -115,7 +115,7 @@ public interface DeviceStatusFilterService { required = true) @PathParam ("device-type") String deviceType); @GET - @Path("/is-enabled") + @Path("/device-status-check") @ApiOperation( httpMethod = HTTPConstants.HEADER_GET, value = "Get device status filter", @@ -155,7 +155,7 @@ public interface DeviceStatusFilterService { Response getDeviceStatusCheck(); @PUT - @Path("/toggle-device-status") + @Path("/device-status-check") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = HTTPConstants.HEADER_POST, @@ -201,6 +201,7 @@ public interface DeviceStatusFilterService { @QueryParam("isEnabled") boolean isEnabled); @PUT + @Path("/{deviceType}") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = HTTPConstants.HEADER_POST, @@ -243,10 +244,51 @@ public interface DeviceStatusFilterService { name = "deviceType", value = "The device type for which you want to update device status filters.", required = true) - @QueryParam("deviceType") String deviceType, + @PathParam ("deviceType") String deviceType, @ApiParam( name = "deviceStatus", value = "A list of device status values to update for the given device type.", required = true) @QueryParam("deviceStatus") List deviceStatus); + + @POST + @Path("/default") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = HTTPConstants.HEADER_POST, + value = "Add Default Device status filters", + notes = "Add Default Device status filters", + tags = "Tenant Metadata Management", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "dm:devicestatusfilter:update") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully add default device status filters.", + response = Response.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 500, + message = "Internal Server Error. " + + "\n Server error occurred while adding default device status filters.", + response = ErrorResponse.class) + }) + Response setDefaultStatusFilterData(); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceStatusFilterServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceStatusFilterServiceImpl.java index 7e5fd01437..b2f958754b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceStatusFilterServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceStatusFilterServiceImpl.java @@ -20,13 +20,20 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceStatusFilterService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.DeviceStatusManagementService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; @@ -42,15 +49,14 @@ public class DeviceStatusFilterServiceImpl implements DeviceStatusFilterService @GET @Path("/{deviceType}") public Response getDeviceStatusFilters(@PathParam("deviceType") String deviceType) { - List result; - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); try { DeviceStatusManagementService deviceManagementProviderService = DeviceMgtAPIUtils.getDeviceStatusManagmentService(); - result = deviceManagementProviderService.getDeviceStatusFilters(deviceType, tenantId); - if (result != null) { - return Response.status(Response.Status.OK).entity(result).build(); - } - return Response.status(Response.Status.NO_CONTENT).entity(false).build(); + return Response.status(Response.Status.OK).entity(deviceManagementProviderService + .getDeviceStatusFilters(deviceType)).build(); + } catch (MetadataKeyNotFoundException e) { + String msg = "Couldn't find the device status filter details for device type: " + deviceType; + log.error(msg, e); + return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (MetadataManagementException e) { String msg = "Error occurred while getting device status filter of the tenant."; log.error(msg, e); @@ -59,7 +65,7 @@ public class DeviceStatusFilterServiceImpl implements DeviceStatusFilterService } @GET - @Path("/is-enabled") + @Path("/device-status-check") @Override public Response getDeviceStatusCheck() { boolean result; @@ -68,8 +74,12 @@ public class DeviceStatusFilterServiceImpl implements DeviceStatusFilterService DeviceStatusManagementService deviceManagementProviderService = DeviceMgtAPIUtils.getDeviceStatusManagmentService(); result = deviceManagementProviderService.getDeviceStatusCheck(tenantId); return Response.status(Response.Status.OK).entity(result).build(); + } catch (MetadataKeyNotFoundException e) { + String msg = "Couldn't find the device status check metadata for tenant ID: " + tenantId; + log.error(msg, e); + return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (MetadataManagementException e) { - String msg = "Error occurred while getting device status filter of the tenant."; + String msg = "Error occurred while getting device status check for the tenant."; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } @@ -77,15 +87,14 @@ public class DeviceStatusFilterServiceImpl implements DeviceStatusFilterService @Override @PUT - @Path("/toggle-device-status") + @Path("/device-status-check") public Response updateDeviceStatusCheck( @QueryParam("isEnabled") boolean isEnabled) { boolean result; - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); try { DeviceStatusManagementService deviceManagementProviderService = DeviceMgtAPIUtils.getDeviceStatusManagmentService(); - result = deviceManagementProviderService.updateDefaultDeviceStatusCheck(tenantId, isEnabled); + result = deviceManagementProviderService.updateDefaultDeviceStatusCheck(isEnabled); if (result) { return Response.status(Response.Status.OK).entity("Successfully updated device status check.").build(); } else { @@ -100,16 +109,14 @@ public class DeviceStatusFilterServiceImpl implements DeviceStatusFilterService @Override @PUT + @Path("/{deviceType}") public Response updateDeviceStatusFilters( - @QueryParam("deviceType") - String deviceType, - @QueryParam("deviceStatus") - List deviceStatus + @PathParam("deviceType") String deviceType, + @QueryParam("deviceStatus") List deviceStatus ) { - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); try { DeviceStatusManagementService deviceManagementProviderService = DeviceMgtAPIUtils.getDeviceStatusManagmentService(); - deviceManagementProviderService.updateDefaultDeviceStatusFilters(tenantId, deviceType, deviceStatus); + deviceManagementProviderService.updateDefaultDeviceStatusFilters(deviceType, deviceStatus); return Response.status(Response.Status.OK).entity("Successfully updated device status filters for " + deviceType).build(); } catch (MetadataManagementException e) { String msg = "Error occurred while updating device status for " + deviceType; @@ -117,4 +124,18 @@ public class DeviceStatusFilterServiceImpl implements DeviceStatusFilterService return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } } + + @Override + public Response setDefaultStatusFilterData() { + DeviceStatusManagementService deviceManagementProviderService = DeviceMgtAPIUtils.getDeviceStatusManagmentService(); + try { + deviceManagementProviderService.resetToDefaultDeviceStatusFilter(); + return Response.status(Response.Status.OK).entity("Successfully updated device status filters to " + + "default values that is configured in the product").build(); + } catch (MetadataManagementException e) { + String msg = "Error occurred while updating device status for default values that is configured in the product"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/MetadataServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/MetadataServiceImpl.java index 6ed5270334..2e2999bbda 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/MetadataServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/MetadataServiceImpl.java @@ -36,8 +36,6 @@ import org.apache.commons.logging.LogFactory; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.io.ByteArrayInputStream; -import java.io.IOException; import java.util.List; /** @@ -147,21 +145,4 @@ public class MetadataServiceImpl implements MetadataService { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } } - - /** - * Useful to send files as application/octet-stream responses - */ - private Response sendFileStream(byte[] content) throws IOException { - try (ByteArrayInputStream binaryDuplicate = new ByteArrayInputStream(content)) { - Response.ResponseBuilder response = Response - .ok(binaryDuplicate, MediaType.APPLICATION_OCTET_STREAM); - response.status(Response.Status.OK); - response.header("Content-Length", content.length); - return response.build(); - } catch (IOException e) { - String msg = "Error occurred while creating input stream from buffer array. "; - log.error(msg, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } - } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml index cc9da3624c..3e9d8f7b0d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml @@ -21,15 +21,15 @@ device-mgt io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.common bundle - WSO2 Carbon - Device Management Commons - WSO2 Carbon - Device Management Commons + Entgra Device Management - Device Management Commons + Entgra Device Management - Device Management Commons https://entgra.io diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Feature.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Feature.java index 399389271e..a495acc279 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Feature.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Feature.java @@ -58,6 +58,13 @@ public class Feature implements Serializable { ) private String description; + @ApiModelProperty( + name = "tooltip", + value = "Provides a tooltip for the features.", + required = false + ) + private String tooltip; + @ApiModelProperty( name = "type", value = "Type of the feature.", @@ -86,6 +93,20 @@ public class Feature implements Serializable { ) private List metadataEntries; + @ApiModelProperty( + name = "confirmationTexts", + value = "Disenroll delete confirmation modal texts.", + required = false + ) + private ConfirmationTexts confirmationTexts; + + @ApiModelProperty( + name = "dangerZoneTooltipTexts", + value = "Danger zone tooltip texts.", + required = false + ) + private DangerZoneTooltipTexts dangerZoneTooltipTexts; + @XmlElement public int getId() { return id; @@ -139,6 +160,16 @@ public class Feature implements Serializable { this.description = description; } + @XmlElement + public String getTooltip() { + return tooltip; + } + + public void setTooltip(String tooltip) { + this.tooltip = tooltip; + } + + @XmlAttribute public String getType() { return type; @@ -156,6 +187,24 @@ public class Feature implements Serializable { this.hidden = hidden; } + @XmlElement + public ConfirmationTexts getConfirmationTexts() { + return confirmationTexts; + } + + public void setConfirmationTexts(ConfirmationTexts confirmationTexts) { + this.confirmationTexts = confirmationTexts; + } + + @XmlElement + public DangerZoneTooltipTexts getDangerZoneTooltipTexts() { + return dangerZoneTooltipTexts; + } + + public void setDangerZoneTooltipTexts(DangerZoneTooltipTexts dangerZoneTooltipTexts) { + this.dangerZoneTooltipTexts = dangerZoneTooltipTexts; + } + public static class MetadataEntry implements Serializable { private int id; @@ -186,4 +235,136 @@ public class Feature implements Serializable { this.value = value; } } + + public static class ConfirmationTexts implements Serializable { + private int id; + private String deleteConfirmModalTitle; + private String deleteConfirmModalText; + private String deleteConfirmationTextDescribe; + private String deleteConfirmationText; + private String cancelText; + private String confirmText; + private String inputLabel; + private String inputRequireMessage; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getCancelText() { + return cancelText; + } + + public void setCancelText(String cancelText) { + this.cancelText = cancelText; + } + + public String getConfirmText() { + return confirmText; + } + + public void setConfirmText(String confirmText) { + this.confirmText = confirmText; + } + + public String getInputLabel() { + return inputLabel; + } + + public void setInputLabel(String inputLabel) { + this.inputLabel = inputLabel; + } + + public String getInputRequireMessage() { + return inputRequireMessage; + } + + public void setInputRequireMessage(String inputRequireMessage) { + this.inputRequireMessage = inputRequireMessage; + } + + public String getDeleteConfirmModalTitle() { + return deleteConfirmModalTitle; + } + + public void setDeleteConfirmModalTitle(String deleteConfirmModalTitle) { + this.deleteConfirmModalTitle = deleteConfirmModalTitle; + } + + public String getDeleteConfirmModalText() { + return deleteConfirmModalText; + } + + public void setDeleteConfirmModalText(String deleteConfirmModalText) { + this.deleteConfirmModalText = deleteConfirmModalText; + } + + public String getDeleteConfirmationTextDescribe() { + return deleteConfirmationTextDescribe; + } + + public void setDeleteConfirmationTextDescribe(String deleteConfirmationTextDescribe) { + this.deleteConfirmationTextDescribe = deleteConfirmationTextDescribe; + } + + public String getDeleteConfirmationText() { + return deleteConfirmationText; + } + + public void setDeleteConfirmationText(String deleteConfirmationText) { + this.deleteConfirmationText = deleteConfirmationText; + } + } + + public static class DangerZoneTooltipTexts implements Serializable { + private String toolTipTitle; + private String toolTipPopConfirmText; + private String confirmText; + private String cancelText; + private String toolTipAvailable; + + public String getToolTipAvailable() { + return toolTipAvailable; + } + + public void setToolTipAvailable(String toolTipAvailable) { + this.toolTipAvailable = toolTipAvailable; + } + + public String getToolTipTitle() { + return toolTipTitle; + } + + public void setToolTipTitle(String toolTipTitle) { + this.toolTipTitle = toolTipTitle; + } + + public String getToolTipPopConfirmText() { + return toolTipPopConfirmText; + } + + public void setToolTipPopConfirmText(String toolTipPopConfirmText) { + this.toolTipPopConfirmText = toolTipPopConfirmText; + } + + public String getConfirmText() { + return confirmText; + } + + public void setConfirmText(String confirmText) { + this.confirmText = confirmText; + } + + public String getCancelText() { + return cancelText; + } + + public void setCancelText(String cancelText) { + this.cancelText = cancelText; + } + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/exceptions/MetadataKeyAlreadyExistsException.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/exceptions/MetadataKeyAlreadyExistsException.java index f138d5c12c..5feabe2708 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/exceptions/MetadataKeyAlreadyExistsException.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/exceptions/MetadataKeyAlreadyExistsException.java @@ -21,7 +21,7 @@ package io.entgra.device.mgt.core.device.mgt.common.exceptions; /** * Custom exception class to be used in MetadataMgmt related functionalities. */ -public class MetadataKeyAlreadyExistsException extends Exception { +public class MetadataKeyAlreadyExistsException extends MetadataManagementException { private static final long serialVersionUID = -1814347544027733436L; private String errorMessage; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/exceptions/MetadataKeyNotFoundException.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/exceptions/MetadataKeyNotFoundException.java index 965c1b757b..0f95bdaf05 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/exceptions/MetadataKeyNotFoundException.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/exceptions/MetadataKeyNotFoundException.java @@ -21,7 +21,7 @@ package io.entgra.device.mgt.core.device.mgt.common.exceptions; /** * Custom exception class to be used in MetadataMgmt related functionalities. */ -public class MetadataKeyNotFoundException extends Exception { +public class MetadataKeyNotFoundException extends MetadataManagementException { private static final long serialVersionUID = 5260831982626354815L; private String errorMessage; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/DeviceStatusManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/DeviceStatusManagementService.java index 5ee7c8fce0..163ac9bbc4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/DeviceStatusManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/DeviceStatusManagementService.java @@ -34,18 +34,19 @@ public interface DeviceStatusManagementService { void addDefaultDeviceStatusFilterIfNotExist(int tenantId) throws MetadataManagementException; /** - * This method is useful to reset existing device status to default values in xml + * This method is useful to reset existing device status to default values and device status check value to + * default value that is defined in the ui-config * * @throws MetadataManagementException if error while resetting default device status */ - void resetToDefaultDeviceStausFilter() throws MetadataManagementException; + void resetToDefaultDeviceStatusFilter() throws MetadataManagementException; /** * This method is useful to update existing allowed device status * * @throws MetadataManagementException if error while updating existing device status */ - void updateDefaultDeviceStatusFilters(int tenantId, String deviceType, List deviceStatus) + void updateDefaultDeviceStatusFilters(String deviceType, List deviceStatus) throws MetadataManagementException; /** @@ -53,21 +54,21 @@ public interface DeviceStatusManagementService { * * @throws MetadataManagementException if error while updating existing device status */ - boolean updateDefaultDeviceStatusCheck(int tenantId, boolean isChecked) + boolean updateDefaultDeviceStatusCheck(boolean isChecked) throws MetadataManagementException; /** * This method is useful to get existing device status filters * * @throws MetadataManagementException if error while getting existing device status */ - List getDeviceStatusFilters(int tenantId) throws MetadataManagementException; + List getDeviceStatusFilters() throws MetadataManagementException; /** * This method is useful to get existing device status filters by device type and tenant id * * @throws MetadataManagementException if error while getting existing device status */ - List getDeviceStatusFilters(String deviceType, int tenantId) throws MetadataManagementException; + List getDeviceStatusFilters(String deviceType) throws MetadataManagementException; /** * This method is useful to get existing device status filters diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/WhiteLabelTheme.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/WhiteLabelTheme.java index 3bf6cc2e5b..62303e8c73 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/WhiteLabelTheme.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/WhiteLabelTheme.java @@ -24,6 +24,7 @@ public class WhiteLabelTheme { private WhiteLabelImage logoIconImage; private String footerText; private String appTitle; + private String docUrl; public String getFooterText() { return footerText; @@ -64,4 +65,12 @@ public class WhiteLabelTheme { public void setLogoIconImage(WhiteLabelImage logoIconImage) { this.logoIconImage = logoIconImage; } + + public String getDocUrl() { + return docUrl; + } + + public void setDocUrl(String docUrl) { + this.docUrl = docUrl; + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/WhiteLabelThemeCreateRequest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/WhiteLabelThemeCreateRequest.java index 0a48bf0144..95eeb6b01a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/WhiteLabelThemeCreateRequest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/WhiteLabelThemeCreateRequest.java @@ -24,6 +24,7 @@ public class WhiteLabelThemeCreateRequest { private WhiteLabelImageRequestPayload logoIcon; private String footerText; private String appTitle; + private String docUrl; public WhiteLabelImageRequestPayload getFavicon() { return favicon; @@ -64,4 +65,12 @@ public class WhiteLabelThemeCreateRequest { public void setLogoIcon(WhiteLabelImageRequestPayload logoIcon) { this.logoIcon = logoIcon; } + + public String getDocUrl() { + return docUrl; + } + + public void setDocUrl(String docUrl) { + this.docUrl = docUrl; + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml index 62e006db4b..6cf9047e82 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml @@ -22,15 +22,15 @@ device-mgt io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.config.api war - Entgra Carbon - Mobile Device Management Configuration API - Entgra Carbon - Mobile Device Management Configuration API + Entgra Device Management - Device Management Configuration API + Entgra Device Management - Device Management Configuration API https://entgra.io diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java index e5d65dd4d3..97627393d5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java @@ -25,6 +25,7 @@ import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.DeviceConfi import io.entgra.device.mgt.core.device.mgt.common.general.TenantDetail; import io.entgra.device.mgt.core.device.mgt.config.api.beans.ErrorResponse; import io.swagger.annotations.*; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.dto.OperationConfig; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -77,6 +78,13 @@ import java.util.List; key = "admin:permissions:add", roles = {"Internal/devicemgt-user"}, permissions = {"/permissions/add"} + ), + @Scope( + name = "Manage operation configuration", + description = "Add or update operation configuration", + key = "admin:operation_config:manage", + roles = {"Internal/devicemgt-user"}, + permissions = {"/operation-configuration/manage"} ) } ) @@ -319,4 +327,173 @@ public interface DeviceManagementConfigService { }) @Produces(MediaType.APPLICATION_JSON) Response addPermission(List permissions); + + @GET + @Path("/operation-configuration") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = HttpMethod.GET, + value = "Getting operation configuration", + notes = "Retrieve the operation configuration", + tags = "Device Management Configuration", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "scope", value = "admin:operation_config:manage") + }) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully fetched the operation configuration.", + response = OperationConfig.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 400, + message = "Bad Request.", + response = ErrorResponse.class), + @ApiResponse( + code = 401, + message = "Unauthorized. \n Unauthorized operation! Only admin role can perform this operation."), + @ApiResponse( + code = 404, + message = "Not Found. \n No operation found", + response = ErrorResponse.class), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while adding operation configuration.", + response = ErrorResponse.class) + }) + Response getOperationConfiguration(); + + @POST + @Path("/operation-configuration") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = HttpMethod.POST, + value = "Add operation configuration", + notes = "Add operation configuration.", + tags = "Device Management Configuration", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "scope", value = + "admin:operation_config:manage") + }) + } + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK. \n Successfully added the operation configuration.", + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 400, + message = "The incoming request has wrong operation configuration.", + response = ErrorResponse.class), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while adding operation configuration", + response = ErrorResponse.class) + }) + @Produces(MediaType.APPLICATION_JSON) + Response addOperationConfiguration(OperationConfig config); + + @PUT + @Path("/operation-configuration") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = HttpMethod.PUT, + value = "Update operation configuration", + notes = "Update operation configuration.", + tags = "Device Management Configuration", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "scope", value = "admin:operation_config:manage") + }) + } + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK. \n Successfully Update the operation configuration.", + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource was last modified.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 400, + message = "The incoming request has wrong operation configuration.", + response = ErrorResponse.class), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while adding operation configuration.", + response = ErrorResponse.class) + }) + @Produces(MediaType.APPLICATION_JSON) + Response updateOperationConfiguration(OperationConfig config); + + @DELETE + @Path("/operation-configuration") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = HttpMethod.DELETE, + value = "Delete operation configuration", + notes = "Delete operation configuration", + tags = {"Device Management Configuration"}, + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "scope", value = "admin:operation_config:manage") + }) + } + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully deleted the operation configuration", + response = Response.class), + @ApiResponse( + code = 400, + message = "Bad Request.", + response = Response.class), + @ApiResponse( + code = 404, + message = "Not Found. \n Operation configuration not provided", + response = Response.class), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while deleting the operation configuration.", + response = Response.class) + } + ) + Response deleteOperationConfiguration(); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java index a83bd6cc6f..b394f36b78 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java @@ -22,6 +22,12 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.logging.Log; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.OTPManagementException; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.OperationConfigurationService; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.dto.OperationConfig; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigAlreadyExistsException; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigException; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigNotFoundException; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -61,6 +67,7 @@ import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.POST; import javax.ws.rs.PUT; +import javax.ws.rs.DELETE; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; @@ -313,4 +320,89 @@ public class DeviceManagementConfigServiceImpl implements DeviceManagementConfig return Response.status(Response.Status.OK).build(); } + @GET + @Path("/operation-configuration") + @Produces({MediaType.APPLICATION_JSON}) + public Response getOperationConfiguration() { + OperationConfig config; + try { + config = OperationConfigurationService.getOperationConfig(); + } catch (OperationConfigException e) { + String msg = "Error occurred getting operation configuration"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } + if (config == null) { + String msg = "Operation configuration not provided"; + log.error(msg); + return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); + } else { + return Response.status(Response.Status.OK).entity(config).build(); + } + } + + @POST + @Path("/operation-configuration") + @Produces({MediaType.APPLICATION_JSON}) + public Response addOperationConfiguration(OperationConfig config) { + try { + if (config != null) { + OperationConfigurationService.addOperationConfiguration(config); + } else { + String msg = "Operation configuration not provided"; + log.error(msg); + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } + } catch (OperationConfigException e) { + String msg = "Error occurred adding operation configuration"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } catch (OperationConfigAlreadyExistsException e) { + String msg = "Operation configuration already exists"; + log.error(msg, e); + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } + return Response.status(Response.Status.OK).entity(config).build(); + } + + @PUT + @Path("/operation-configuration") + @Produces({MediaType.APPLICATION_JSON}) + public Response updateOperationConfiguration(OperationConfig config) { + try { + if (config != null) { + OperationConfigurationService.updateOperationConfiguration(config); + } else { + String msg = "Operation configuration body not provided"; + log.error(msg); + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } + } catch (OperationConfigException e) { + String msg = "Error occurred adding operation configuration"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + return Response.status(Response.Status.OK).entity(config).build(); + } + + @DELETE + @Path("/operation-configuration") + @Produces({MediaType.APPLICATION_JSON}) + public Response deleteOperationConfiguration() { + String msg; + try { + OperationConfigurationService.deleteOperationConfiguration(); + } catch (OperationConfigException e) { + msg = "Error occurred while deleting operation configuration"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } catch (OperationConfigNotFoundException e) { + msg = "Operation configuration not provided"; + log.error(msg, e); + return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); + } + msg = "Operation configuration deleted successfully"; + log.info(msg); + return Response.status(Response.Status.OK).entity(msg).build(); + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml index 00788c96f4..93bc5da774 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core device-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.core bundle - WSO2 Carbon - Device Management Core - WSO2 Carbon - Device Management Core + Entgra Device Management - Device Management Core + Entgra Device Management - Device Management Core https://entgra.io @@ -86,135 +86,55 @@ com.google.common.reflect;version="[32.1,33)";resolution:=optional, com.google.gson;version="[2.9,3)", com.google.gson.reflect;version="[2.9,3)", - io.entgra.device.mgt.core.apimgt.annotations;version="[5.0,6)", - io.entgra.device.mgt.core.apimgt.extension.rest.api;version="[5.0,6)", - io.entgra.device.mgt.core.apimgt.extension.rest.api.dto;version="[5.0,6)", - io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;version="[5.0,6)", - io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.apimgt.extension.rest.api.util;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.app.mgt.android;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.app.mgt.ios;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.app.mgt.windows;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.authorization;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.cost.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.device.details;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.enrollment.notification;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.event.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.general;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.geo.service;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.invitation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.license.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.notification.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.otp.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.pull.notification;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.report.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.roles.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.search;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.spi;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.type.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.app.mgt.config, - io.entgra.device.mgt.core.device.mgt.core.archival, - io.entgra.device.mgt.core.device.mgt.core.archival.dao, - io.entgra.device.mgt.core.device.mgt.core.archival.dao.impl, - io.entgra.device.mgt.core.device.mgt.core.cache, - io.entgra.device.mgt.core.device.mgt.core.cache.impl, - io.entgra.device.mgt.core.device.mgt.core.common.exception, - io.entgra.device.mgt.core.device.mgt.core.common.util, - io.entgra.device.mgt.core.device.mgt.core.config, - io.entgra.device.mgt.core.device.mgt.core.config.analytics, - io.entgra.device.mgt.core.device.mgt.core.config.analytics.operation, - io.entgra.device.mgt.core.device.mgt.core.config.archival, - io.entgra.device.mgt.core.device.mgt.core.config.cache, - io.entgra.device.mgt.core.device.mgt.core.config.datasource, - io.entgra.device.mgt.core.device.mgt.core.config.enrollment.guide, - io.entgra.device.mgt.core.device.mgt.core.config.geo.location, - io.entgra.device.mgt.core.device.mgt.core.config.identity, - io.entgra.device.mgt.core.device.mgt.core.config.keymanager, - io.entgra.device.mgt.core.device.mgt.core.config.license, - io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt, - io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.documentation, - io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.whitelabel, - io.entgra.device.mgt.core.device.mgt.core.config.operation.timeout, - io.entgra.device.mgt.core.device.mgt.core.config.pagination, - io.entgra.device.mgt.core.device.mgt.core.config.permission, - io.entgra.device.mgt.core.device.mgt.core.config.policy, - io.entgra.device.mgt.core.device.mgt.core.config.pull.notification, - io.entgra.device.mgt.core.device.mgt.core.config.push.notification, - io.entgra.device.mgt.core.device.mgt.core.config.remote.session, - io.entgra.device.mgt.core.device.mgt.core.config.status.task, - io.entgra.device.mgt.core.device.mgt.core.config.task, - io.entgra.device.mgt.core.device.mgt.core.config.tenant, - io.entgra.device.mgt.core.device.mgt.core.config.ui, - io.entgra.device.mgt.core.device.mgt.core.dao, - io.entgra.device.mgt.core.device.mgt.core.dao.impl, - io.entgra.device.mgt.core.device.mgt.core.dao.impl.device, - io.entgra.device.mgt.core.device.mgt.core.dao.impl.enrolment, - io.entgra.device.mgt.core.device.mgt.core.dao.impl.event, - io.entgra.device.mgt.core.device.mgt.core.dao.impl.geofence, - io.entgra.device.mgt.core.device.mgt.core.dao.impl.group, - io.entgra.device.mgt.core.device.mgt.core.dao.impl.tracker, - io.entgra.device.mgt.core.device.mgt.core.device.details.mgt, - io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.dao, - io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.dao.impl, - io.entgra.device.mgt.core.device.mgt.core.dto, - io.entgra.device.mgt.core.device.mgt.core.dto.event.config, - io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt, - io.entgra.device.mgt.core.device.mgt.core.geo.geoHash, - io.entgra.device.mgt.core.device.mgt.core.geo.task, - io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao, - io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.impl, - io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.util, - io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.util, - io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao, - io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.impl, - io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao, - io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl, - io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.operation, - io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.util, - io.entgra.device.mgt.core.device.mgt.core.operation.mgt.util, - io.entgra.device.mgt.core.device.mgt.core.operation.timeout.task, - io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao, - io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.impl, - io.entgra.device.mgt.core.device.mgt.core.otp.mgt.exception, - io.entgra.device.mgt.core.device.mgt.core.otp.mgt.util, - io.entgra.device.mgt.core.device.mgt.core.privacy, - io.entgra.device.mgt.core.device.mgt.core.privacy.dao, - io.entgra.device.mgt.core.device.mgt.core.privacy.dao.impl, - io.entgra.device.mgt.core.device.mgt.core.report.mgt, - io.entgra.device.mgt.core.device.mgt.core.report.mgt.config, - io.entgra.device.mgt.core.device.mgt.core.search.mgt, - io.entgra.device.mgt.core.device.mgt.core.search.mgt.dao, - io.entgra.device.mgt.core.device.mgt.core.status.task, - io.entgra.device.mgt.core.device.mgt.core.task, - io.entgra.device.mgt.core.device.mgt.core.traccar.api.service, - io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.impl, - io.entgra.device.mgt.core.device.mgt.core.traccar.common.beans, - io.entgra.device.mgt.core.device.mgt.core.traccar.common.config, - io.entgra.device.mgt.core.device.mgt.core.traccar.common.util, - io.entgra.device.mgt.core.device.mgt.core.traccar.core.config, - io.entgra.device.mgt.core.device.mgt.extensions.logger;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.extensions.logger.spi;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension.dto;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension.exception;version="[5.0,6)", - io.entgra.device.mgt.core.identity.jwt.client.extension.service;version="[5.0,6)", - io.entgra.device.mgt.core.notification.logger;version="[5.0,6)", - io.entgra.device.mgt.core.notification.logger.impl;version="[5.0,6)", - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception;version="[5.0,6)", - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;version="[5.0,6)", - io.entgra.device.mgt.core.transport.mgt.email.sender.core;version="[5.0,6)", - io.entgra.device.mgt.core.transport.mgt.email.sender.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.apimgt.annotations;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.apimgt.extension.rest.api;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.apimgt.extension.rest.api.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.apimgt.extension.rest.api.util;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.app.mgt.android;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.app.mgt.ios;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.app.mgt.windows;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.authorization;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.cost.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.device.details;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.enrollment.notification;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.event.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.general;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.geo.service;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.invitation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.license.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.notification.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.otp.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.pull.notification;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.report.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.roles.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.search;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.spi;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.type.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.extensions.logger;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.extensions.logger.spi;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.identity.jwt.client.extension.service;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.notification.logger;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.notification.logger.impl;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.transport.mgt.email.sender.core;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.transport.mgt.email.sender.core.service;version="${io.entgra.device.mgt.core.version.range}", io.swagger.annotations;version="[1.6,2)", javax.cache;version="[1.0,2)", javax.naming, diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/MetaDataConfiguration.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/MetaDataConfiguration.java index 52cf65dbf7..1812862dd5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/MetaDataConfiguration.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/MetaDataConfiguration.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt; -import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.documentation.DocConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.whitelabel.WhiteLabelConfiguration; import javax.xml.bind.annotation.XmlElement; @@ -27,7 +26,6 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "MetaDataConfiguration") public class MetaDataConfiguration { private WhiteLabelConfiguration whiteLabelConfiguration; - private DocConfiguration docConfiguration; @XmlElement(name = "WhiteLabelConfiguration", required = true) public WhiteLabelConfiguration getWhiteLabelConfiguration() { @@ -37,13 +35,4 @@ public class MetaDataConfiguration { public void setWhiteLabelConfiguration(WhiteLabelConfiguration whiteLabelConfiguration) { this.whiteLabelConfiguration = whiteLabelConfiguration; } - - @XmlElement(name = "DocConfiguration", required = true) - public DocConfiguration getDocConfiguration() { - return docConfiguration; - } - - public void setDocConfiguration(DocConfiguration docConfiguration) { - this.docConfiguration = docConfiguration; - } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/documentation/DocConfiguration.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/documentation/DocConfiguration.java deleted file mode 100644 index 63a6981146..0000000000 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/documentation/DocConfiguration.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018 - 2024, 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.config.metadata.mgt.documentation; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "DocConfiguration") -public class DocConfiguration { - private String docUrl; - - @XmlElement(name = "DocUrl", required = true) - public String getDocUrl() { - return docUrl; - } - - public void setDocUrl(String docUrl) { - this.docUrl = docUrl; - } -} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/whitelabel/WhiteLabelConfiguration.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/whitelabel/WhiteLabelConfiguration.java index 0ff43eee28..b12c1b0b6d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/whitelabel/WhiteLabelConfiguration.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/metadata/mgt/whitelabel/WhiteLabelConfiguration.java @@ -26,6 +26,16 @@ public class WhiteLabelConfiguration { private String footerText; private String appTitle; private WhiteLabelImages whiteLabelImages; + private String docUrl; + + @XmlElement(name = "DocUrl", required = true) + public String getDocUrl() { + return docUrl; + } + + public void setDocUrl(String docUrl) { + this.docUrl = docUrl; + } @XmlElement(name = "FooterText", required = true) public String getFooterText() { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java index 5da24ad91d..c883e2790e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java @@ -489,4 +489,15 @@ public interface GroupDAO { throws GroupManagementDAOException; int getDeviceCount(String groupName, int tenantId) throws GroupManagementDAOException; + + /** + * Retrieves the count of devices for a specific group, device type, and tenant. + * + * @param groupName the name of the group + * @param deviceTypeId the ID of the device type (e.g., Android, iOS, Windows) + * @param tenantId the ID of the tenant + * @return the count of devices for the given group, device type, and tenant + * @throws GroupManagementDAOException if an error occurs during the retrieval of the device count + */ + int getDeviceCountWithGroup(String groupName, int deviceTypeId, int tenantId) throws GroupManagementDAOException; } \ No newline at end of file diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java index 21f831e712..94b675d723 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java @@ -1584,4 +1584,37 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { throw new GroupManagementDAOException(msg, e); } } + + @Override + public int getDeviceCountWithGroup(String groupName, int deviceTypeId, int tenantId) throws GroupManagementDAOException { + int deviceCount = 0; + try { + Connection connection = GroupManagementDAOFactory.getConnection(); + String sql = "SELECT COUNT(e.ID) AS COUNT " + + "FROM DM_GROUP d " + + "INNER JOIN DM_DEVICE_GROUP_MAP m ON d.ID = m.GROUP_ID " + + "INNER JOIN DM_ENROLMENT e ON m.DEVICE_ID = e.DEVICE_ID " + + "INNER JOIN DM_DEVICE r ON e.DEVICE_ID = r.ID " + + "WHERE d.TENANT_ID = ? " + + "AND d.GROUP_NAME = ? " + + "AND r.DEVICE_TYPE_ID = ? " + + "AND e.STATUS NOT IN ('REMOVED', 'DELETED')"; + + try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) { + preparedStatement.setInt(1, tenantId); + preparedStatement.setString(2, groupName); + preparedStatement.setInt(3, deviceTypeId); + try (ResultSet resultSet = preparedStatement.executeQuery()) { + if (resultSet.next()) { + deviceCount = resultSet.getInt("COUNT"); + } + } + } + return deviceCount; + } catch (SQLException e) { + String msg = "Error occurred while retrieving device count for the group: " + groupName; + log.error(msg, e); + throw new GroupManagementDAOException(msg, e); + } + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java index 73bc98a17a..7159c3d33c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java @@ -250,11 +250,11 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { try { Connection conn = getConnection(); String sql = "SELECT d.ID AS DEVICE_ID, " + - "DEVICE_IDENTIFICATION, " + + "d.DEVICE_IDENTIFICATION, " + "DESCRIPTION, " + "NAME, " + "DATE_OF_ENROLMENT, " + - "LAST_UPDATED_TIMESTAMP, " + + "d.LAST_UPDATED_TIMESTAMP, " + "STATUS, " + "DATE_OF_LAST_UPDATE, " + "TIMESTAMPDIFF(DAY, ?, DATE_OF_ENROLMENT) as DAYS_SINCE_ENROLLED " + @@ -291,12 +291,12 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { try { conn = this.getConnection(); String sql = "select d.ID AS DEVICE_ID, " + - "DEVICE_IDENTIFICATION, " + + "d.DEVICE_IDENTIFICATION, " + "DESCRIPTION, " + "NAME, " + "DATE_OF_ENROLMENT, " + "DATE_OF_LAST_UPDATE, " + - "d1.LAST_UPDATED_TIMESTAMP, " + + "d.LAST_UPDATED_TIMESTAMP, " + "STATUS, " + "TIMESTAMPDIFF(DAY, DATE_OF_LAST_UPDATE, DATE_OF_ENROLMENT) AS DAYS_USED " + "from DM_DEVICE d, DM_ENROLMENT e " + @@ -336,11 +336,11 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { try { conn = this.getConnection(); String sql = "select d.ID AS DEVICE_ID, " + - "DEVICE_IDENTIFICATION, " + + "d.DEVICE_IDENTIFICATION, " + "DESCRIPTION, " + "NAME, " + "DATE_OF_ENROLMENT, " + - "LAST_UPDATED_TIMESTAMP, " + + "d.LAST_UPDATED_TIMESTAMP, " + "STATUS, " + "DATE_OF_LAST_UPDATE, " + "TIMESTAMPDIFF(DAY, ?, ?) as DAYS_SINCE_ENROLLED " + @@ -377,12 +377,12 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { try { conn = this.getConnection(); String sql = "select d.ID AS DEVICE_ID, " + - "DEVICE_IDENTIFICATION, " + + "d.DEVICE_IDENTIFICATION, " + "DESCRIPTION, " + "NAME, " + "DATE_OF_ENROLMENT, " + "DATE_OF_LAST_UPDATE, " + - "LAST_UPDATED_TIMESTAMP, " + + "d.LAST_UPDATED_TIMESTAMP, " + "STATUS, " + "TIMESTAMPDIFF(DAY, DATE_OF_LAST_UPDATE, ?) AS DAYS_USED " + "from DM_DEVICE d, DM_ENROLMENT e " + @@ -425,9 +425,9 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { conn = this.getConnection(); String sql = "SELECT " + "DM_DEVICE.ID AS DEVICE_ID, " + - "DEVICE_IDENTIFICATION, " + + "d.DEVICE_IDENTIFICATION, " + "DESCRIPTION, " + - "LAST_UPDATED_TIMESTAMP, " + + "d.LAST_UPDATED_TIMESTAMP, " + "DM_DEVICE.NAME AS DEVICE_NAME, " + "DEVICE_TYPE, " + "DM_ENROLMENT.ID AS ENROLMENT_ID, " + @@ -1365,7 +1365,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { query += " AND i.VALUE_FIELD LIKE ?" ; } if (user != null && !user.isEmpty()) { - query += " AND e.OWNER = ?"; + query += " AND e.OWNER LIKE ?"; isOwnerProvided = true; } if (status != null && !status.isEmpty()) { @@ -1395,7 +1395,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { ps.setString(index++, EnrolmentInfo.Status.REMOVED.toString()); ps.setString(index++, EnrolmentInfo.Status.DELETED.toString()); if (isDeviceNameProvided) { - ps.setString(index++, name + "%"); + ps.setString(index++, "%" + name + "%"); } if (isOwnershipProvided) { ps.setString(index++, ownership); @@ -1404,7 +1404,7 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { ps.setString(index++, "%" + serial + "%"); } if (isOwnerProvided) { - ps.setString(index++, user); + ps.setString(index++, "%" + user + "%"); } if (isStatusProvided) { for (String deviceStatus : status) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java index 3c8e0dd8ae..79afa4e4fe 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java @@ -1105,7 +1105,7 @@ public class PostgreSQLDeviceDAOImpl extends GenericDeviceDAOImpl { isOwnershipProvided = true; } if (user != null && !user.isEmpty()) { - query += " AND e.OWNER = ?"; + query += " AND e.OWNER LIKE ?"; isOwnerProvided = true; } if (status != null && !status.isEmpty()) { @@ -1136,13 +1136,13 @@ public class PostgreSQLDeviceDAOImpl extends GenericDeviceDAOImpl { ps.setString(index++, EnrolmentInfo.Status.REMOVED.toString()); ps.setString(index++, EnrolmentInfo.Status.DELETED.toString()); if (isDeviceNameProvided) { - ps.setString(index++, name + "%"); + ps.setString(index++, "%" + name + "%"); } if (isOwnershipProvided) { ps.setString(index++, ownership); } if (isOwnerProvided) { - ps.setString(index++, user); + ps.setString(index++, "%" + user + "%"); } if (isStatusProvided) { for (String deviceStatus : status) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java index 10eeb69719..e977d7bd6e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java @@ -977,7 +977,7 @@ public class SQLServerDeviceDAOImpl extends GenericDeviceDAOImpl { isOwnershipProvided = true; } if (user != null && !user.isEmpty()) { - query += " AND e.OWNER = ?"; + query += " AND e.OWNER LIKE ?"; isOwnerProvided = true; } if (status != null && !status.isEmpty()) { @@ -1008,13 +1008,13 @@ public class SQLServerDeviceDAOImpl extends GenericDeviceDAOImpl { ps.setString(index++, EnrolmentInfo.Status.REMOVED.toString()); ps.setString(index++, EnrolmentInfo.Status.DELETED.toString()); if (isDeviceNameProvided) { - ps.setString(index++, name + "%"); + ps.setString(index++, "%" + name + "%"); } if (isOwnershipProvided) { ps.setString(index++, ownership); } if (isOwnerProvided) { - ps.setString(index++, user); + ps.setString(index++, "%" + user + "%"); } if (isStatusProvided) { for (String deviceStatus : status) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java index f9ea261793..c9ae912a70 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java @@ -100,6 +100,7 @@ public class DeviceManagementDataHolder { private DeviceStatusManagementService deviceStatusManagementService; private APIApplicationServices apiApplicationServices; private PublisherRESTAPIServices publisherRESTAPIServices; + private DeviceManagementStartupHandler deviceManagementStartupHandler; private final Map deviceStatusTaskPluginConfigs = Collections.synchronizedMap( new HashMap<>()); @@ -457,4 +458,12 @@ public class DeviceManagementDataHolder { public void setGroupAccessAuthorizationService(GroupAccessAuthorizationService groupAccessAuthorizationService) { this.groupAccessAuthorizationService = groupAccessAuthorizationService; } + + public DeviceManagementStartupHandler getDeviceManagementStartupHandler() { + return deviceManagementStartupHandler; + } + + public void setDeviceManagementStartupHandler(DeviceManagementStartupHandler deviceManagementStartupHandler) { + this.deviceManagementStartupHandler = deviceManagementStartupHandler; + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java index 4aae43beb0..8d45e1ec91 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.core.internal; import io.entgra.device.mgt.core.device.mgt.common.authorization.GroupAccessAuthorizationService; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.DeviceStatusManagementService; import io.entgra.device.mgt.core.device.mgt.core.authorization.GroupAccessAuthorizationServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.DeviceStatusManagementServiceImpl; @@ -259,8 +260,10 @@ public class DeviceManagementServiceComponent { TenantCreateObserver listener = new TenantCreateObserver(); bundleContext.registerService(Axis2ConfigurationContextObserver.class.getName(), listener, null); - UserRoleCreateObserver userRoleCreateObserver = new UserRoleCreateObserver(); - bundleContext.registerService(ServerStartupObserver.class.getName(), userRoleCreateObserver, null); + /* Registering Device Management Startup Handler */ + DeviceManagementStartupHandler deviceManagementStartupHandler = new DeviceManagementStartupHandler(); + DeviceManagementDataHolder.getInstance().setDeviceManagementStartupHandler(deviceManagementStartupHandler); + bundleContext.registerService(ServerStartupObserver.class.getName(), deviceManagementStartupHandler, null); /* Registering Device Management Service */ DeviceManagementProviderService deviceManagementProvider = new DeviceManagementProviderServiceImpl(); @@ -333,26 +336,25 @@ public class DeviceManagementServiceComponent { bundleContext.registerService(MetadataManagementService.class.getName(), metadataManagementService, null); /* Registering Whitelabel Service */ - WhiteLabelManagementService whiteLabelManagementService = new WhiteLabelManagementServiceImpl(); - DeviceManagementDataHolder.getInstance().setWhiteLabelManagementService(whiteLabelManagementService); try { + WhiteLabelManagementService whiteLabelManagementService = new WhiteLabelManagementServiceImpl(); + DeviceManagementDataHolder.getInstance().setWhiteLabelManagementService(whiteLabelManagementService); whiteLabelManagementService.addDefaultWhiteLabelThemeIfNotExist(tenantId); - } catch (Throwable e) { - log.error("Error occurred while adding default tenant white label theme", e); - + bundleContext.registerService(WhiteLabelManagementService.class.getName(), whiteLabelManagementService, null); + } catch (MetadataManagementException e) { + log.error("Error occurred while initializing the white label management service", e); } - bundleContext.registerService(WhiteLabelManagementService.class.getName(), whiteLabelManagementService, null); /* Registering DeviceState Filter Service */ - DeviceStatusManagementService deviceStatusManagemntService = new DeviceStatusManagementServiceImpl(); - DeviceManagementDataHolder.getInstance().setDeviceStatusManagementService(deviceStatusManagemntService); + DeviceStatusManagementService deviceStatusManagementService = new DeviceStatusManagementServiceImpl(); + DeviceManagementDataHolder.getInstance().setDeviceStatusManagementService(deviceStatusManagementService); try { - deviceStatusManagemntService.addDefaultDeviceStatusFilterIfNotExist(tenantId); + deviceStatusManagementService.addDefaultDeviceStatusFilterIfNotExist(tenantId); } catch (Throwable e) { log.error("Error occurred while adding default tenant device status", e); } - bundleContext.registerService(DeviceStatusManagementService.class.getName(), deviceStatusManagemntService, null); + bundleContext.registerService(DeviceStatusManagementService.class.getName(), deviceStatusManagementService, null); /* Registering Event Configuration Service */ EventConfigurationProviderService eventConfigurationService = new EventConfigurationProviderServiceImpl(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementStartupHandler.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementStartupHandler.java new file mode 100644 index 0000000000..56fabedf6c --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementStartupHandler.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2018 - 2024, 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.internal; + +import com.google.gson.Gson; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; +import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.dto.OperationConfig; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationDAO; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.core.ServerStartupObserver; +import org.wso2.carbon.user.api.AuthorizationManager; +import org.wso2.carbon.user.api.Permission; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.api.UserStoreManager; +import org.wso2.carbon.utils.multitenancy.MultitenantConstants; + +public class DeviceManagementStartupHandler implements ServerStartupObserver { + private static final Log log = LogFactory.getLog(DeviceManagementStartupHandler.class); + private static final Gson gson = new Gson(); + private static final String OPERATION_CONFIG = "OPERATION_CONFIG"; + private static final String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; + + @Override + public void completingServerStartup() { + + } + + @Override + public void completedServerStartup() { + userRoleCreateObserver(); + operationStatusChangeObserver(); + } + + private void userRoleCreateObserver() { + try { + UserStoreManager userStoreManager = + DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm( + MultitenantConstants.SUPER_TENANT_ID).getUserStoreManager(); + String tenantAdminName = + DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm( + MultitenantConstants.SUPER_TENANT_ID).getRealmConfiguration().getAdminUserName(); + AuthorizationManager authorizationManager = DeviceManagementDataHolder.getInstance().getRealmService() + .getTenantUserRealm(MultitenantConstants.SUPER_TENANT_ID).getAuthorizationManager(); + + if (!userStoreManager.isExistingRole(DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN)) { + userStoreManager.addRole( + DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN, + null, + DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_ADMIN); + } else { + for (Permission permission : DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_ADMIN) { + authorizationManager.authorizeRole(DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN, + permission.getResourceId(), permission.getAction()); + } + } + if (!userStoreManager.isExistingRole(DeviceManagementConstants.User.DEFAULT_DEVICE_USER)) { + userStoreManager.addRole( + DeviceManagementConstants.User.DEFAULT_DEVICE_USER, + null, + DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_USER); + } else { + for (Permission permission : DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_USER) { + authorizationManager.authorizeRole(DeviceManagementConstants.User.DEFAULT_DEVICE_USER, + permission.getResourceId(), permission.getAction()); + } + } + userStoreManager.updateRoleListOfUser(tenantAdminName, null, + new String[]{DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN, + DeviceManagementConstants.User.DEFAULT_DEVICE_USER}); + + if (log.isDebugEnabled()) { + log.debug("Device management roles: " + DeviceManagementConstants.User.DEFAULT_DEVICE_USER + ", " + + DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN + " created for the tenant:" + tenantDomain + "." + ); + log.debug("Tenant administrator: " + tenantAdminName + "@" + tenantDomain + + " is assigned to the role:" + DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN + "." + ); + } + } catch (UserStoreException e) { + log.error("Error occurred while creating roles for the tenant: " + tenantDomain + "."); + } + } + + private void operationStatusChangeObserver () { + MetadataManagementService metadataManagementService = DeviceManagementDataHolder + .getInstance().getMetadataManagementService(); + OperationDAO operationDAO = OperationManagementDAOFactory.getOperationDAO(); + Metadata metadata; + int numOfRecordsUpdated; + try { + metadata = metadataManagementService.retrieveMetadata(OPERATION_CONFIG); + if (metadata != null) { + OperationConfig operationConfiguration = gson.fromJson(metadata.getMetaValue(), OperationConfig.class); + String[] deviceTypes = operationConfiguration.getDeviceTypes(); + String initialOperationStatus = operationConfiguration.getInitialOperationStatus(); + String requiredStatusChange = operationConfiguration.getRequiredStatusChange(); + + for (String deviceType : deviceTypes) { + try { + OperationManagementDAOFactory.beginTransaction(); + try { + numOfRecordsUpdated = operationDAO.updateOperationByDeviceTypeAndInitialStatus(deviceType, + initialOperationStatus, requiredStatusChange); + log.info(numOfRecordsUpdated + " operations updated successfully for the" + deviceType); + OperationManagementDAOFactory.commitTransaction(); + } catch (OperationManagementDAOException e) { + OperationManagementDAOFactory.rollbackTransaction(); + String msg = "Error occurred while updating operation status. DeviceType : " + deviceType + ", " + + "Initial operation status: " + initialOperationStatus + ", Required status:" + requiredStatusChange; + log.error(msg, e); + } + } catch (TransactionManagementException e) { + String msg = "Transactional error occurred while updating the operation status"; + log.error(msg, e); + } finally { + OperationManagementDAOFactory.closeConnection(); + } + } + } else { + log.info("Operation configuration not provided"); + } + } catch (MetadataManagementException e) { + String msg = "Error occurred while retrieving the operation configuration"; + log.error(msg, e); + } + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/UserRoleCreateObserver.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/UserRoleCreateObserver.java deleted file mode 100644 index f7b2a27a4b..0000000000 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/UserRoleCreateObserver.java +++ /dev/null @@ -1,89 +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.internal; - -import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.core.ServerStartupObserver; -import org.wso2.carbon.user.api.AuthorizationManager; -import org.wso2.carbon.user.api.Permission; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.api.UserStoreManager; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; - -public class UserRoleCreateObserver implements ServerStartupObserver { - private static final Log log = LogFactory.getLog(UserRoleCreateObserver.class); - @Override - public void completingServerStartup() { - - } - - @Override - public void completedServerStartup() { - String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; - - try { - UserStoreManager userStoreManager = - DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm( - MultitenantConstants.SUPER_TENANT_ID).getUserStoreManager(); - String tenantAdminName = - DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm( - MultitenantConstants.SUPER_TENANT_ID).getRealmConfiguration().getAdminUserName(); - AuthorizationManager authorizationManager = DeviceManagementDataHolder.getInstance().getRealmService() - .getTenantUserRealm(MultitenantConstants.SUPER_TENANT_ID).getAuthorizationManager(); - - if (!userStoreManager.isExistingRole(DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN)) { - userStoreManager.addRole( - DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN, - null, - DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_ADMIN); - } else { - for (Permission permission : DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_ADMIN) { - authorizationManager.authorizeRole(DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN, - permission.getResourceId(), permission.getAction()); - } - } - if (!userStoreManager.isExistingRole(DeviceManagementConstants.User.DEFAULT_DEVICE_USER)) { - userStoreManager.addRole( - DeviceManagementConstants.User.DEFAULT_DEVICE_USER, - null, - DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_USER); - } else { - for (Permission permission : DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_USER) { - authorizationManager.authorizeRole(DeviceManagementConstants.User.DEFAULT_DEVICE_USER, - permission.getResourceId(), permission.getAction()); - } - } - userStoreManager.updateRoleListOfUser(tenantAdminName, null, - new String[] {DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN, - DeviceManagementConstants.User.DEFAULT_DEVICE_USER}); - - if (log.isDebugEnabled()) { - log.debug("Device management roles: " + DeviceManagementConstants.User.DEFAULT_DEVICE_USER + ", " + - DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN + " created for the tenant:" + tenantDomain + "." - ); - log.debug("Tenant administrator: " + tenantAdminName + "@" + tenantDomain + - " is assigned to the role:" + DeviceManagementConstants.User.DEFAULT_DEVICE_ADMIN + "." - ); - } - } catch (UserStoreException e) { - log.error("Error occurred while creating roles for the tenant: " + tenantDomain + "."); - } - } -} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/DeviceStatusManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/DeviceStatusManagementServiceImpl.java index 1daea9fd24..c04e5deae8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/DeviceStatusManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/DeviceStatusManagementServiceImpl.java @@ -21,6 +21,7 @@ package io.entgra.device.mgt.core.device.mgt.core.metadata.mgt; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.AllowedDeviceStatus; @@ -35,6 +36,7 @@ import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManage import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.util.MetadataConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import java.lang.reflect.Type; import java.sql.SQLException; @@ -42,12 +44,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; - public class DeviceStatusManagementServiceImpl implements DeviceStatusManagementService { private static final Log log = LogFactory.getLog(DeviceStatusManagementServiceImpl.class); private final MetadataDAO metadataDAO; + private static final Gson gson = new Gson(); public DeviceStatusManagementServiceImpl() { this.metadataDAO = MetadataManagementDAOFactory.getMetadataDAO(); @@ -57,12 +59,11 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement public void addDefaultDeviceStatusFilterIfNotExist(int tenantId) throws MetadataManagementException { try { MetadataManagementDAOFactory.beginTransaction(); - if (!metadataDAO.isExist(tenantId, MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY) && !metadataDAO.isExist(tenantId, MetadataConstants.IS_DEVICE_STATUS_CHECK_META_KEY)) { - Metadata defaultDeviceStatusMetadata = constructDeviceStatusMetadata(getDefaultDeviceStatus()); - Metadata defaultDeviceStatusCheckMetadata = constructDeviceStatusCheckMetadata(getDefaultDeviceStatusCheck()); - // Add default device status and device status check metadata entries - addMetadataEntry(tenantId, defaultDeviceStatusMetadata, MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY); - addMetadataEntry(tenantId, defaultDeviceStatusCheckMetadata, MetadataConstants.IS_DEVICE_STATUS_CHECK_META_KEY); + if (!metadataDAO.isExist(tenantId, MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY)) { + metadataDAO.addMetadata(tenantId, constructDeviceStatusMetadata(getDefaultDeviceStatus())); + } + if (!metadataDAO.isExist(tenantId, MetadataConstants.IS_DEVICE_STATUS_CHECK_META_KEY)) { + metadataDAO.addMetadata(tenantId, constructDeviceStatusCheckMetadata(getDefaultDeviceStatusCheck())); } MetadataManagementDAOFactory.commitTransaction(); } catch (MetadataManagementDAOException e) { @@ -80,18 +81,38 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement } @Override - public void resetToDefaultDeviceStausFilter() throws MetadataManagementException { - + public void resetToDefaultDeviceStatusFilter() throws MetadataManagementException { + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + try { + MetadataManagementDAOFactory.beginTransaction(); + Metadata defaultDeviceStatusMetadata = constructDeviceStatusMetadata(getDefaultDeviceStatus()); + Metadata defaultDeviceStatusCheckMetadata = constructDeviceStatusCheckMetadata(getDefaultDeviceStatusCheck()); + // Add default device status and device status check metadata entries + metadataDAO.addMetadata(tenantId, defaultDeviceStatusMetadata); + metadataDAO.addMetadata(tenantId, defaultDeviceStatusCheckMetadata); + MetadataManagementDAOFactory.commitTransaction(); + } catch (MetadataManagementDAOException e) { + MetadataManagementDAOFactory.rollbackTransaction(); + String msg = "Error occurred while inserting default device status metadata entries."; + log.error(msg, e); + throw new MetadataManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error occurred while starting the transaction to reset default device status filters."; + log.error(msg, e); + throw new MetadataManagementException(msg, e); + } finally { + MetadataManagementDAOFactory.closeConnection(); + } } @Override - public void updateDefaultDeviceStatusFilters(int tenantId, String deviceType, List deviceStatus) throws MetadataManagementException { + public void updateDefaultDeviceStatusFilters(String deviceType, List deviceStatus) throws MetadataManagementException { + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); try { MetadataManagementDAOFactory.beginTransaction(); // Retrieve the current device status metadata Metadata metadata = metadataDAO.getMetadata(tenantId, MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY); if (metadata != null) { - Gson gson = new Gson(); Type listType = new TypeToken>() { }.getType(); List currentStatusList = gson.fromJson(metadata.getMetaValue(), listType); @@ -105,7 +126,7 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement } } metadata.setMetaValue(gson.toJson(currentStatusList)); - updateMetadataEntry(tenantId, metadata, MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY); + metadataDAO.updateMetadata(tenantId, metadata); } MetadataManagementDAOFactory.commitTransaction(); } catch (MetadataManagementDAOException e) { @@ -123,17 +144,16 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement } @Override - public boolean updateDefaultDeviceStatusCheck(int tenantId, boolean isChecked) throws MetadataManagementException { - boolean success = false; + public boolean updateDefaultDeviceStatusCheck(boolean isChecked) throws MetadataManagementException { + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); try { MetadataManagementDAOFactory.beginTransaction(); if (metadataDAO.isExist(tenantId, MetadataConstants.IS_DEVICE_STATUS_CHECK_META_KEY)) { - Metadata isDeviceStatusChecked = constructDeviceStatusCheckMetadata(isChecked); // Add default device status check metadata entries - updateMetadataEntry(tenantId, isDeviceStatusChecked, MetadataConstants.IS_DEVICE_STATUS_CHECK_META_KEY); - success = true; + metadataDAO.updateMetadata(tenantId, constructDeviceStatusCheckMetadata(isChecked)); + MetadataManagementDAOFactory.commitTransaction(); + return true; } - MetadataManagementDAOFactory.commitTransaction(); } catch (MetadataManagementDAOException e) { MetadataManagementDAOFactory.rollbackTransaction(); String msg = "Error occurred while updating device status check metadata entry."; @@ -146,19 +166,24 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement } finally { MetadataManagementDAOFactory.closeConnection(); } - return success; + return false; } @Override - public List getDeviceStatusFilters(int tenantId) throws MetadataManagementException { + public List getDeviceStatusFilters() throws MetadataManagementException { + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); try { MetadataManagementDAOFactory.openConnection(); Metadata metadata = metadataDAO.getMetadata(tenantId, MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY); - Gson gson = new Gson(); - Type listType = new TypeToken>() {}.getType(); - List statusList = gson.fromJson(metadata.getMetaValue(), listType); - - return statusList; + if (metadata == null) { + String msg = + "Couldn't find the meta data value for meta key: " + MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY; + log.error(msg); + throw new MetadataKeyNotFoundException(msg); + } + Type listType = new TypeToken>() { + }.getType(); + return gson.fromJson(metadata.getMetaValue(), listType); } catch (MetadataManagementDAOException e) { String msg = "Error occurred while retrieving device status meta data for tenant:" + tenantId; log.error(msg, e); @@ -173,12 +198,19 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement } - public List getDeviceStatusFilters(String deviceType, int tenantId) throws MetadataManagementException { + public List getDeviceStatusFilters(String deviceType) throws MetadataManagementException { + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); try { MetadataManagementDAOFactory.openConnection(); Metadata metadata = metadataDAO.getMetadata(tenantId, MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY); - Gson gson = new Gson(); - Type listType = new TypeToken>() {}.getType(); + if (metadata == null) { + String msg = "Couldn't find the meta details of meta Key: " + + MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY + " and tenant Id: " + tenantId; + log.error(msg); + throw new MetadataKeyNotFoundException(msg); + } + Type listType = new TypeToken>() { + }.getType(); List statusList = gson.fromJson(metadata.getMetaValue(), listType); for (AllowedDeviceStatus status : statusList) { @@ -207,6 +239,12 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement try { MetadataManagementDAOFactory.openConnection(); Metadata metadata = metadataDAO.getMetadata(tenantId, MetadataConstants.IS_DEVICE_STATUS_CHECK_META_KEY); + if (metadata == null) { + String msg = "Couldn't find the meta data value for meta key: " + + MetadataConstants.IS_DEVICE_STATUS_CHECK_META_KEY + " and tenant Id: " + tenantId; + log.error(msg); + throw new MetadataKeyNotFoundException(msg); + } String metaValue = metadata.getMetaValue(); return Boolean.parseBoolean(metaValue); } catch (MetadataManagementDAOException e) { @@ -227,8 +265,13 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement try { MetadataManagementDAOFactory.openConnection(); Metadata metadata = metadataDAO.getMetadata(tenantId, MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY); + if (metadata == null) { + String msg = "Couldn't find the meta data value for meta key: " + + MetadataConstants.ALLOWED_DEVICE_STATUS_META_KEY + " and tenant Id: " + tenantId; + log.error(msg); + throw new MetadataKeyNotFoundException(msg); + } - Gson gson = new Gson(); Type listType = new TypeToken>() { }.getType(); List statusList = gson.fromJson(metadata.getMetaValue(), listType); @@ -254,22 +297,13 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement } } - private void addMetadataEntry(int tenantId, Metadata metadata, String key) throws MetadataManagementDAOException { - metadataDAO.addMetadata(tenantId, metadata); - if (log.isDebugEnabled()) { - log.debug(key + " metadata entry has been inserted successfully"); - } - } - - private void updateMetadataEntry(int tenantId, Metadata metadata, String key) throws MetadataManagementDAOException { - metadataDAO.updateMetadata(tenantId, metadata); - if (log.isDebugEnabled()) { - log.debug(key + " metadata entry has been updated successfully"); - } - } - + /** + * To construct device status Meta data by using received device status items + * + * @param deviceStatusItems {@link List} + * @return {@link Metadata} + */ private Metadata constructDeviceStatusMetadata(List deviceStatusItems) { - Gson gson = new Gson(); String deviceStatusItemsJsonString = gson.toJson(deviceStatusItems); Metadata metadata = new Metadata(); @@ -279,6 +313,12 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement return metadata; } + /** + * To construct device status check Meta data to either enable it or disable it. + * + * @param deviceStatusCheck True or False + * @return {@link Metadata} + */ private Metadata constructDeviceStatusCheckMetadata(boolean deviceStatusCheck) { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("deviceStatusCheck", String.valueOf(deviceStatusCheck)); @@ -289,6 +329,11 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement return metadata; } + /** + * Get default list of device status items from the configuration. + * + * @return List of device status items + */ private List getDefaultDeviceStatus() { DeviceStatusConfigurations deviceStatusConfigurations = UIConfigurationManager.getInstance().getUIConfig().getDeviceStatusConfigurations(); List deviceStatusItems = new ArrayList<>(); @@ -305,6 +350,11 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement return deviceStatusItems; } + /** + * Get Default device status check from the configuration. + * + * @return default status check value, it will be either 'True' or 'False' + */ private boolean getDefaultDeviceStatusCheck() { DeviceStatusConfigurations deviceStatusConfigurations = UIConfigurationManager.getInstance().getUIConfig().getDeviceStatusConfigurations(); boolean deviceStatusCheck = false; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/WhiteLabelManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/WhiteLabelManagementServiceImpl.java index 4ade3adc82..7ceb88178d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/WhiteLabelManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/WhiteLabelManagementServiceImpl.java @@ -60,8 +60,53 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ private final MetadataDAO metadataDAO; - public WhiteLabelManagementServiceImpl() { + public WhiteLabelManagementServiceImpl() throws MetadataManagementException { this.metadataDAO = MetadataManagementDAOFactory.getMetadataDAO(); + initializeWhiteLabelThemes(); + } + + /** + * Initializes white label theme for a tenant by retrieving white label metadata and updating it if necessary. + * If the white label metadata is found and the DocUrl is missing,it updates the metadata with the default value + * for DocUrl. + * + * @throws MetadataManagementException if an error occurs while managing metadata or transactions. + */ + private void initializeWhiteLabelThemes() throws MetadataManagementException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + WhiteLabelTheme defaultTheme = getDefaultWhiteLabelTheme(); + Metadata whiteLabelMetadata = getWhiteLabelMetaData(tenantId); + if (whiteLabelMetadata != null) { + WhiteLabelTheme whiteLabelTheme = new Gson().fromJson(whiteLabelMetadata.getMetaValue(), + WhiteLabelTheme.class); + if (whiteLabelTheme.getDocUrl() == null) { + whiteLabelTheme.setDocUrl(defaultTheme.getDocUrl()); + Metadata updatedMetadata = constructWhiteLabelThemeMetadata(whiteLabelTheme); + try { + MetadataManagementDAOFactory.beginTransaction(); + metadataDAO.updateMetadata(tenantId, updatedMetadata); + MetadataManagementDAOFactory.commitTransaction(); + if (log.isDebugEnabled()) { + log.debug("WhiteLabel theme's DocUrl was missing and has been updated to the default value " + + "for tenant: " + tenantId); + } + } catch (MetadataManagementDAOException e) { + MetadataManagementDAOFactory.rollbackTransaction(); + String msg = "Error occurred while fetching white label metadata for tenant: " + tenantId; + log.error(msg, e); + throw new MetadataManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Transaction failed while updating white label theme for tenant: " + + tenantId; + log.error(msg, e); + throw new MetadataManagementException(msg, e); + } finally { + MetadataManagementDAOFactory.closeConnection(); + } + } + } else { + addDefaultWhiteLabelThemeIfNotExist(tenantId); + } } @Override @@ -126,9 +171,9 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ /** * Useful to get white label image file response from provided url */ - private FileResponse getImageFileResponseFromUrl(String url) throws IOException, NotFoundException { + private FileResponse getImageFileResponseFromUrl(String url) throws IOException, NotFoundException { FileResponse fileResponse = new FileResponse(); - try(CloseableHttpClient client = HttpClients.createDefault()) { + try (CloseableHttpClient client = HttpClients.createDefault()) { HttpGet imageGetRequest = new HttpGet(url); HttpResponse response = client.execute(imageGetRequest); InputStream imageStream = response.getEntity().getContent(); @@ -183,6 +228,16 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ WhiteLabelStorageUtil.deleteWhiteLabelImageForTenantIfExists(tenantId); } + /** + * Get default metaDataConfiguration DocUrl from config + */ + private String getDefaultDocUrl() { + MetaDataConfiguration metaDataConfiguration = DeviceConfigurationManager.getInstance(). + getDeviceManagementConfig().getMetaDataConfiguration(); + WhiteLabelConfiguration whiteLabelConfiguration = metaDataConfiguration.getWhiteLabelConfiguration(); + return whiteLabelConfiguration.getDocUrl(); + } + /** * Construct and return default whitelabel detail bean {@link WhiteLabelImage} */ @@ -193,11 +248,13 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ WhiteLabelImage logo = constructDefaultLogoImage(); WhiteLabelImage logoIcon = constructDefaultLogoIconImage(); WhiteLabelTheme defaultTheme = new WhiteLabelTheme(); + String docUrl = getDefaultDocUrl(); defaultTheme.setFooterText(footerText); defaultTheme.setAppTitle(appTitle); defaultTheme.setLogoImage(logo); defaultTheme.setLogoIconImage(logoIcon); defaultTheme.setFaviconImage(favicon); + defaultTheme.setDocUrl(docUrl); return defaultTheme; } @@ -338,9 +395,9 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ * those can be passed to this method in order to restore. * * @param existingFavicon existing favicon image file - * @param existingLogo existing logo image file + * @param existingLogo existing logo image file */ - private void restoreWhiteLabelImages(File existingFavicon, File existingLogo, File existingLogoIcon, int tenantId) + private void restoreWhiteLabelImages(File existingFavicon, File existingLogo, File existingLogoIcon, int tenantId) throws MetadataManagementException { WhiteLabelStorageUtil.deleteWhiteLabelImageForTenantIfExists(tenantId); if (existingFavicon != null) { @@ -359,7 +416,7 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ * For example if the provided white label image is of URL type it doesn't need to be stored * * @param whiteLabelImage image to be stored - * @param imageName (i.e: FAVICON) + * @param imageName (i.e: FAVICON) */ private void storeWhiteLabelImageIfRequired(WhiteLabelImageRequestPayload whiteLabelImage, WhiteLabelImage.ImageName imageName, int tenantId) @@ -386,6 +443,7 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ whiteLabelTheme.setLogoIconImage(logoIconImage); whiteLabelTheme.setFooterText(whiteLabelThemeCreateRequest.getFooterText()); whiteLabelTheme.setAppTitle(whiteLabelThemeCreateRequest.getAppTitle()); + whiteLabelTheme.setDocUrl(whiteLabelThemeCreateRequest.getDocUrl()); return whiteLabelTheme; } @@ -418,6 +476,38 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ return metadata; } + /** + * updates the given WhiteLabelTheme with default value for docUrl + * + * @param whiteLabelTheme the WhiteLabelTheme to be updated with defaults if necessary. + * @param tenantId the ID of the tenant whose metadata is being updated. + * @throws MetadataManagementException exception for an error occurs during the update or transaction commit. + */ + private void updateWhiteLabelThemeWithDefaults(WhiteLabelTheme whiteLabelTheme, int tenantId) + throws MetadataManagementException { + WhiteLabelTheme defaultTheme = getDefaultWhiteLabelTheme(); + if (whiteLabelTheme.getDocUrl() == null) { + whiteLabelTheme.setDocUrl(defaultTheme.getDocUrl()); + } + Metadata updatedMetadata = constructWhiteLabelThemeMetadata(whiteLabelTheme); + try { + MetadataManagementDAOFactory.beginTransaction(); + metadataDAO.updateMetadata(tenantId, updatedMetadata); + MetadataManagementDAOFactory.commitTransaction(); + } catch (MetadataManagementDAOException e) { + MetadataManagementDAOFactory.rollbackTransaction(); + String msg = "Error occurred while updating metadata for tenant: " + tenantId; + log.error(msg, e); + throw new MetadataManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error occurred while committing the transaction for tenant: " + tenantId; + log.error(msg, e); + throw new MetadataManagementException(msg, e); + } finally { + MetadataManagementDAOFactory.closeConnection(); + } + } + @Override public WhiteLabelTheme getWhiteLabelTheme(String tenantDomain) throws MetadataManagementException, DeviceManagementException { int tenantId = DeviceManagerUtil.getTenantId(tenantDomain); @@ -435,17 +525,22 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ throw new MetadataManagementException(msg); } } - return new Gson().fromJson(metadata.getMetaValue(), WhiteLabelTheme.class); + WhiteLabelTheme whiteLabelTheme = new Gson().fromJson(metadata.getMetaValue(), WhiteLabelTheme.class); + if (whiteLabelTheme.getDocUrl() == null) { + updateWhiteLabelThemeWithDefaults(whiteLabelTheme, tenantId); + } + return whiteLabelTheme; } /** * Load White label Meta Data for given tenant Id. + * * @param tenantId Id of the tenant * @return {@link Metadata} * @throws MetadataManagementException if an error occurred while getting Meta-Data info from Database for a - * given tenant ID. + * given tenant ID. */ - private Metadata getWhiteLabelMetaData (int tenantId) throws MetadataManagementException { + private Metadata getWhiteLabelMetaData(int tenantId) throws MetadataManagementException { try { MetadataManagementDAOFactory.openConnection(); return metadataDAO.getMetadata(tenantId, MetadataConstants.WHITELABEL_META_KEY); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/OperationConfigurationService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/OperationConfigurationService.java new file mode 100644 index 0000000000..522f406a7b --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/OperationConfigurationService.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2018 - 2024, 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.operation.change.status.task; + +import com.google.gson.Gson; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyAlreadyExistsException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyNotFoundException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; +import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.dto.OperationConfig; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigAlreadyExistsException; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigException; +import io.entgra.device.mgt.core.device.mgt.core.operation.change.status.task.exceptions.OperationConfigNotFoundException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class OperationConfigurationService { + + private static final Log log = LogFactory.getLog(OperationConfigurationService.class); + private static final Gson gson = new Gson(); + private static final String STRING = "STRING"; + private static final String OPERATION_CONFIG = "OPERATION_CONFIG"; + static MetadataManagementService metadataManagementService = DeviceManagementDataHolder.getInstance().getMetadataManagementService(); + + + public static OperationConfig getOperationConfig() throws OperationConfigException { + + Metadata metadata; + try { + metadata = metadataManagementService.retrieveMetadata(OPERATION_CONFIG); + } catch (MetadataManagementException e) { + String msg = "Error occurred while retrieving operation configuration"; + log.error(msg, e); + throw new OperationConfigException(msg, e); + } + if (metadata != null) { + return gson.fromJson(metadata.getMetaValue(), OperationConfig.class); + } else { + return null; + } + } + + public static void addOperationConfiguration(OperationConfig config) throws OperationConfigException, + OperationConfigAlreadyExistsException { + + Metadata metadata = new Metadata(); + metadata.setDataType(STRING); + metadata.setMetaKey(OPERATION_CONFIG); + metadata.setMetaValue(gson.toJson(config)); + + try { + metadataManagementService.createMetadata(metadata); + } catch (MetadataKeyAlreadyExistsException e) { + String msg = "Operation configuration already exists"; + log.error(msg, e); + throw new OperationConfigAlreadyExistsException(msg, e); + } catch (MetadataManagementException e) { + String msg = "Error occurred while adding operation configuration"; + log.error(msg, e); + throw new OperationConfigException(msg, e); + } + } + + public static void updateOperationConfiguration(OperationConfig config) throws OperationConfigException { + + Metadata metadata = new Metadata(); + metadata.setDataType(STRING); + metadata.setMetaKey(OPERATION_CONFIG); + metadata.setMetaValue(gson.toJson(config)); + + try { + metadataManagementService.updateMetadata(metadata); + } catch (MetadataManagementException e) { + String msg = "Error occurred while updating operation configuration"; + log.error(msg, e); + throw new OperationConfigException(msg, e); + } + } + + public static void deleteOperationConfiguration() throws OperationConfigException, OperationConfigNotFoundException { + + try { + metadataManagementService.deleteMetadata(OPERATION_CONFIG); + } catch (MetadataKeyNotFoundException e) { + String msg = "Operation configuration already exists"; + log.error(msg, e); + throw new OperationConfigNotFoundException(msg, e); + } catch (MetadataManagementException e) { + String msg = "Error occurred while deleting operation configuration"; + log.error(msg, e); + throw new OperationConfigException(msg, e); + } + } + +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/dto/OperationConfig.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/dto/OperationConfig.java new file mode 100644 index 0000000000..5e54e5f062 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/dto/OperationConfig.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2018 - 2024, 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.operation.change.status.task.dto; + +/** + * DTO for Operation configuration. + */ + +public class OperationConfig { + + private String[] deviceTypes; + private String initialOperationStatus; + private String requiredStatusChange; + + public String[] getDeviceTypes() { + return deviceTypes; + } + + public void setDeviceTypes(String[] deviceTypes) { + this.deviceTypes = deviceTypes; + } + + public String getInitialOperationStatus() { + return initialOperationStatus; + } + + public void setInitialOperationStatus(String initialOperationStatus) { + this.initialOperationStatus = initialOperationStatus; + } + + public String getRequiredStatusChange() { + return requiredStatusChange; + } + + public void setRequiredStatusChange(String requiredStatusChange) { + this.requiredStatusChange = requiredStatusChange; + } + +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/exceptions/OperationConfigAlreadyExistsException.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/exceptions/OperationConfigAlreadyExistsException.java new file mode 100644 index 0000000000..7bcc3b5f1b --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/exceptions/OperationConfigAlreadyExistsException.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2018 - 2024, 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.operation.change.status.task.exceptions; + +/** + * Custom exception class to be used in operation configuration service related functionalities. + */ +public class OperationConfigAlreadyExistsException extends Exception { + + private static final long serialVersionUID = -1814347544027733436L; + private String errorMessage; + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public OperationConfigAlreadyExistsException(String msg, Exception nestedEx) { + super(msg, nestedEx); + setErrorMessage(msg); + } + + public OperationConfigAlreadyExistsException(String message, Throwable cause) { + super(message, cause); + setErrorMessage(message); + } + + public OperationConfigAlreadyExistsException(String msg) { + super(msg); + setErrorMessage(msg); + } + + public OperationConfigAlreadyExistsException() { + super(); + } + + public OperationConfigAlreadyExistsException(Throwable cause) { + super(cause); + } + +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/exceptions/OperationConfigException.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/exceptions/OperationConfigException.java new file mode 100644 index 0000000000..863de5d48a --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/exceptions/OperationConfigException.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2018 - 2024, 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.operation.change.status.task.exceptions; + +/** + * Custom exception class to be used in operation configuration related functionalities. + */ +public class OperationConfigException extends Exception { + + private static final long serialVersionUID = -8933146283800122661L; + private String errorMessage; + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public OperationConfigException(String msg, Exception nestedEx) { + super(msg, nestedEx); + setErrorMessage(msg); + } + + public OperationConfigException(String message, Throwable cause) { + super(message, cause); + setErrorMessage(message); + } + + public OperationConfigException(String msg) { + super(msg); + setErrorMessage(msg); + } + + public OperationConfigException() { + super(); + } + + public OperationConfigException(Throwable cause) { + super(cause); + } + +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/exceptions/OperationConfigNotFoundException.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/exceptions/OperationConfigNotFoundException.java new file mode 100644 index 0000000000..c3e5cd0dc3 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/change/status/task/exceptions/OperationConfigNotFoundException.java @@ -0,0 +1,60 @@ +/* + * 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.operation.change.status.task.exceptions; + +/** + * Custom exception class to be used in Operation configuration related functionalities. + */ +public class OperationConfigNotFoundException extends Exception { + + private static final long serialVersionUID = 5260831982626354815L; + private String errorMessage; + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public OperationConfigNotFoundException(String msg, Exception nestedEx) { + super(msg, nestedEx); + setErrorMessage(msg); + } + + public OperationConfigNotFoundException(String message, Throwable cause) { + super(message, cause); + setErrorMessage(message); + } + + public OperationConfigNotFoundException(String msg) { + super(msg); + setErrorMessage(msg); + } + + public OperationConfigNotFoundException() { + super(); + } + + public OperationConfigNotFoundException(Throwable cause) { + super(cause); + } + +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java index c874283a76..60a64a0521 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java @@ -61,6 +61,9 @@ public interface OperationDAO { boolean updateOperationStatus(int enrolmentId, int operationId,Operation.Status status) throws OperationManagementDAOException; + int updateOperationByDeviceTypeAndInitialStatus(String deiceType, String initialStatus, String requiredStatus) + throws OperationManagementDAOException; + void updateEnrollmentOperationsStatus(int enrolmentId, String operationCode, Operation.Status existingStatus, Operation.Status newStatus) throws OperationManagementDAOException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index 50ec3f1071..3df2f41aac 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -128,6 +128,38 @@ public class GenericOperationDAOImpl implements OperationDAO { return isUpdated; } + public int updateOperationByDeviceTypeAndInitialStatus(String deiceType, String initialStatus, String requiredStatus) + throws OperationManagementDAOException { + int numOfRecordsUpdated; + long time = DeviceManagementDAOUtil.getCurrentUTCTime(); + + String sql = "UPDATE DM_ENROLMENT_OP_MAPPING SET STATUS=?, UPDATED_TIMESTAMP=? WHERE DEVICE_TYPE=?"; + + if (initialStatus == null) { + sql += " AND STATUS IS NULL"; + } else { + sql += " AND STATUS=?"; + } + + try ( + Connection connection = OperationManagementDAOFactory.getConnection(); + PreparedStatement stmt = connection.prepareStatement(sql) + ) { + stmt.setString(1, requiredStatus); + stmt.setLong(2, time); + stmt.setString(3, deiceType); + + if (initialStatus != null) { + stmt.setString(4, initialStatus); + } + numOfRecordsUpdated = stmt.executeUpdate(); + } catch (SQLException e) { + throw new OperationManagementDAOException("Error occurred while update device mapping operation status " + + e.getMessage(), e); + } + return numOfRecordsUpdated; + } + @Override public void updateEnrollmentOperationsStatus(int enrolmentId, String operationCode, Operation.Status existingStatus, Operation.Status newStatus) throws OperationManagementDAOException { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 8f64991934..902dcfee81 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -546,14 +546,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } int updatedRows = enrollmentDAO.updateEnrollment(device.getEnrolmentInfo(), tenantId); - boolean isEnableDeviceStatusCheck = deviceStatusManagementService.getDeviceStatusCheck(tenantId); - boolean isValidState = deviceStatusManagementService.isDeviceStatusValid(device.getType(), - device.getEnrolmentInfo().getStatus().name(),tenantId); - if (updatedRows == 1 && !deviceStatusManagementService.getDeviceStatusCheck(tenantId)){ - enrollmentDAO.addDeviceStatus(device.getEnrolmentInfo().getId(), device.getEnrolmentInfo().getStatus()); - } else if (updatedRows ==1 && isEnableDeviceStatusCheck && isValidState ) { - enrollmentDAO.addDeviceStatus(device.getEnrolmentInfo().getId(), device.getEnrolmentInfo().getStatus()); - } + addDeviceStatus(deviceStatusManagementService, tenantId, updatedRows, device.getEnrolmentInfo(), + device.getType()); DeviceManagementDAOFactory.commitTransaction(); log.info("Device enrollment modified successfully", @@ -672,13 +666,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv DeviceStatusManagementService deviceStatusManagementService = DeviceManagementDataHolder .getInstance().getDeviceStatusManagementService(); int updatedRows = enrollmentDAO.updateEnrollment(device.getEnrolmentInfo(), tenantId); - boolean isEnableDeviceStatusCheck = deviceStatusManagementService.getDeviceStatusCheck(tenantId); - boolean isValidState = deviceStatusManagementService.isDeviceStatusValid(device.getType(),device.getEnrolmentInfo().getStatus().name(),tenantId); - if (updatedRows == 1 && !deviceStatusManagementService.getDeviceStatusCheck(tenantId)){ - enrollmentDAO.addDeviceStatus(device.getEnrolmentInfo().getId(), device.getEnrolmentInfo().getStatus()); - } else if (updatedRows ==1 && isEnableDeviceStatusCheck && isValidState ) { - enrollmentDAO.addDeviceStatus(device.getEnrolmentInfo().getId(), device.getEnrolmentInfo().getStatus()); - } + addDeviceStatus(deviceStatusManagementService, tenantId, updatedRows, device.getEnrolmentInfo(), device.getType()); DeviceManagementDAOFactory.commitTransaction(); this.removeDeviceFromCache(deviceId); @@ -1176,50 +1164,57 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv public double generateCost(List allDevices, Timestamp startDate, Timestamp endDate, Cost tenantCost, List deviceStatusNotAvailable, double totalCost) throws DeviceManagementException { List deviceStatus; - for (Device device : allDevices) { - long dateDiff = 0; - deviceStatus = getDeviceStatusHistoryInsideTransaction(device, null, endDate, true); - if (device.getEnrolmentInfo().getDateOfEnrolment() < startDate.getTime()) { - if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") - || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { - if (deviceStatus.get(0).getUpdateTime().getTime() >= startDate.getTime()) { - dateDiff = deviceStatus.get(0).getUpdateTime().getTime() - startDate.getTime(); + try { + for (Device device : allDevices) { + long dateDiff = 0; + int tenantId = this.getTenantId(); + deviceStatus = deviceStatusDAO.getStatus(device.getId(), tenantId, null, endDate, true); + if (device.getEnrolmentInfo().getDateOfEnrolment() < startDate.getTime()) { + if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { + if (deviceStatus.get(0).getUpdateTime().getTime() >= startDate.getTime()) { + dateDiff = deviceStatus.get(0).getUpdateTime().getTime() - startDate.getTime(); + } + } else if (!deviceStatus.isEmpty() && (!String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + && !String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { + dateDiff = endDate.getTime() - startDate.getTime(); } - } else if (!deviceStatus.isEmpty() && (!String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") - && !String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { - dateDiff = endDate.getTime() - startDate.getTime(); - } - } else { - if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") - || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { - if (deviceStatus.get(0).getUpdateTime().getTime() >= device.getEnrolmentInfo().getDateOfEnrolment()) { - dateDiff = deviceStatus.get(0).getUpdateTime().getTime() - device.getEnrolmentInfo().getDateOfEnrolment(); + } else { + if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { + if (deviceStatus.get(0).getUpdateTime().getTime() >= device.getEnrolmentInfo().getDateOfEnrolment()) { + dateDiff = deviceStatus.get(0).getUpdateTime().getTime() - device.getEnrolmentInfo().getDateOfEnrolment(); + } + } else if (!deviceStatus.isEmpty() && (!String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") + && !String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { + dateDiff = endDate.getTime() - device.getEnrolmentInfo().getDateOfEnrolment(); } - } else if (!deviceStatus.isEmpty() && (!String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") - && !String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) { - dateDiff = endDate.getTime() - device.getEnrolmentInfo().getDateOfEnrolment(); } - } - // Convert dateDiff to days as a decimal value - double dateDiffInDays = (double) dateDiff / (24 * 60 * 60 * 1000); + // Convert dateDiff to days as a decimal value + double dateDiffInDays = (double) dateDiff / (24 * 60 * 60 * 1000); - if (dateDiffInDays % 1 >= 0.9) { - dateDiffInDays = Math.ceil(dateDiffInDays); - } + if (dateDiffInDays % 1 >= 0.9) { + dateDiffInDays = Math.ceil(dateDiffInDays); + } - long dateInDays = (long) dateDiffInDays; - double cost = 0; - if (tenantCost != null) { - cost = (tenantCost.getCost() / 365) * dateInDays; - } - totalCost += cost; - device.setCost(Math.round(cost * 100.0) / 100.0); - long totalDays = dateInDays + device.getDaysUsed(); - device.setDaysUsed((int) totalDays); - if (deviceStatus.isEmpty()) { - deviceStatusNotAvailable.add(device); + long dateInDays = (long) dateDiffInDays; + double cost = 0; + if (tenantCost != null) { + cost = (tenantCost.getCost() / 365) * dateInDays; + } + totalCost += cost; + device.setCost(Math.round(cost * 100.0) / 100.0); + long totalDays = dateInDays + device.getDaysUsed(); + device.setDaysUsed((int) totalDays); + if (deviceStatus.isEmpty()) { + deviceStatusNotAvailable.add(device); + } } + } catch (DeviceManagementDAOException e) { + String msg = "Error occurred in retrieving status history for a device in billing."; + log.error(msg, e); + throw new DeviceManagementException(msg, e); } return totalCost; } @@ -2233,33 +2228,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } } - /* - This is just to avoid breaking the billing functionality as it required to call getDeviceStatusHistory method - without transaction handling. - */ - private List getDeviceStatusHistoryInsideTransaction( - Device device, Date fromDate, Date toDate, boolean billingStatus) - throws DeviceManagementException { - if (log.isDebugEnabled()) { - log.debug("get status history of device: " + device.getDeviceIdentifier()); - } - try { - DeviceManagementDAOFactory.getConnection(); - int tenantId = this.getTenantId(); - return deviceStatusDAO.getStatus(device.getId(), tenantId, fromDate, toDate, billingStatus); - } catch (DeviceManagementDAOException e) { - String msg = "Error occurred in retrieving status history for device :" + device.getDeviceIdentifier(); - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } catch (SQLException e) { - String msg = "Error occurred while opening a connection to the data source"; - log.info(msg, e); - throw new DeviceManagementException(msg, e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - } - @Override public List getDeviceStatusHistory(Device device, Date fromDate, Date toDate, boolean billingStatus) throws DeviceManagementException { if (log.isDebugEnabled()) { @@ -3495,17 +3463,11 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv String type = deviceIdentifier.getType(); DeviceStatusManagementService deviceStatusManagementService = DeviceManagementDataHolder .getInstance().getDeviceStatusManagementService(); - DeviceManagementDAOFactory.commitTransaction(); if (updatedRows > 0) { isUpdatedEnrollment = true; } - boolean isEnableDeviceStatusCheck = deviceStatusManagementService.getDeviceStatusCheck(tenantId); - boolean isValidState = deviceStatusManagementService.isDeviceStatusValid(type, enrolmentInfo.getStatus().name(), tenantId); - if (updatedRows == 1 && !deviceStatusManagementService.getDeviceStatusCheck(tenantId)) { - enrollmentDAO.addDeviceStatus(enrolmentInfo.getId(), enrolmentInfo.getStatus()); - } else if (updatedRows == 1 && isEnableDeviceStatusCheck && isValidState) { - enrollmentDAO.addDeviceStatus(enrolmentInfo.getId(), enrolmentInfo.getStatus()); - } + addDeviceStatus(deviceStatusManagementService, tenantId, updatedRows, enrolmentInfo, type); + DeviceManagementDAOFactory.commitTransaction(); } catch (DeviceManagementDAOException e) { DeviceManagementDAOFactory.rollbackTransaction(); @@ -3523,6 +3485,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return isUpdatedEnrollment; } + /** + * Save the status according to status check(allowed device status) + * Before invoking this method the calling function should have started a transaction + * @param deviceStatusManagementService instance of deviceStatusManagementService + * @param tenantId ID of the tenant + * @param updatedRows number of updated rows + * @param enrolmentInfo enrollment info of the device + * @param type type of the device + */ + private void addDeviceStatus(DeviceStatusManagementService deviceStatusManagementService, int tenantId, + int updatedRows,EnrolmentInfo enrolmentInfo,String type) + throws MetadataManagementException, DeviceManagementDAOException { + boolean isEnableDeviceStatusCheck = deviceStatusManagementService.getDeviceStatusCheck(tenantId); + boolean isValidState = deviceStatusManagementService.isDeviceStatusValid(type, enrolmentInfo.getStatus().name(), tenantId); + if (updatedRows == 1 && (!isEnableDeviceStatusCheck || isValidState)) { + enrollmentDAO.addDeviceStatus(enrolmentInfo.getId(), enrolmentInfo.getStatus()); + } + } private int getTenantId() { return CarbonContext.getThreadLocalCarbonContext().getTenantId(); @@ -4543,13 +4523,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv DeviceStatusManagementService deviceStatusManagementService = DeviceManagementDataHolder .getInstance().getDeviceStatusManagementService(); int updatedRows = enrollmentDAO.updateEnrollment(device.getEnrolmentInfo(), tenantId); - boolean isEnableDeviceStatusCheck = deviceStatusManagementService.getDeviceStatusCheck(tenantId); - boolean isValidState = deviceStatusManagementService.isDeviceStatusValid(type, String.valueOf(EnrolmentInfo.Status.REMOVED),tenantId); - if (updatedRows == 1 && !deviceStatusManagementService.getDeviceStatusCheck(tenantId)){ - enrollmentDAO.addDeviceStatus(device.getEnrolmentInfo().getId(), device.getEnrolmentInfo().getStatus()); - } else if (updatedRows ==1 && isEnableDeviceStatusCheck && isValidState ) { - enrollmentDAO.addDeviceStatus(device.getEnrolmentInfo().getId(), device.getEnrolmentInfo().getStatus()); - } + addDeviceStatus(deviceStatusManagementService, tenantId, updatedRows, device.getEnrolmentInfo(), + type); } catch (DeviceManagementDAOException e) { DeviceManagementDAOFactory.rollbackTransaction(); String msg = "Error occurred while dis-enrolling device: " + diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java index 89af7b66b8..9750b7471e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java @@ -392,4 +392,13 @@ public interface GroupManagementProviderService { int getDeviceCount(String groupName) throws GroupManagementException; + /** + * Retrieves the count of devices for a specific group and device type. + * + * @param groupName the name of the group + * @param deviceTypeId the ID of the device type (e.g., Android, iOS, Windows) + * @return the count of devices for the given group and device type + * @throws GroupManagementException if an error occurs during the retrieval of the device count + */ + int getDeviceCountWithGroup(String groupName, int deviceTypeId) throws GroupManagementException; } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java index 1549b3c7b7..575f2b3fa1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -1746,4 +1746,23 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid GroupManagementDAOFactory.closeConnection(); } } + + @Override + public int getDeviceCountWithGroup(String groupName,int deviceTypeId) throws GroupManagementException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + try { + GroupManagementDAOFactory.openConnection(); + return groupDAO.getDeviceCountWithGroup(groupName,deviceTypeId, tenantId); + } catch (SQLException e) { + String msg = "SQL error occurred while retrieving device count."; + log.error(msg, e); + throw new GroupManagementException(msg, e); + } catch (GroupManagementDAOException e) { + String msg = "DAO error occurred while retrieving device count."; + log.error(msg, e); + throw new GroupManagementException(msg, e); + } finally { + GroupManagementDAOFactory.closeConnection(); + } + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagerUtil.java index 5ff2c15b6d..3965b1cc77 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagerUtil.java @@ -20,7 +20,7 @@ package io.entgra.device.mgt.core.device.mgt.core.util; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.MetaDataConfiguration; -import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.documentation.DocConfiguration; +import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.whitelabel.WhiteLabelConfiguration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpResponse; @@ -1289,7 +1289,7 @@ public final class DeviceManagerUtil { */ public static String getDocUrl() { DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); - DocConfiguration docConfiguration = deviceManagementConfig.getMetaDataConfiguration().getDocConfiguration(); - return docConfiguration.getDocUrl(); + WhiteLabelConfiguration whiteLabelConfig = deviceManagementConfig.getMetaDataConfiguration().getWhiteLabelConfiguration(); + return whiteLabelConfig.getDocUrl(); } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml index d12d30b401..54c7b59ae3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -160,9 +160,9 @@ BYOD,COPE - + https://docs.entgra.io/uem/6.0.0 - + diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/config/operation/mdm-ui-config.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/config/operation/mdm-ui-config.xml index 0b04668453..fe3674fac1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/config/operation/mdm-ui-config.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/config/operation/mdm-ui-config.xml @@ -343,7 +343,7 @@ and:ops:lock-devices and:ops:unlock-devices and:ops:location - and:ops:clear-password + and:ops:clear-pwd and:ops:control-camera and:ops:enterprise-wipe and:ops:wipe @@ -356,7 +356,7 @@ and:ops:send-app-restrictions and:ops:file-transfer and:ops:set-webclip - and:ops:password-policy + and:ops:pwd-policy and:ops:change-lock-code and:ops:upgrade-firmware and:ops:send-notif diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml index 2f7e1c60e4..c407639b3f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml @@ -22,15 +22,15 @@ device-mgt io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions bundle - WSO2 Carbon - Device Management Extensions - WSO2 Carbon - Device Management Extensions + Entgra Device Management - Device Management Extensions + Entgra Device Management - Device Management Extensions https://entgra.io @@ -185,21 +185,21 @@ com.google.gson;version="[2.9,3)", - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.general;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.invitation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.license.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.pull.notification;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.spi;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.type.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.general;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.invitation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.license.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.pull.notification;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.spi;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.type.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.service;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.device.mgt.extensions.device.type.template, io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config, io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao, @@ -207,7 +207,7 @@ io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.feature, io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.policy.mgt, io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.pull.notification, - io.entgra.device.mgt.core.device.mgt.extensions.logger;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.logger;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.device.mgt.extensions.spi, javax.naming, javax.sql, diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java index 1956962d08..82ca6b2082 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java @@ -68,6 +68,9 @@ public class HTTPDeviceTypeManagerService extends DeviceTypeManagerService imple if (feature.getCode() != null && feature.getName() != null) { configFeature.setCode(feature.getCode()); configFeature.setDescription(feature.getDescription()); + if (feature.getTooltip() != null) { + configFeature.setTooltip(feature.getTooltip()); + } configFeature.setName(feature.getName()); if (feature.getMetadataEntries() != null && feature.getMetadataEntries().size() > 0) { List metaValues = new ArrayList<>(); @@ -76,6 +79,29 @@ public class HTTPDeviceTypeManagerService extends DeviceTypeManagerService imple } configFeature.setMetaData(metaValues); } + if (feature.getConfirmationTexts() != null) { + List confirmationTextValues = new ArrayList<>(); + Feature.ConfirmationTexts confirmationText = feature.getConfirmationTexts(); + confirmationTextValues.add(confirmationText.getDeleteConfirmModalTitle()); + confirmationTextValues.add(confirmationText.getDeleteConfirmModalText()); + confirmationTextValues.add(confirmationText.getDeleteConfirmationTextDescribe()); + confirmationTextValues.add(confirmationText.getDeleteConfirmationText()); + confirmationTextValues.add(confirmationText.getCancelText()); + confirmationTextValues.add(confirmationText.getConfirmText()); + confirmationTextValues.add(confirmationText.getInputLabel()); + confirmationTextValues.add(confirmationText.getInputRequireMessage()); + configFeature.setConfirmationTexts(confirmationTextValues); + } + if (feature.getDangerZoneTooltipTexts() != null) { + List dangerZoneTextValues = new ArrayList<>(); + Feature.DangerZoneTooltipTexts dangerZoneText = feature.getDangerZoneTooltipTexts(); + dangerZoneTextValues.add(dangerZoneText.getToolTipTitle()); + dangerZoneTextValues.add(dangerZoneText.getToolTipPopConfirmText()); + dangerZoneTextValues.add(dangerZoneText.getConfirmText()); + dangerZoneTextValues.add(dangerZoneText.getCancelText()); + dangerZoneTextValues.add(dangerZoneText.getToolTipAvailable()); + configFeature.setDangerZoneTooltipTexts(dangerZoneTextValues); + } featureList.add(configFeature); } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/ConfirmationTexts.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/ConfirmationTexts.java new file mode 100644 index 0000000000..d3bf15f8e6 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/ConfirmationTexts.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2018 - 2024, 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.extensions.device.type.template.config; + + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "confirmationTexts", propOrder = { + "deleteConfirmModalTitle", + "deleteConfirmModalText", + "deleteConfirmationTextDescribe", + "deleteConfirmationText", + "cancelText", + "confirmText", + "inputLabel", + "inputRequireMessage" +}) +public class ConfirmationTexts { + + @XmlElement(name = "deleteConfirmModalTitle") + private String deleteConfirmModalTitle; + + @XmlElement(name = "deleteConfirmModalText") + private String deleteConfirmModalText; + + @XmlElement(name = "deleteConfirmationTextDescribe") + private String deleteConfirmationTextDescribe; + + @XmlElement(name = "deleteConfirmationText") + private String deleteConfirmationText; + + @XmlElement(name = "cancelText") + private String cancelText; + + @XmlElement(name = "confirmText") + private String confirmText; + + @XmlElement(name = "inputLabel") + private String inputLabel; + + @XmlElement(name = "inputRequireMessage") + private String inputRequireMessage; + + public String getCancelText() { + return cancelText; + } + + public void setCancelText(String cancelText) { + this.cancelText = cancelText; + } + + public String getInputRequireMessage() { + return inputRequireMessage; + } + + public void setInputRequireMessage(String inputRequireMessage) { + this.inputRequireMessage = inputRequireMessage; + } + + public String getInputLabel() { + return inputLabel; + } + + public void setInputLabel(String inputLabel) { + this.inputLabel = inputLabel; + } + + public String getConfirmText() { + return confirmText; + } + + public void setConfirmText(String confirmText) { + this.confirmText = confirmText; + } + + public String getDeleteConfirmModalTitle() { + return deleteConfirmModalTitle; + } + + public void setDeleteConfirmModalTitle(String deleteConfirmModalTitle) { + this.deleteConfirmModalTitle = deleteConfirmModalTitle; + } + + public String getDeleteConfirmModalText() { + return deleteConfirmModalText; + } + + public void setDeleteConfirmModalText(String deleteConfirmModalText) { + this.deleteConfirmModalText = deleteConfirmModalText; + } + + public String getDeleteConfirmationTextDescribe() { + return deleteConfirmationTextDescribe; + } + + public void setDeleteConfirmationTextDescribe(String deleteConfirmationTextDescribe) { + this.deleteConfirmationTextDescribe = deleteConfirmationTextDescribe; + } + + public String getDeleteConfirmationText() { + return deleteConfirmationText; + } + + public void setDeleteConfirmationText(String deleteConfirmationText) { + this.deleteConfirmationText = deleteConfirmationText; + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DangerZoneTooltipTexts.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DangerZoneTooltipTexts.java new file mode 100644 index 0000000000..2a38729c99 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DangerZoneTooltipTexts.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2018 - 2024, 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.extensions.device.type.template.config; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "dangerZoneTooltipTexts", propOrder = { + "toolTipTitle", + "toolTipPopConfirmText", + "confirmText", + "cancelText", + "toolTipAvailable" +}) +public class DangerZoneTooltipTexts { + + @XmlElement(name = "toolTipTitle") + private String toolTipTitle; + + @XmlElement(name = "toolTipPopConfirmText") + private String toolTipPopConfirmText; + + @XmlElement(name = "confirmText") + private String confirmText; + + @XmlElement(name = "cancelText") + private String cancelText; + + @XmlElement(name = "toolTipAvailable") + private String toolTipAvailable; + + public String getToolTipAvailable() { + return toolTipAvailable; + } + + public void setToolTipAvailable(String toolTipAvailable) { + this.toolTipAvailable = toolTipAvailable; + } + + public String getToolTipTitle() { + return toolTipTitle; + } + + public void setToolTipTitle(String toolTipTitle) { + this.toolTipTitle = toolTipTitle; + } + + public String getToolTipPopConfirmText() { + return toolTipPopConfirmText; + } + + public void setToolTipPopConfirmText(String toolTipPopConfirmText) { + this.toolTipPopConfirmText = toolTipPopConfirmText; + } + + public String getConfirmText() { + return confirmText; + } + + public void setConfirmText(String confirmText) { + this.confirmText = confirmText; + } + + public String getCancelText() { + return cancelText; + } + + public void setCancelText(String cancelText) { + this.cancelText = cancelText; + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java index 92797621fd..a8c32e621b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java @@ -45,8 +45,11 @@ import java.util.List; @XmlType(name = "Feature", propOrder = { "name", "description", + "tooltip", "operation", - "metaData" + "metaData", + "confirmationTexts", + "dangerZoneTooltipTexts" }) public class Feature { @@ -56,6 +59,9 @@ public class Feature { @XmlElement(name = "Description", required = true) protected String description; + @XmlElement(name = "Tooltip", required = false) + protected String tooltip; + @XmlElement(name = "Operation") protected Operation operation; @@ -69,6 +75,12 @@ public class Feature { @XmlElement(name = "Property", required = true) private List metaData; + @XmlElement(name = "ConfirmationTexts", required = false) + private List confirmationTexts; + + @XmlElement(name = "DangerZoneTooltipTexts", required = false) + private List dangerZoneTooltipTexts; + /** * Gets the value of the name property. * @@ -117,6 +129,31 @@ public class Feature { this.description = value; } + /** + * Gets the value of the tooltip property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTooltip() { + return tooltip; + } + + /** + * Sets the value of the tooltip property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTooltip(String value) { + this.tooltip = value; + } + + /** * Gets the value of the operation property. * @@ -180,4 +217,20 @@ public class Feature { public void setType(String type) { this.type = type; } + + public List getConfirmationTexts() { + return confirmationTexts; + } + + public void setConfirmationTexts(List confirmationTexts) { + this.confirmationTexts = confirmationTexts; + } + + public List getDangerZoneTooltipTexts() { + return dangerZoneTooltipTexts; + } + + public void setDangerZoneTooltipTexts(List dangerZoneTooltipTexts) { + this.dangerZoneTooltipTexts = dangerZoneTooltipTexts; + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Operation.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Operation.java index 289b89e8a0..e7c9275cd5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Operation.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Operation.java @@ -41,8 +41,10 @@ import javax.xml.bind.annotation.*; */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Operation", propOrder = { - "params", - "metadata" + "params", + "metadata", + "confirmationTexts", + "tooltipTexts" }) public class Operation { @@ -58,6 +60,28 @@ public class Operation { @XmlAttribute(name = "icon") private String icon; + @XmlElement(name = "tooltipTexts", required = false) + private DangerZoneTooltipTexts tooltipTexts; + + @XmlElement(name = "confirmationTexts", required = false) + private ConfirmationTexts confirmationTexts; + + public DangerZoneTooltipTexts getTooltipTexts() { + return tooltipTexts; + } + + public void setTooltipTexts(DangerZoneTooltipTexts tooltipTexts) { + this.tooltipTexts = tooltipTexts; + } + + public ConfirmationTexts getConfirmationTexts() { + return confirmationTexts; + } + + public void setConfirmationTexts(ConfirmationTexts confirmationTexts) { + this.confirmationTexts = confirmationTexts; + } + public Params getParams() { return params; } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java index 4db0d7d108..7b6a55e260 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java @@ -60,6 +60,9 @@ public class ConfigurationBasedFeatureManager implements FeatureManager { deviceFeature.setCode(feature.getCode()); deviceFeature.setName(feature.getName()); deviceFeature.setDescription(feature.getDescription()); + if (feature.getTooltip() != null) { + deviceFeature.setTooltip(feature.getTooltip()); + } deviceFeature.setType(feature.getType()); Operation operation = feature.getOperation(); List metadataEntries = null; @@ -113,7 +116,32 @@ public class ConfigurationBasedFeatureManager implements FeatureManager { operationMeta.put(UI_PARAMS, uiParams); operationMeta.put(FORM_PARAMS, formParams); } - + if (operation.getConfirmationTexts() != null) { + Feature.ConfirmationTexts confirmationTexts = new Feature.ConfirmationTexts(); + confirmationTexts.setDeleteConfirmModalTitle( + operation.getConfirmationTexts().getDeleteConfirmModalTitle()); + confirmationTexts.setDeleteConfirmModalText( + operation.getConfirmationTexts().getDeleteConfirmModalText()); + confirmationTexts.setDeleteConfirmationTextDescribe( + operation.getConfirmationTexts().getDeleteConfirmationTextDescribe()); + confirmationTexts.setDeleteConfirmationText( + operation.getConfirmationTexts().getDeleteConfirmationText()); + confirmationTexts.setCancelText(operation.getConfirmationTexts().getCancelText()); + confirmationTexts.setConfirmText(operation.getConfirmationTexts().getConfirmText()); + confirmationTexts.setInputLabel(operation.getConfirmationTexts().getInputLabel()); + confirmationTexts.setInputRequireMessage( + operation.getConfirmationTexts().getInputRequireMessage()); + deviceFeature.setConfirmationTexts(confirmationTexts); + } + if (operation.getTooltipTexts() != null) { + Feature.DangerZoneTooltipTexts tooltipTexts = new Feature.DangerZoneTooltipTexts(); + tooltipTexts.setToolTipTitle(operation.getTooltipTexts().getToolTipTitle()); + tooltipTexts.setToolTipPopConfirmText(operation.getTooltipTexts().getToolTipPopConfirmText()); + tooltipTexts.setConfirmText(operation.getTooltipTexts().getConfirmText()); + tooltipTexts.setCancelText(operation.getTooltipTexts().getCancelText()); + tooltipTexts.setToolTipAvailable(operation.getTooltipTexts().getToolTipAvailable()); + deviceFeature.setDangerZoneTooltipTexts(tooltipTexts); + } if (metadataEntries == null) { metadataEntries = new ArrayList<>(); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java index d86c15c118..c38701e111 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java @@ -107,13 +107,13 @@ public class MetaRepositoryBasedLicenseManager implements LicenseManager { } else { metadataManagementService.createMetadata(metadata); } - } catch (MetadataManagementException e) { - String msg = "Error occurred while saving the licence value in meta data repository"; + } catch (MetadataKeyAlreadyExistsException e) { + String msg = "Error occurred while saving the licence key and licence key exist.Licence Key: " + + licenceKey; log.error(msg, e); throw new LicenseManagementException(msg, e); - } catch (MetadataKeyAlreadyExistsException e) { - String msg = - "Error occurred while saving the licence key and licence key exist. Licence Key: " + licenceKey; + } catch (MetadataManagementException e) { + String msg = "Error occurred while saving the licence value in meta data repository"; log.error(msg, e); throw new LicenseManagementException(msg, e); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml index 0fc65c8a5d..36690a669c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml @@ -23,15 +23,15 @@ device-mgt io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.url.printer bundle - WSO2 Carbon - Device Management url printer - WSO2 Carbon - Device Management url printer + Entgra Device Management - Device Management url printer + Entgra Device Management - Device Management url printer https://entgra.io diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 1881c7f0ad..02403f68f6 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 device-mgt pom - WSO2 Carbon - Device Management Component + Entgra Device Management - Device Management Component https://entgra.io diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml index 1a44ac0544..e0fa9efd0c 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml @@ -17,21 +17,22 @@ ~ under the License. --> - + io.entgra.device.mgt.core heartbeat-management - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.server.bootup.heartbeat.beacon bundle - Entgra - Heartbeat Beacon - Entgra - Server Startup and Heartbeat Monitoring Component - http://www.entgra.io + Entgra Device Management - Heartbeat Beacon + Entgra Server Startup and Heartbeat Monitoring Component + https://entgra.io @@ -53,10 +54,11 @@ ${project.artifactId} ${io.entgra.device.mgt.core.version} Server Startup Heart Beat Beacon Bundle - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal + - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.server.bootup.heartbeat.beacon, io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config, io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.datasource, diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml index 7015a871d1..c8e1f9d4f1 100644 --- a/components/heartbeat-management/pom.xml +++ b/components/heartbeat-management/pom.xml @@ -17,20 +17,21 @@ ~ under the License. --> - + io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 heartbeat-management pom - Entgra - Task Allocation Framework - http://entgra.io + Entgra Device Management - Task Allocation Framework + https://entgra.io io.entgra.device.mgt.core.server.bootup.heartbeat.beacon diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml index e86a5947dc..3d0dde5be1 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core identity-extensions - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.oauth.extensions bundle - WSO2 Carbon - OAuth Extensions + Entgra Device Management - OAuth Extensions https://entgra.io diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml index 826280ae17..899434ada5 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core identity-extensions - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.identity.jwt.client.extension bundle - WSO2 Carbon - Device Management JWT Client Extensions - WSO2 Carbon - Device Management JWT Client Extensions + Entgra Device Management - Device Management JWT Client Extensions + Entgra Device Management - Device Management JWT Client Extensions https://entgra.io diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index ced68c877b..626cf97c0d 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 identity-extensions pom - WSO2 Carbon - Identity Extensions Component + Entgra Device Management - Identity Extensions Component https://entgra.io diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml index dcf1f39304..5a56856887 100644 --- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml +++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml @@ -23,11 +23,11 @@ io.entgra.device.mgt.core logger - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT io.entgra.device.mgt.core.notification.logger - Entgra - Notification Logger + Entgra Device Management - Notification Logger bundle http://entgra.io @@ -80,8 +80,8 @@ io.entgra.device.mgt.core.notification.logger, io.entgra.device.mgt.core.notification.logger.util, - io.entgra.device.mgt.core.device.mgt.extensions.logger;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.extensions.logger.spi;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.logger;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.extensions.logger.spi;version="${io.entgra.device.mgt.core.version.range}", org.slf4j, org.apache.commons.logging;version="[1.2,2)" diff --git a/components/logger/pom.xml b/components/logger/pom.xml index 97de565b35..8c4f741904 100644 --- a/components/logger/pom.xml +++ b/components/logger/pom.xml @@ -20,15 +20,15 @@ 4.0.0 - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml logger pom - Entgra - Notification Logger Component + Entgra Device Management - Notification Logger Component http://entgra.io diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml index 158daff9f5..6083a4ab51 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core operation-template-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.operation.template bundle - Entgra IoT - Operation Template Core - Entgra IoT - Operation Template Core + Entgra Device Management - Operation Template Core + Entgra Device Management - Operation Template Core http://entgra.io @@ -56,8 +56,8 @@ com.google.common.cache;version="[32.1,33)";resolution:=optional, com.google.gson;version="[2.9,3)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.service;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.operation.template.cache, io.entgra.device.mgt.core.operation.template.dao, io.entgra.device.mgt.core.operation.template.dao.impl, diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml index 9672e9df32..16f5356f2b 100644 --- a/components/operation-template-mgt/pom.xml +++ b/components/operation-template-mgt/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 operation-template-mgt pom - Entgra IoT - Operation Template Mgt Plugin + Entgra Device Management - Operation Template Mgt Plugin http://entgra.io diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml index 4c5d2b9fc1..e137e1e49a 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core policy-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.policy.decision.point bundle - WSO2 Carbon - Policy Decision Point - WSO2 Carbon - Policy Decision Point + Entgra Device Management - Policy Decision Point + Entgra Device Management - Policy Decision Point https://entgra.io @@ -54,13 +54,13 @@ Policy Decision Point Bundle io.entgra.device.mgt.core.policy.decision.point.internal - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.policy.decision.point.internal, io.entgra.device.mgt.core.policy.decision.point.merged, io.entgra.device.mgt.core.policy.decision.point.simple, - io.entgra.device.mgt.core.policy.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.policy.mgt.core;version="[5.0,6)", + io.entgra.device.mgt.core.policy.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.policy.mgt.core;version="${io.entgra.device.mgt.core.version.range}", org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml index 3e1678406c..3c3fc651be 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml @@ -29,8 +29,8 @@ 4.0.0 io.entgra.device.mgt.core.policy.information.point bundle - WSO2 Carbon - Policy Information Point - WSO2 Carbon - Policy Information Point + Entgra Device Management - Policy Information Point + Entgra Device Management - Policy Information Point https://entgra.io @@ -60,10 +60,10 @@ io.entgra.device.mgt.core.policy.information.point.* - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.policy.information.point, - io.entgra.device.mgt.core.policy.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.policy.mgt.common;version="${io.entgra.device.mgt.core.version.range}", org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}" diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml index 70346d54d1..ed94e7ccc6 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core policy-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.policy.mgt.common bundle - WSO2 Carbon - Policy Management Common - WSO2 Carbon - Policy Management Common + Entgra Device Management - Policy Management Common + Entgra Device Management - Policy Management Common https://entgra.io @@ -54,11 +54,11 @@ ${io.entgra.device.mgt.core.version} Policy Management Common Bundle - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.dto;version="[5.0,6)" + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.dto;version="${io.entgra.device.mgt.core.version.range}" io.entgra.device.mgt.core.policy.mgt.common.* diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml index ccfca465fd..4f0acc31ed 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core policy-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.policy.mgt.core bundle - WSO2 Carbon - Policy Management Core - WSO2 Carbon - Policy Management Core + Entgra Device Management - Policy Management Core + Entgra Device Management - Policy Management Core https://entgra.io @@ -56,22 +56,22 @@ io.entgra.device.mgt.core.policy.mgt.core.internal com.google.gson;version="[2.9,3)", - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config.policy;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config.tenant;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.dto;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.operation.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.task.impl;version="[5.0,6)", - io.entgra.device.mgt.core.policy.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.policy.mgt.common.monitor;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config.policy;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config.tenant;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.operation.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.service;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.task.impl;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.policy.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.policy.mgt.common.monitor;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.policy.mgt.core.cache, io.entgra.device.mgt.core.policy.mgt.core.cache.impl, io.entgra.device.mgt.core.policy.mgt.core.config, diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index f45e96501e..621b5e6d83 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 policy-mgt pom - WSO2 Carbon - Policy Management Component + Entgra Device Management - Policy Management Component https://entgra.io diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml index 6785609ff1..23d7cca0e9 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml @@ -20,15 +20,15 @@ io.entgra.device.mgt.core subtype-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.subtype.mgt - Entgra IoT - Subtype Mgt Impl + Entgra Device Management - Subtype Mgt Impl bundle - Entgra IoT - Subtype Management Component Implementation + Entgra Device Management - Subtype Management Component Implementation http://entgra.io @@ -55,10 +55,10 @@ com.fasterxml.jackson.core;version="[2.14,3)", com.google.common.cache;version="[32.1,33)";resolution:=optional, - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config.datasource;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config.datasource;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.service;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.subtype.mgt.cache, io.entgra.device.mgt.core.subtype.mgt.dao, io.entgra.device.mgt.core.subtype.mgt.dao.impl, diff --git a/components/subtype-mgt/pom.xml b/components/subtype-mgt/pom.xml index d67a6ffbd5..331e675a36 100644 --- a/components/subtype-mgt/pom.xml +++ b/components/subtype-mgt/pom.xml @@ -19,15 +19,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 subtype-mgt pom - Entgra IoT - Subtype Mgt + Entgra Device Management - Subtype Mgt http://entgra.io diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml index a6e832a947..ec125fccef 100755 --- a/components/task-mgt/pom.xml +++ b/components/task-mgt/pom.xml @@ -20,15 +20,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 task-mgt pom - Entgra IoT - Task Management Component + Entgra Device Management - Task Management Component http://entgra.io diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml index 3186715314..fda57bbdd6 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml @@ -20,15 +20,15 @@ task-manager io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.task.mgt.common bundle - Entgra IoT - Task Management Common - Entgra IoT - Task Management Common + Entgra Device Management - Task Management Common + Entgra Device Management - Task Management Common https://entgra.io diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml index f5629cc955..b27391b7e5 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core task-manager - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.task.mgt.core bundle - Entgra IoT - Task manager Core - Entgra IoT - Task manager Core + Entgra Device Management - Task manager Core + Entgra Device Management - Task manager Core http://entgra.io @@ -55,12 +55,12 @@ io.entgra.device.mgt.core.task.mgt.core.internal com.google.gson;version="[2.9,3)", - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception;version="[5.0,6)", - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;version="[5.0,6)", - io.entgra.device.mgt.core.task.mgt.common.bean;version="[5.0,6)", - io.entgra.device.mgt.core.task.mgt.common.exception;version="[5.0,6)", - io.entgra.device.mgt.core.task.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.task.mgt.common.bean;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.task.mgt.common.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.task.mgt.common.spi;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.task.mgt.core.config, io.entgra.device.mgt.core.task.mgt.core.config.datasource, io.entgra.device.mgt.core.task.mgt.core.dao, diff --git a/components/task-mgt/task-manager/pom.xml b/components/task-mgt/task-manager/pom.xml index 4169d327f4..2dc7d48b22 100755 --- a/components/task-mgt/task-manager/pom.xml +++ b/components/task-mgt/task-manager/pom.xml @@ -21,13 +21,13 @@ io.entgra.device.mgt.core task-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 task-manager - Entgra IoT - Task Manager Component + Entgra Device Management - Task Manager Component pom http://entgra.io diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml index cc3b6f2684..d30dae8547 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core task-watcher - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.task.mgt.watcher bundle - Entgra IoT - Task Watcher - Entgra IoT - Task Watcher + Entgra Device Management - Task Watcher + Entgra Device Management - Task Watcher http://entgra.io @@ -54,14 +54,14 @@ Task Watcher Bundle io.entgra.device.mgt.core.task.mgt.watcher.internal - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception;version="[5.0,6)", - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;version="[5.0,6)", - io.entgra.device.mgt.core.task.mgt.common.bean;version="[5.0,6)", - io.entgra.device.mgt.core.task.mgt.common.exception;version="[5.0,6)", - io.entgra.device.mgt.core.task.mgt.common.spi;version="[5.0,6)", - io.entgra.device.mgt.core.task.mgt.core.config;version="[5.0,6)", - io.entgra.device.mgt.core.task.mgt.core.util;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.task.mgt.common.bean;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.task.mgt.common.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.task.mgt.common.spi;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.task.mgt.core.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.task.mgt.core.util;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.task.mgt.watcher, io.entgra.device.mgt.core.task.mgt.watcher.internal, org.apache.commons.logging;version="[1.2,2)", diff --git a/components/task-mgt/task-watcher/pom.xml b/components/task-mgt/task-watcher/pom.xml index bf1051bfcc..cc95321e06 100755 --- a/components/task-mgt/task-watcher/pom.xml +++ b/components/task-mgt/task-watcher/pom.xml @@ -21,13 +21,13 @@ io.entgra.device.mgt.core task-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 task-watcher - Entgra IoT - Task Watcher Component + Entgra Device Management - Task Watcher Component pom http://entgra.io diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml index 20f7435708..d011a19404 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml @@ -20,14 +20,14 @@ tenant-mgt io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.tenant.mgt.common - Entgra IoT - Tenant Manager Common - Entgra IoT - Tenant Manager Common + Entgra Device Management - Tenant Manager Common + Entgra Device Management - Tenant Manager Common bundle diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml index 6347269f93..55257748f7 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml @@ -20,14 +20,14 @@ tenant-mgt io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.tenant.mgt.core - Entgra IoT - Tenant Manager Core - Entgra IoT - Tenant Manager Core + Entgra Device Management - Tenant Manager Core + Entgra Device Management - Tenant Manager Core bundle @@ -52,19 +52,19 @@ Tenant Management Core Bundle io.entgra.device.mgt.core.tenant.mgt.core.internal - io.entgra.device.mgt.core.application.mgt.common.exception;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.common.services;version="[5.0,6)", - io.entgra.device.mgt.core.application.mgt.core.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.roles.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.dao;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.metadata.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.tenant.mgt.common.exception;version="[5.0,6)", - io.entgra.device.mgt.core.tenant.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.common.services;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.application.mgt.core.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.roles.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.dao;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.metadata.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.tenant.mgt.common.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.tenant.mgt.common.spi;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.tenant.mgt.core, org.apache.commons.logging;version="[1.2,2)", org.osgi.framework;version="${imp.package.version.osgi.framework}", diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtServiceComponent.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtServiceComponent.java index 9bb4f9067c..58d2385868 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtServiceComponent.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtServiceComponent.java @@ -19,9 +19,7 @@ package io.entgra.device.mgt.core.tenant.mgt.core.internal; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelManagementService; -import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.WhiteLabelManagementServiceImpl; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.DeviceStatusManagementService; -import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.DeviceStatusManagementServiceImpl; import io.entgra.device.mgt.core.tenant.mgt.common.spi.TenantManagerAdminService; import io.entgra.device.mgt.core.tenant.mgt.common.spi.TenantManagerService; import io.entgra.device.mgt.core.tenant.mgt.core.TenantManager; @@ -56,14 +54,6 @@ public class TenantMgtServiceComponent { registerService(TenantManagerAdminService.class.getName(), tenantManagerAdminService, null); TenantManager tenantManager = new TenantManagerImpl(); TenantMgtDataHolder.getInstance().setTenantManager(tenantManager); - WhiteLabelManagementService whiteLabelManagementService = new WhiteLabelManagementServiceImpl(); - componentContext.getBundleContext().registerService(WhiteLabelManagementService.class.getName(), - whiteLabelManagementService, null); - TenantMgtDataHolder.getInstance().setWhiteLabelManagementService(whiteLabelManagementService); - DeviceStatusManagementService deviceStatusManagementService = new DeviceStatusManagementServiceImpl(); - componentContext.getBundleContext().registerService(DeviceStatusManagementService.class.getName(), - deviceStatusManagementService, null); - TenantMgtDataHolder.getInstance().setDeviceStatusManagementService(deviceStatusManagementService); DeviceMgtTenantListener deviceMgtTenantListener = new DeviceMgtTenantListener(); if(log.isDebugEnabled()) { log.info("Tenant management listener is registering"); @@ -85,6 +75,46 @@ public class TenantMgtServiceComponent { // nothing to do } + @Reference( + name = "whiteLabelManagement.service", + service = io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelManagementService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetWhiteLabelManagementService" + ) + protected void setWhiteLabelManagementService(WhiteLabelManagementService whiteLabelManagementService) { + if(log.isDebugEnabled()) { + log.info("WhiteLabelManagementService is binding"); + } + TenantMgtDataHolder.getInstance().setWhiteLabelManagementService(whiteLabelManagementService); + } + protected void unsetWhiteLabelManagementService(WhiteLabelManagementService whiteLabelManagementService) { + if(log.isDebugEnabled()) { + log.info("WhiteLabelManagementService is unbinding"); + } + TenantMgtDataHolder.getInstance().setWhiteLabelManagementService(null); + } + + @Reference( + name = "deviceStatusManagement.service", + service = io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.DeviceStatusManagementService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceStatusManagementService" + ) + protected void setDeviceStatusManagementService(DeviceStatusManagementService deviceStatusManagementService) { + if(log.isDebugEnabled()) { + log.info("DeviceStatusManagementService is binding"); + } + TenantMgtDataHolder.getInstance().setDeviceStatusManagementService(deviceStatusManagementService); + } + protected void unsetDeviceStatusManagementService(DeviceStatusManagementService deviceStatusManagementService) { + if(log.isDebugEnabled()) { + log.info("DeviceStatusManagementService is unbinding"); + } + TenantMgtDataHolder.getInstance().setDeviceStatusManagementService(null); + } + @Reference( name = "application.mgr", service = io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager.class, diff --git a/components/tenant-mgt/pom.xml b/components/tenant-mgt/pom.xml index cec5e7f315..e344e8158e 100644 --- a/components/tenant-mgt/pom.xml +++ b/components/tenant-mgt/pom.xml @@ -18,17 +18,17 @@ --> - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 tenant-mgt pom - Entgra IoT - Tenant Management Component - Entgra IoT - Tenant Management Component + Entgra Device Management - Tenant Management Component + Entgra Device Management - Tenant Management Component io.entgra.device.mgt.core.tenant.mgt.core diff --git a/components/test-coverage/pom.xml b/components/test-coverage/pom.xml index 7273a65793..d1cda60448 100644 --- a/components/test-coverage/pom.xml +++ b/components/test-coverage/pom.xml @@ -19,7 +19,7 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core 4.0.0-SNAPSHOT ../../pom.xml @@ -27,7 +27,7 @@ 4.0.0 test-coverage - WSO2 Carbon - Unit Test Coverage Generation + Entgra Device Management - Unit Test Coverage Generation target coverage-reports diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml index 3e713b580c..6dd1ba7ff5 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core email-sender - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.transport.mgt.email.sender.core bundle - WSO2 Carbon - Email Sender Core - WSO2 Carbon - Email Sender Core + Entgra Device Management - Email Sender Core + Entgra Device Management - Email Sender Core https://entgra.io diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml index 6b2855be0c..9768cc5df5 100644 --- a/components/transport-mgt/email-sender/pom.xml +++ b/components/transport-mgt/email-sender/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core transport-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 email-sender pom - WSO2 Carbon - Email Sender Component + Entgra Device Management - Email Sender Component https://entgra.io diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml index f70c86664a..f57e38740b 100644 --- a/components/transport-mgt/pom.xml +++ b/components/transport-mgt/pom.xml @@ -19,16 +19,16 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 transport-mgt pom - Entgra - Transport Management Component + Entgra Device Management - Transport Management Component http://entgra.io diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml index 57aba948bf..a9f9ab1dea 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core sms-handler - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.transport.mgt.sms.handler.api war - Entgra - SMS Handler API - Entgra - SMS Handler API + Entgra Device Management - SMS Handler API + Entgra Device Management - SMS Handler API http://entgra.io diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml index 5d0abfd980..b2e5e1a3e1 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core sms-handler - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.transport.mgt.sms.handler.common bundle - Entgra - SMS Handler Common - Entgra - SMS Handler Common + Entgra Device Management - SMS Handler Common + Entgra Device Management - SMS Handler Common http://entgra.io diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml index 3b98153af4..7a12df65bf 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core sms-handler - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.transport.mgt.sms.handler.core bundle - Entgra - SMS Handler Core - Entgra - SMS Handler Core + Entgra Device Management - SMS Handler Core + Entgra Device Management - SMS Handler Core http://entgra.io @@ -81,12 +81,12 @@ SMS Management Core Bundle io.entgra.device.mgt.core.transport.mgt.sms.handler.core.internal - io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.util;version="[5.0,6)", - io.entgra.device.mgt.core.transport.mgt.sms.handler.common.bean;version="[5.0,6)", - io.entgra.device.mgt.core.transport.mgt.sms.handler.common.config;version="[5.0,6)", - io.entgra.device.mgt.core.transport.mgt.sms.handler.common.exception;version="[5.0,6)", - io.entgra.device.mgt.core.transport.mgt.sms.handler.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.util;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.transport.mgt.sms.handler.common.bean;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.transport.mgt.sms.handler.common.config;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.transport.mgt.sms.handler.common.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.transport.mgt.sms.handler.common.spi;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.transport.mgt.sms.handler.core.config, javax.xml.bind;version="[0.0,1)", org.apache.commons.lang;version="[2.6,3)", diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml index 063ddaf4c8..0e77817355 100644 --- a/components/transport-mgt/sms-handler/pom.xml +++ b/components/transport-mgt/sms-handler/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core transport-mgt - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 sms-handler pom - Entgra - SMS Handler Component + Entgra Device Management - SMS Handler Component http://entgra.io diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml index a384b894fe..14756b652d 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml @@ -21,13 +21,13 @@ ui-request-interceptor io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT 4.0.0 io.entgra.device.mgt.core.ui.request.interceptor war - Entgra - Request Handling Proxy Servlet + Entgra Device Management - Request Handling Proxy Servlet Proxy Service for Request Handling in Entgra EMM/IOT Server. https://entgra.io diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/InvokerHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/InvokerHandler.java index e8ffb2deef..d561ace090 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/InvokerHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/InvokerHandler.java @@ -27,8 +27,10 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hc.core5.http.ClassicHttpRequest; +import org.apache.hc.core5.http.ContentType; import org.apache.hc.core5.http.HttpHeaders; import org.apache.hc.core5.http.HttpStatus; +import org.apache.hc.core5.http.io.entity.StringEntity; import org.apache.hc.core5.http.io.support.ClassicRequestBuilder; import javax.servlet.annotation.MultipartConfig; @@ -37,6 +39,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import java.io.BufferedReader; import java.io.IOException; @MultipartConfig @@ -183,9 +186,24 @@ public class InvokerHandler extends HttpServlet { @Override protected void doDelete(HttpServletRequest req, HttpServletResponse resp) { try { + String jsonPayload = null; + if (req.getContentLength() > 0) { + StringBuilder jsonBuilder = new StringBuilder(); + String line; + try (BufferedReader reader = req.getReader()) { + while ((line = reader.readLine()) != null) { + jsonBuilder.append(line); + } + } + jsonPayload = jsonBuilder.toString(); + } if (validateRequest(req, resp)) { ClassicHttpRequest deleteRequest = ClassicRequestBuilder.delete(HandlerUtil.generateBackendRequestURL(req, apiEndpoint)).build(); + if (jsonPayload != null && !jsonPayload.isEmpty()) { + StringEntity entity = new StringEntity(jsonPayload, ContentType.APPLICATION_JSON); + deleteRequest.setEntity(entity); + } HandlerUtil.copyRequestHeaders(req, deleteRequest, false); deleteRequest.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BEARER + authData.getAccessToken()); ProxyResponse proxyResponse = HandlerUtil.execute(deleteRequest); diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java index 6a97630e99..e699bc7675 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java @@ -37,6 +37,8 @@ import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.NameValuePair; import org.apache.hc.core5.http.io.support.ClassicRequestBuilder; import org.apache.hc.core5.http.message.BasicNameValuePair; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; @@ -44,6 +46,10 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Base64; @@ -61,6 +67,8 @@ public class LoginHandler extends HttpServlet { private static String uiConfigUrl; private static String iotCoreUrl; private static String kmManagerUrl; + private static String adminUsername; + private static String adminPassword; @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) { @@ -87,14 +95,14 @@ public class LoginHandler extends HttpServlet { LoginCache loginCache = HandlerUtil.getLoginCache(httpSession); OAuthAppCacheKey oAuthAppCacheKey = new OAuthAppCacheKey(applicationName, username); OAuthApp oAuthApp = loginCache.getOAuthAppCache(oAuthAppCacheKey); - if (oAuthApp == null) { + initializeAdminCredentials(); ArrayList supportedGrantTypes = new ArrayList<>(); supportedGrantTypes.add(HandlerConstants.PASSWORD_GRANT_TYPE); supportedGrantTypes.add(HandlerConstants.REFRESH_TOKEN_GRANT_TYPE); ClassicHttpRequest apiRegEndpoint = ClassicRequestBuilder.post(gatewayUrl + HandlerConstants.APP_REG_ENDPOINT) .setEntity(HandlerUtil.constructAppRegPayload(tags, applicationName, - username, password, null, supportedGrantTypes)) + adminUsername, adminPassword, null, supportedGrantTypes)) .setHeader(org.apache.hc.core5.http.HttpHeaders.CONTENT_TYPE, org.apache.hc.core5.http.ContentType.APPLICATION_JSON.toString()) .setHeader(org.apache.hc.core5.http.HttpHeaders.AUTHORIZATION, HandlerConstants.BASIC + Base64.getEncoder().encodeToString((username + HandlerConstants.COLON + password).getBytes())) @@ -143,6 +151,10 @@ public class LoginHandler extends HttpServlet { log.error("Error occurred while sending the response into the socket. ", e); } catch (JsonSyntaxException e) { log.error("Error occurred while parsing the response. ", e); + } catch (ParserConfigurationException e) { + log.error("Error while creating the document builder. "); + } catch (SAXException e) { + log.error("Error while parsing xml file. ", e); } catch (LoginException e) { log.error("Error occurred while getting token data. ", e); } @@ -251,4 +263,21 @@ public class LoginHandler extends HttpServlet { .build(); return HandlerUtil.execute(tokenEndpoint); } + + /** + * Initialize the admin credential variables + * + * @throws ParserConfigurationException - Throws when error occur during initializing the document builder + * @throws IOException - Throws when error occur during document parsing + * @throws SAXException - Throws when error occur during document parsing + */ + private void initializeAdminCredentials() throws ParserConfigurationException, IOException, SAXException { + File userMgtConf = new File("repository/conf/user-mgt.xml"); + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + Document doc = dBuilder.parse(userMgtConf); + + adminUsername = doc.getElementsByTagName("UserName").item(0).getTextContent(); + adminPassword = doc.getElementsByTagName("Password").item(0).getTextContent(); + } } diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java index 26c4be4201..98d8e42c64 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java @@ -104,6 +104,13 @@ public class HandlerUtil { final HttpEntity responseEntity = response.getEntity(); ProxyResponse handlerResponse = new ProxyResponse(); int statusCode = response.getCode(); + if (statusCode == 204) { + handlerResponse.setCode(statusCode); + handlerResponse.setStatus(ProxyResponse.Status.SUCCESS); + handlerResponse.setExecutorResponse("SUCCESS"); + handlerResponse.setHeaders(response.getHeaders()); + return handlerResponse; + } if (responseEntity == null) { log.error("Received null response for http request : " + httpRequest.getMethod() + " " + httpRequest.getRequestUri()); handlerResponse.setCode(HandlerConstants.INTERNAL_ERROR_CODE); diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml index deafa3edd0..849c3f6902 100644 --- a/components/ui-request-interceptor/pom.xml +++ b/components/ui-request-interceptor/pom.xml @@ -19,15 +19,15 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 ui-request-interceptor - Entgra - UI Request Interceptor Servlet + Entgra Device Management - UI Request Interceptor Servlet Proxy servlet to handle requests generated from UI applications to communicate with backend APIs diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml index c0ca459167..5da570acdc 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core webapp-authenticator-framework - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.webapp.authenticator.framework bundle - WSO2 Carbon - Web Application Authenticator Framework Bundle - WSO2 Carbon - Web Application Authenticator Framework Bundle + Entgra Device Management - Web Application Authenticator Framework Bundle + Entgra Device Management - Web Application Authenticator Framework Bundle https://entgra.io @@ -62,16 +62,16 @@ com.nimbusds.jose;version="[7.9,8)", com.nimbusds.jose.crypto;version="[7.9,8)", com.nimbusds.jwt;version="[7.9,8)", - io.entgra.device.mgt.core.certificate.mgt.core.dto;version="[5.0,6)", - io.entgra.device.mgt.core.certificate.mgt.core.exception;version="[5.0,6)", - io.entgra.device.mgt.core.certificate.mgt.core.scep;version="[5.0,6)", - io.entgra.device.mgt.core.certificate.mgt.core.service;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.common.spi;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="[5.0,6)", - io.entgra.device.mgt.core.device.mgt.core.util;version="[5.0,6)", + io.entgra.device.mgt.core.certificate.mgt.core.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.certificate.mgt.core.exception;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.certificate.mgt.core.scep;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.certificate.mgt.core.service;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.common.spi;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="${io.entgra.device.mgt.core.version.range}", + io.entgra.device.mgt.core.device.mgt.core.util;version="${io.entgra.device.mgt.core.version.range}", io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth, io.entgra.device.mgt.core.webapp.authenticator.framework.authorizer, io.entgra.device.mgt.core.webapp.authenticator.framework.config, diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Constants.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Constants.java index 3a62f2f3eb..e38bb76412 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Constants.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Constants.java @@ -32,6 +32,9 @@ public final class Constants { public static final String HEADER_HTTP_ACCEPT = "Accept"; public static final String HEADER_HTTP_AUTHORIZATION = "Authorization"; public static final String ONE_TIME_TOKEN_HEADER = "one-time-token"; + public static final String MUTUAL_AUTH_HEADER = "mutual-auth-header"; + public static final String PROXY_MUTUAL_AUTH_HEADER = "proxy-mutual-auth-header"; + public static final String CERTIFICATE_VERIFICATION_HEADER = "Mdm-Signature"; } public static final class ContentTypes { @@ -53,4 +56,12 @@ public final class Constants { public static final String DELETE = "delete"; public static final String ACTION = "action"; } + + public static final class Certificate { + private Certificate() { + throw new AssertionError(); + } + + public static final String ORGANIZATION_ATTRIBUTE = "O="; + } } diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Utils/Utils.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Utils/Utils.java index 014b2fffed..e93c8009c9 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Utils/Utils.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Utils/Utils.java @@ -18,6 +18,12 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.Utils; +import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPException; +import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPManager; +import io.entgra.device.mgt.core.certificate.mgt.core.scep.TenantedDeviceWrapper; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; +import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationException; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; @@ -26,6 +32,7 @@ import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oa import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthValidationResponse; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthValidatorFactory; import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -34,6 +41,7 @@ import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; +import java.security.cert.X509Certificate; import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -151,10 +159,60 @@ public class Utils { String sysPropertyName = matchPattern.group(1); String sysPropertyValue = System.getProperty(sysPropertyName); if (sysPropertyValue != null && !sysPropertyName.isEmpty()) { - urlWithPlaceholders = urlWithPlaceholders.replaceAll("\\$\\{(" + sysPropertyName + ")\\}", sysPropertyValue); + urlWithPlaceholders = urlWithPlaceholders.replaceAll("\\$\\{(" + sysPropertyName + ")\\}", + sysPropertyValue); } } return urlWithPlaceholders; } + /** + * Returns the value of the given attribute from the subject distinguished name. eg: "entgra.net" + * from "CN=entgra.net" + * @param requestCertificate {@link X509Certificate} that needs to extract an attribute from + * @param attribute the attribute name that needs to be extracted from the cert. eg: "CN=" + * @return the value of the attribute + */ + public static String getSubjectDnAttribute(X509Certificate requestCertificate, String attribute) { + String distinguishedName = requestCertificate.getSubjectDN().getName(); + if (StringUtils.isNotEmpty(distinguishedName)) { + String[] dnSplits = distinguishedName.split(","); + for (String dnSplit : dnSplits) { + if (dnSplit.contains(attribute)) { + String[] cnSplits = dnSplit.split("="); + if (StringUtils.isNotEmpty(cnSplits[1])) { + return cnSplits[1]; + } + } + } + } + return null; + } + + /** + * Check if the device identifier is valid and set the authentication info such as the tenant domain, + * tenant id and username of the enrolled device. + * @param deviceIdentifier {@link DeviceIdentifier} containing device id and type + * @param authenticationInfo {@link AuthenticationInfo} containing tenant and user details + * @throws SCEPException if the device or tenant does not exist + */ + public static void validateScepDevice(DeviceIdentifier deviceIdentifier, AuthenticationInfo authenticationInfo) + throws SCEPException { + SCEPManager scepManager = AuthenticatorFrameworkDataHolder.getInstance().getScepManager(); + TenantedDeviceWrapper tenantedDeviceWrapper = scepManager.getValidatedDevice(deviceIdentifier); + authenticationInfo.setTenantDomain(tenantedDeviceWrapper.getTenantDomain()); + authenticationInfo.setTenantId(tenantedDeviceWrapper.getTenantId()); + + // To make sure the tenant flow is not initiated in the valve as the + // tenant flows are initiated at the API level on iOS + if (deviceIdentifier.getType().equals(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS)) { + authenticationInfo.setTenantId(-1); + } + + if (tenantedDeviceWrapper.getDevice() != null && + tenantedDeviceWrapper.getDevice().getEnrolmentInfo() != null) { + EnrolmentInfo enrolmentInfo = tenantedDeviceWrapper.getDevice().getEnrolmentInfo(); + authenticationInfo.setUsername(enrolmentInfo.getOwner()); + } + } } diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValve.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValve.java index 8b430ba012..3f4ce9f9fc 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValve.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValve.java @@ -94,6 +94,16 @@ public class WebappAuthenticationValve extends CarbonTomcatValve { return; } AuthenticationInfo authenticationInfo = authenticator.authenticate(request, response); + + // If the request header contains 'Mdm-Signature', then it is a iOS or Windows device trying to sync and + // it is already authenticated from the CertificateAuthenticator. Hence, there is no need to check + // if the user associated with the device has permission. + if (request.getHeader(Constants.HTTPHeaders.CERTIFICATE_VERIFICATION_HEADER) != null && + authenticationInfo.getStatus() == WebappAuthenticator.Status.SUCCESS) { + this.getNext().invoke(request, response, compositeValve); + return; + } + if (isManagedAPI(request) && (authenticationInfo.getStatus() == WebappAuthenticator.Status.CONTINUE || authenticationInfo.getStatus() == WebappAuthenticator.Status.SUCCESS)) { WebappAuthenticator.Status status = WebappTenantAuthorizer.authorize(request, authenticationInfo); diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java index cb9bf50215..1df91c7c30 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java @@ -21,13 +21,11 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPException; -import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPManager; -import io.entgra.device.mgt.core.certificate.mgt.core.scep.TenantedDeviceWrapper; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationException; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; +import io.entgra.device.mgt.core.webapp.authenticator.framework.Constants; import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.Utils; import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; import org.apache.catalina.connector.Request; @@ -45,9 +43,6 @@ public class CertificateAuthenticator implements WebappAuthenticator { private static final Log log = LogFactory.getLog(CertificateAuthenticator.class); private static final String CERTIFICATE_AUTHENTICATOR = "CertificateAuth"; - private static final String MUTUAL_AUTH_HEADER = "mutual-auth-header"; - private static final String PROXY_MUTUAL_AUTH_HEADER = "proxy-mutual-auth-header"; - private static final String CERTIFICATE_VERIFICATION_HEADER = "Mdm-Signature"; private static final String CLIENT_CERTIFICATE_ATTRIBUTE = "javax.servlet.request.X509Certificate"; @Override @@ -57,8 +52,9 @@ public class CertificateAuthenticator implements WebappAuthenticator { @Override public boolean canHandle(Request request) { - return request.getHeader(CERTIFICATE_VERIFICATION_HEADER) != null - || request.getHeader(MUTUAL_AUTH_HEADER) != null || request.getHeader(PROXY_MUTUAL_AUTH_HEADER) != null; + return request.getHeader(Constants.HTTPHeaders.CERTIFICATE_VERIFICATION_HEADER) != null + || request.getHeader(Constants.HTTPHeaders.MUTUAL_AUTH_HEADER) != null || + request.getHeader(Constants.HTTPHeaders.PROXY_MUTUAL_AUTH_HEADER) != null; } @Override @@ -73,12 +69,14 @@ public class CertificateAuthenticator implements WebappAuthenticator { try { // When there is a load balancer terminating mutual SSL, it should pass this header along and // as the value of this header, the client certificate subject dn should be passed. - if (request.getHeader(PROXY_MUTUAL_AUTH_HEADER) != null) { + if (request.getHeader(Constants.HTTPHeaders.PROXY_MUTUAL_AUTH_HEADER) != null) { if (log.isDebugEnabled()) { - log.debug("PROXY_MUTUAL_AUTH_HEADER " + request.getHeader(PROXY_MUTUAL_AUTH_HEADER)); + log.debug("PROXY_MUTUAL_AUTH_HEADER " + + request.getHeader(Constants.HTTPHeaders.PROXY_MUTUAL_AUTH_HEADER)); } CertificateResponse certificateResponse = AuthenticatorFrameworkDataHolder.getInstance(). - getCertificateManagementService().verifySubjectDN(request.getHeader(PROXY_MUTUAL_AUTH_HEADER)); + getCertificateManagementService().verifySubjectDN(request.getHeader( + Constants.HTTPHeaders.PROXY_MUTUAL_AUTH_HEADER)); authenticationInfo = checkCertificateResponse(certificateResponse); if (log.isDebugEnabled()) { log.debug("Certificate Serial : " + certificateResponse.getSerialNumber() @@ -86,7 +84,7 @@ public class CertificateAuthenticator implements WebappAuthenticator { + " , username" + authenticationInfo.getUsername()); } } - else if (request.getHeader(MUTUAL_AUTH_HEADER) != null) { + else if (request.getHeader(Constants.HTTPHeaders.MUTUAL_AUTH_HEADER) != null) { Object object = request.getAttribute(CLIENT_CERTIFICATE_ATTRIBUTE); X509Certificate[] clientCertificate = null; if (object instanceof X509Certificate[]) { @@ -101,13 +99,11 @@ public class CertificateAuthenticator implements WebappAuthenticator { authenticationInfo.setStatus(Status.FAILURE); authenticationInfo.setMessage("No client certificate is present"); } - } else if (request.getHeader(CERTIFICATE_VERIFICATION_HEADER) != null) { - String certHeader = request.getHeader(CERTIFICATE_VERIFICATION_HEADER); + } else if (request.getHeader(Constants.HTTPHeaders.CERTIFICATE_VERIFICATION_HEADER) != null) { + String certHeader = request.getHeader(Constants.HTTPHeaders.CERTIFICATE_VERIFICATION_HEADER); if (certHeader != null && AuthenticatorFrameworkDataHolder.getInstance().getCertificateManagementService(). verifySignature(certHeader)) { - AuthenticatorFrameworkDataHolder.getInstance().getCertificateManagementService(). - extractCertificateFromSignature(certHeader); X509Certificate certificate = AuthenticatorFrameworkDataHolder.getInstance().getCertificateManagementService(). extractCertificateFromSignature(certHeader); @@ -116,30 +112,37 @@ public class CertificateAuthenticator implements WebappAuthenticator { if (challengeToken != null) { challengeToken = challengeToken.substring(challengeToken.indexOf("(") + 1).trim(); - SCEPManager scepManager = AuthenticatorFrameworkDataHolder.getInstance().getScepManager(); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(challengeToken); deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS); - TenantedDeviceWrapper tenantedDeviceWrapper = scepManager.getValidatedDevice(deviceIdentifier); - authenticationInfo.setTenantDomain(tenantedDeviceWrapper.getTenantDomain()); - // To make sure the tenant flow is not initiated in the valve as the - // tenant flows are initiated at the API level on iOS - authenticationInfo.setTenantId(-1); - - if (tenantedDeviceWrapper.getDevice() != null && - tenantedDeviceWrapper.getDevice().getEnrolmentInfo() != null) { - - EnrolmentInfo enrolmentInfo = tenantedDeviceWrapper.getDevice().getEnrolmentInfo(); - authenticationInfo.setUsername(enrolmentInfo.getOwner()); - } + Utils.validateScepDevice(deviceIdentifier, authenticationInfo); authenticationInfo.setStatus(Status.CONTINUE); + } else { + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + String deviceId = Utils.getSubjectDnAttribute(certificate, + Constants.Certificate.ORGANIZATION_ATTRIBUTE); + if (deviceId == null) { + authenticationInfo.setStatus(Status.FAILURE); + return authenticationInfo; + } + deviceIdentifier.setId(deviceId); + deviceIdentifier.setType( + DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); + Utils.validateScepDevice(deviceIdentifier, authenticationInfo); + authenticationInfo.setStatus(Status.SUCCESS); } } } } catch (KeystoreException e) { - log.error("KeystoreException occurred ", e); + String msg = "Error occurred while validating device client certificate."; + log.error(msg, e); + authenticationInfo.setStatus(Status.FAILURE); + authenticationInfo.setMessage(msg); } catch (SCEPException e) { - log.error("SCEPException occurred ", e); + String msg = "Error occurred while validating device identification."; + log.error(msg, e); + authenticationInfo.setStatus(Status.FAILURE); + authenticationInfo.setMessage(msg); } return authenticationInfo; } diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java index c9bf8974a7..c274184e55 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java @@ -139,9 +139,7 @@ public class PermissionAuthorizer { } else { return WebappAuthenticator.Status.FAILURE; } - } - } diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 3fd0427bb6..a22657144e 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -21,8 +21,8 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework pom - WSO2 Carbon - Webapp Authenticator Framework + Entgra Device Management - Webapp Authenticator Framework https://entgra.io diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml index 06aa865282..4266167831 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature pom - Entgra - Grafana Proxy API Feature + Entgra Device Management - Grafana Proxy API Feature https://entgra.io This feature contains the APIs required for Grafana diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml index 668d4489ea..2bda622bac 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature pom - Entgra - Grafana Management Server Feature + Entgra Device Management - Grafana Management Server Feature https://entgra.io This feature contains the core bundles required for Back-end Grafana Management functionality diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml index 2699aa3c41..1817298702 100644 --- a/features/analytics-mgt/grafana-mgt/pom.xml +++ b/features/analytics-mgt/grafana-mgt/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core analytics-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 grafana-mgt-feature pom - Entgra - Grafana Management Feature + Entgra Device Management - Grafana Management Feature http://entgra.io diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml index e70f4c5593..198eeb62f2 100644 --- a/features/analytics-mgt/pom.xml +++ b/features/analytics-mgt/pom.xml @@ -19,16 +19,16 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 analytics-mgt-feature pom - Entgra - Analytics Management Feature + Entgra Device Management - Analytics Management Feature http://entgra.io diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml index 49792aa682..528f494156 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml @@ -20,14 +20,14 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.analytics.extension.feature pom - Entgra - APIM Analytics Extension Feature + Entgra Device Management - APIM Analytics Extension Feature http://entgra.io diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml index e376ed1fb7..0d0cf6d35d 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml @@ -21,14 +21,14 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.application.extension.feature pom - WSO2 Carbon - API Management Application Extension Feature + Entgra Device Management - API Management Application Extension Feature https://entgra.io This feature contains an implementation of a api application registration, which takes care of subscription and generating keys. diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml index 50f93a4051..dfd16e74ca 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.extension.rest.api.feature pom - Entgra - API management REST API feature + Entgra Device Management - API management REST API feature This feature contains an implementation of API manager REST API extension http://entgra.io diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml index a4cc71f07e..4f70694ab7 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml @@ -21,14 +21,14 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.keymgt.extension.feature pom - WSO2 Carbon - Api Key Mgt Extensions Feature + Entgra Device Management - Api Key Mgt Extensions Feature https://entgra.io This feature contains apimgt related key management extensions diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml index 09b90bc4ae..902aa5a801 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml @@ -21,14 +21,14 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.apimgt.webapp.publisher.feature pom - WSO2 Carbon - API Management Webapp Publisher Feature + Entgra Device Management - API Management Webapp Publisher Feature https://entgra.io This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing JAX-RS web applications as 'Managed APIs' diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index b30032892c..3906798627 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -21,8 +21,8 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature pom - WSO2 Carbon - API Management Extensions Feature + Entgra Device Management - API Management Extensions Feature https://entgra.io diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml index 6170579a5d..0552864649 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core application-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.application.mgt.server.feature pom - Entgra - Application Management Server Feature + Entgra Device Management - Application Management Server Feature https://entgra.io This feature contains the core bundles required for Back-end Application Management functionality diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index 302bdfaab1..fc57f53c78 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 application-mgt-feature pom - WSO2 Carbon - Application Management Feature + Entgra Device Management - Application Management Feature https://entgra.io diff --git a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml index 2b79de5c78..c84bca9b9e 100644 --- a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml +++ b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core cea-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.cea.mgt.admin.api.feature - Entgra IoT - CEA Management Admin API Feature - Entgra IoT - Conditional Email Access Management Admin API Feature + Entgra Device Management - CEA Management Admin API Feature + Entgra Device Management - Conditional Email Access Management Admin API Feature diff --git a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml index dceaa6269d..bdbad54f23 100644 --- a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml +++ b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core cea-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.cea.mgt.server.feature - Entgra IoT - CEA Management Server Feature - Entgra IoT - Conditional Email Access Management Server Feature + Entgra Device Management - CEA Management Server Feature + Entgra Device Management - Conditional Email Access Management Server Feature diff --git a/features/cea-mgt-feature/pom.xml b/features/cea-mgt-feature/pom.xml index 1a34604d22..83f379875e 100644 --- a/features/cea-mgt-feature/pom.xml +++ b/features/cea-mgt-feature/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 cea-mgt-feature pom - Entgra IoT - CEA Management Feature + Entgra Device Management - CEA Management Feature io.entgra.device.mgt.core.cea.mgt.server.feature diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml index ddf23673a7..e32bf210d6 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.certificate.mgt.api.feature pom - WSO2 Carbon - Certificate Management API Feature + Entgra Device Management - Certificate Management API Feature https://entgra.io This feature contains the APIs required for Certificate Management. diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml index ca84f08aee..c44623e0a2 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature pom - WSO2 Carbon - Admin Certificate Management API Feature + Entgra Device Management - Admin Certificate Management API Feature https://entgra.io This feature contains the APIs required for Admin Certificate Management. diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml index b595688ff1..b7226747f6 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.certificate.mgt.server.feature pom - WSO2 Carbon - Certificate Management Server Feature + Entgra Device Management - Certificate Management Server Feature https://entgra.io This feature contains the core bundles required for back-end Certificate Management functionality diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index 4862bc26b2..1ec7324b3b 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 certificate-mgt-feature pom - WSO2 Carbon - Certificate Management Feature + Entgra Device Management - Certificate Management Feature https://entgra.io diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml index 6961e1c4d0..e9ea94d319 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature pom - Entgra IoT - Default Role Manager Feature Impl + Entgra Device Management - Default Role Manager Feature Impl http://entgra.io This feature contains the core bundles required for Default Role Manager functionality diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml index c9be43a57e..9fb14ce026 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml @@ -22,13 +22,13 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature pom - Entgra IoT - Device Organization Management API Feature + Entgra Device Management - Device Organization Management API Feature http://entgra.io This feature contains the APIs required for Device Organization Management. diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml index b07e877518..0a6f1b748b 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml @@ -22,16 +22,16 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature pom - Entgra IoT - Device Organization Feature + Entgra Device Management - Device Organization Feature http://entgra.io - Entgra IoT - Device Organization Feature + Entgra Device Management - Device Organization Feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml index da8d09cc0d..828e4c1b7c 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,16 +22,16 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature pom - WSO2 Carbon - Device Type Deployer Feature + Entgra Device Management - Device Type Deployer Feature https://entgra.io - WSO2 Carbon - Device Type Deployer Feature + Entgra Device Management - Device Type Deployer Feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml index 801618cb67..501aa17d36 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.logger.feature pom - Entgra IoT - Logger Plugin Feature Impl + Entgra Device Management - Logger Plugin Feature Impl http://entgra.io This feature contains the core bundles required for logging functionality diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index b281a9ab5e..f8b072bf6d 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,16 +22,16 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature pom - WSO2 Carbon - FCM Based Push Notification Provider Feature + Entgra Device Management - FCM Based Push Notification Provider Feature https://entgra.io - WSO2 Carbon - MQTT Based Push Notification Provider Feature + Entgra Device Management - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index e7ed43fb8d..74fcb401a0 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,16 +22,16 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature pom - WSO2 Carbon - MQTT Based Push Notification Provider Feature + Entgra Device Management - MQTT Based Push Notification Provider Feature https://entgra.io - WSO2 Carbon - MQTT Based Push Notification Provider Feature + Entgra Device Management - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 2699079465..839e56a6aa 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,16 +22,16 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature pom - WSO2 Carbon - MQTT Based Push Notification Provider Feature + Entgra Device Management - MQTT Based Push Notification Provider Feature https://entgra.io - WSO2 Carbon - MQTT Based Push Notification Provider Feature + Entgra Device Management - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index dc586b9ac9..72999f12ba 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,16 +22,16 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature pom - WSO2 Carbon - XMPP Based Push Notification Provider Feature + Entgra Device Management - XMPP Based Push Notification Provider Feature https://entgra.io - WSO2 Carbon - XMPP Based Push Notification Provider Feature + Entgra Device Management - XMPP Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml index 6f4f899cbc..59b479d044 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature pom - Entgra IoT - State engine Plugin Feature Impl + Entgra Device Management - State engine Plugin Feature Impl http://entgra.io This feature contains the core bundles required for state engine functionality diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml index 5099df1347..8a6c556327 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper.feature pom - Entgra IoT - User store role mapper feature + Entgra Device Management - User store role mapper feature http://entgra.io This feature contains the core bundles required for user store role mapping functionality diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index 91fb09e401..00ad899797 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 device-mgt-extensions-feature pom - WSO2 Carbon - Device Management Extensions Feature + Entgra Device Management - Device Management Extensions Feature https://entgra.io diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml index 4d7ed1e2c2..20e8ae776c 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core device-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.api.feature pom - WSO2 Carbon - Device Management API Feature + Entgra Device Management - Device Management API Feature https://entgra.io This feature contains the APIs required for Device Management console UI diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml index 1333c8acca..91aa55a3ae 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core device-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.basics.feature pom - WSO2 Carbon - Device Management Basics Feature + Entgra Device Management - Device Management Basics Feature https://entgra.io This feature contains the core bundles required for Basic Device Management functionality diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml index f4b6d5266b..a8946af8eb 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml @@ -200,10 +200,8 @@ icon.png default - - https://docs.entgra.io/uem/6.0.0 - + diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index c078c262b0..b995bfd325 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -345,7 +345,7 @@ and:ops:lock-devices and:ops:unlock-devices and:ops:location - and:ops:clear-password + and:ops:clear-pwd and:ops:control-camera and:ops:enterprise-wipe and:ops:wipe @@ -358,10 +358,11 @@ and:ops:send-app-restrictions and:ops:file-transfer and:ops:set-webclip - and:ops:password-policy + and:ops:pwd-policy and:ops:change-lock-code and:ops:upgrade-firmware and:ops:send-notif + and:ops:secure-folder dm:geo:geo-fence:manage dm:whitelable:view dm:whitelable:update @@ -391,7 +392,6 @@ win:ops:os-updates-info win:microsoft-store:search win:updates:read - win:update:modify admin:tenant:view dm:admin:devices:usage:view and:ops:clear-app diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 index 2d5f7639f8..e8560353c3 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf_templates/templates/repository/conf/cdm-config.xml.j2 @@ -348,12 +348,10 @@ icon.png default - - {% if product_conf is defined %} - https://docs.entgra.io/uem/{{product_conf.server_version}} + https://docs.entgra.io/uem/{{product_conf.server_version}} {% endif %} - + diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml index 97054900da..ce63bf6e92 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core device-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.extensions.feature pom - WSO2 Carbon - Device Management Extensions Feature + Entgra Device Management - Device Management Extensions Feature https://entgra.io This feature contains common extensions used by key device management functionalities diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml index 18eda1c211..d4a3b9dc0d 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core device-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.feature pom - WSO2 Carbon - Device Management Aggregate Feature + Entgra Device Management - Device Management Aggregate Feature https://entgra.io This feature contains all the bundles required for device management related functionalities diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml index c94d46583e..28bc9351f0 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core device-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.device.mgt.server.feature pom - WSO2 Carbon - Device Management Server Feature + Entgra Device Management - Device Management Server Feature https://entgra.io This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index e4178b397a..7caaee9050 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 device-mgt-feature pom - WSO2 Carbon - Device Management Feature + Entgra Device Management - Device Management Feature https://entgra.io diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml index b5ef62b8e7..d95f49517f 100644 --- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml +++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core heart-beat-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.server.heart.beat.feature pom - Entgra IoT - Heart Beat Feature + Entgra Device Management - Heart Beat Feature http://entgra.io This feature bundles for the heart beat beacon for Entgra IoT Server diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml index 36ced90a63..bc9a8296e6 100644 --- a/features/heartbeat-management/pom.xml +++ b/features/heartbeat-management/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 heart-beat-feature pom - Entgra - Heart Beat Feature + Entgra Device Management - Heart Beat Feature http://entgra.io diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml index 95a977d2e0..a943fbeb18 100644 --- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml @@ -23,14 +23,14 @@ io.entgra.device.mgt.core jwt-client-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.identity.jwt.client.extension.feature pom - WSO2 Carbon - JWT Client Feature + Entgra Device Management - JWT Client Feature https://entgra.io This feature contains jwt client implementation from which we can get a access token using the jwt grant type handler diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 710785e849..dbc15d6a11 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 jwt-client-feature pom - WSO2 Carbon - JWT Client Extension Feature + Entgra Device Management - JWT Client Extension Feature https://entgra.io diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml index fdc21ef2e0..701567ca40 100644 --- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml +++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml @@ -23,14 +23,14 @@ io.entgra.device.mgt.core logger-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.notification.logger.feature pom - Entgra - Notification logger + Entgra Device Management - Notification logger http://entgra.io This feature bundles for the Entgra Notification logger diff --git a/features/logger/pom.xml b/features/logger/pom.xml index 93bb6e79ad..c5420690b3 100644 --- a/features/logger/pom.xml +++ b/features/logger/pom.xml @@ -22,15 +22,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 logger-feature pom - Entgra - Logger Feature + Entgra Device Management - Logger Feature http://entgra.io diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml index 29e96f43cd..f9a593ec9e 100644 --- a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml +++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml @@ -30,7 +30,7 @@ 4.0.0 io.entgra.device.mgt.core.device.mgt.oauth.extensions.feature pom - WSO2 Carbon - Device Mgt OAuth Extensions Feature + Entgra Device Management - Device Mgt OAuth Extensions Feature https://entgra.io This feature contains devicemgt related OAuth extensions diff --git a/features/oauth-extensions/pom.xml b/features/oauth-extensions/pom.xml index d40fd22467..328e517844 100644 --- a/features/oauth-extensions/pom.xml +++ b/features/oauth-extensions/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent + device-mgt-core 5.0.0-SNAPSHOT ../../pom.xml @@ -29,7 +29,7 @@ 4.0.0 oauth-extensions-feature pom - WSO2 Carbon - Device Management OAuth Extensions Feature + Entgra Device Management - Device Management OAuth Extensions Feature https://entgra.io diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml index 21db4997c9..2118812072 100644 --- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core operation-template-mgt-plugin-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.operation.template.feature pom - Entgra IoT - Operation Template Management Feature Impl + Entgra Device Management - Operation Template Management Feature Impl http://entgra.io This feature contains the core bundles required for Operation template management functionality diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml index a15e5ee1ac..89a3dc1cf3 100644 --- a/features/operation-template-mgt-plugin-feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/pom.xml @@ -20,16 +20,16 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 operation-template-mgt-plugin-feature pom - Entgra IoT - Subtype Management Feature + Entgra Device Management - Subtype Management Feature http://entgra.io diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml index 8ed8e5f49a..2e8c9b8a6c 100644 --- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml @@ -23,14 +23,14 @@ io.entgra.device.mgt.core policy-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.policy.mgt.server.feature pom - WSO2 Carbon - Policy Management Server Feature + Entgra Device Management - Policy Management Server Feature https://entgra.io This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 3adb3ad614..caf592dbf0 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -22,8 +22,8 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml @@ -31,7 +31,7 @@ io.entgra.device.mgt.core policy-mgt-feature pom - WSO2 Carbon - Policy Management Feature + Entgra Device Management - Policy Management Feature https://entgra.io diff --git a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml index a06223bd95..624737274c 100644 --- a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml +++ b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml @@ -21,15 +21,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../../pom.xml 4.0.0 io.entgra.device.mgt.core.subtype.mgt.feature pom - Entgra IoT - Subtype Management Feature Impl + Entgra Device Management - Subtype Management Feature Impl http://entgra.io This feature contains the core bundles required for Subtype management functionality diff --git a/features/subtype-mgt/pom.xml b/features/subtype-mgt/pom.xml index 580c256614..cc2cd63721 100644 --- a/features/subtype-mgt/pom.xml +++ b/features/subtype-mgt/pom.xml @@ -20,16 +20,16 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 subtype-mgt-feature pom - Entgra IoT - Subtype Management Feature + Entgra Device Management - Subtype Management Feature http://entgra.io diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml index d241eff822..a5d4a95fe0 100755 --- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml +++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml @@ -20,15 +20,15 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../../pom.xml 4.0.0 io.entgra.device.mgt.core.task.mgt.feature pom - Entgra IoT - Task Manager Feature + Entgra Device Management - Task Manager Feature https://entgra.io diff --git a/features/task-mgt/pom.xml b/features/task-mgt/pom.xml index c0ee005cf7..81feb37d66 100755 --- a/features/task-mgt/pom.xml +++ b/features/task-mgt/pom.xml @@ -19,16 +19,16 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 task-mgt-feature pom - Entgra IoT - Task Management Feature + Entgra Device Management - Task Management Feature http://entgra.io diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml index 8f40306d87..73f9bad1f8 100644 --- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml +++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml @@ -20,14 +20,14 @@ tenant-mgt-feature io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.tenant.mgt.server.feature - Entgra IoT - Tenant Management Server Feature - Entgra IoT - Tenant Management Server Feature + Entgra Device Management - Tenant Management Server Feature + Entgra Device Management - Tenant Management Server Feature pom diff --git a/features/tenant-mgt/pom.xml b/features/tenant-mgt/pom.xml index 7e7c235776..36f9b9622c 100644 --- a/features/tenant-mgt/pom.xml +++ b/features/tenant-mgt/pom.xml @@ -19,16 +19,16 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 tenant-mgt-feature pom - Entgra IoT - Tenant Management Feature + Entgra Device Management - Tenant Management Feature io.entgra.device.mgt.core.tenant.mgt.server.feature diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml index 6a50c3a704..3ef87e723d 100644 --- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml +++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core email-sender-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.email.sender.feature pom - WSO2 Carbon - Email Sender Feature + Entgra Device Management - Email Sender Feature https://entgra.io This feature contains the core bundles required for email sender related functionality diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml index ec244897d7..7048fb7be3 100644 --- a/features/transport-mgt/email-sender/pom.xml +++ b/features/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core email-sender-feature pom - WSO2 Carbon - Email Sender Feature + Entgra Device Management - Email Sender Feature https://entgra.io diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml index f7907e59bb..c8a9120c12 100644 --- a/features/transport-mgt/pom.xml +++ b/features/transport-mgt/pom.xml @@ -19,16 +19,16 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 transport-mgt-feature pom - Entgra - Transport Management Feature + Entgra Device Management - Transport Management Feature http://entgra.io diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml index bf8a594c77..bf136b67b8 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core sms-handler-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature pom - Entgra - SMS Handler API Feature + Entgra Device Management - SMS Handler API Feature https://entgra.io This feature contains the APIs required for SMS Handler diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml index 679db11051..d1c19e9c36 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core sms-handler-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature pom - Entgra - SMS Handler Server Feature + Entgra Device Management - SMS Handler Server Feature https://entgra.io This feature contains the core bundles required for Back-end SMS Handler functionality diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml index ec0afa72b5..6c5a1334c8 100644 --- a/features/transport-mgt/sms-handler/pom.xml +++ b/features/transport-mgt/sms-handler/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 sms-handler-feature pom - Entgra - SMS Handler Feature + Entgra Device Management - SMS Handler Feature http://entgra.io diff --git a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml index 83c3643fa5..0fada165d2 100644 --- a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml +++ b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml @@ -21,12 +21,12 @@ ui-request-interceptor-feature io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT 4.0.0 io.entgra.device.mgt.core.ui.request.interceptor.feature - Entgra - UI Request Interceptor Feature + Entgra Device Management - UI Request Interceptor Feature Proxy servlet to handle requests generated from UI applications to communicate with backend APIs diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml index 6026538937..f8af153582 100644 --- a/features/ui-request-interceptor/pom.xml +++ b/features/ui-request-interceptor/pom.xml @@ -19,15 +19,15 @@ - io.entgra.device.mgt.core.parent + device-mgt-core io.entgra.device.mgt.core - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../../pom.xml 4.0.0 ui-request-interceptor-feature - Entgra - UI Request Interceptor Feature + Entgra Device Management - UI Request Interceptor Feature Proxy servlet to handle requests generated from UI applications to communicate with backend APIs diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml index b423ee65a0..7ed67e9574 100644 --- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml @@ -22,14 +22,14 @@ io.entgra.device.mgt.core webapp-authenticator-framework-feature - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT ../pom.xml 4.0.0 io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature pom - WSO2 Carbon - Webapp Authenticator Framework Server Feature + Entgra Device Management - Webapp Authenticator Framework Server Feature https://entgra.io This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index b7579c8e1d..c4d70adbc5 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -21,8 +21,8 @@ io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent - 5.2.4-SNAPSHOT + device-mgt-core + 6.0.0-SNAPSHOT ../../pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework-feature pom - WSO2 Carbon - Webapp Authenticator Framework Feature + Entgra Device Management - Webapp Authenticator Framework Feature https://entgra.io diff --git a/pom.xml b/pom.xml index f0edb13595..48cdcf3eb2 100644 --- a/pom.xml +++ b/pom.xml @@ -17,16 +17,18 @@ ~ under the License. --> - + 4.0.0 io.entgra.device.mgt.core - io.entgra.device.mgt.core.parent + device-mgt-core pom - 5.2.4-SNAPSHOT - WSO2 Carbon - Device Management - Parent + 6.0.0-SNAPSHOT + Entgra Device Management - Parent https://entgra.io - WSO2 Connected Device Manager Components + Entgra Device Management Core Components Parent + org.wso2 wso2 @@ -70,7 +72,6 @@ features/tenant-mgt features/operation-template-mgt-plugin-feature features/cea-mgt-feature - @@ -2091,7 +2092,7 @@ 2.2.1 7.4.0 4.8.1 - [4.5.0, 5.0.0) + [4.8.0, 5.0.0) 5.1.2 @@ -2120,7 +2121,8 @@ [2.1.1, 3.0.0) [5.14.0, 6.0.0) - [6.0.0, 7.0.0) + [6.0.0, 7.0.0) + 4.9.20 @@ -2134,7 +2136,8 @@ 1.2.11-wso2v25 - 5.2.4-SNAPSHOT + 6.0.0-SNAPSHOT + [6.0.0, 7.0.0) 4.9.2 @@ -2291,7 +2294,8 @@ 2.23.4 2.8.1.wso2v2 - 4.3.1.wso2v1 + 4.3.1.wso2v1 + 2.1.214.wso2v1 1.1.3