From ce8d4b53a29ff70a7d41709316dae261834a2484 Mon Sep 17 00:00:00 2001 From: dilanua Date: Fri, 8 Apr 2016 15:10:01 +0530 Subject: [PATCH] Adding temporary development code bits of dashboard analytics feature --- components/device-mgt/pom.xml | 2 +- .../core/util/PolicyManagementConstants.java | 17 +++++++---- components/policy-mgt/pom.xml | 2 -- .../src/main/resources/dbscripts/cdm/h2.sql | 28 +++++++++++++++++++ features/device-mgt/pom.xml | 2 +- pom.xml | 5 ++++ 6 files changed, 46 insertions(+), 10 deletions(-) diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 4938424351..3bc5b7eb6f 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -28,7 +28,6 @@ 4.0.0 - org.wso2.carbon.devicemgt device-mgt pom WSO2 Carbon - Device Management Component @@ -39,6 +38,7 @@ org.wso2.carbon.device.mgt.common org.wso2.carbon.device.mgt.extensions org.wso2.carbon.device.mgt.ui + org.wso2.carbon.device.mgt.analytics.dashboard org.wso2.carbon.device.mgt.analytics.data.publisher org.wso2.carbon.device.mgt.etc diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagementConstants.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagementConstants.java index 13a2df3442..bcaac2b283 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagementConstants.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/util/PolicyManagementConstants.java @@ -22,29 +22,34 @@ public final class PolicyManagementConstants { public static final String DEVICE_CONFIG_XML_NAME = "cdm-config.xml"; public static final String ANY = "ANY"; - public static final String POLICY_BUNDLE = "POLICY_BUNDLE"; + // public static final String POLICY_BUNDLE = "POLICY_BUNDLE"; public static final String TENANT_ID = "TENANT_ID"; - public static final String MONITOR = "MONITOR"; + // public static final String MONITOR = "MONITOR"; public static final String ENFORCE = "ENFORCE"; public static final String WARN = "WARN"; public static final String BLOCK = "BLOCK"; - public static final String MONITORING_TASK_TYPE = "MONITORING_TASK"; public static final String MONITORING_TASK_NAME = "MONITORING"; public static final String MONITORING_TASK_CLAZZ = "org.wso2.carbon.policy.mgt.core.task.MonitoringTask"; - public static final String DM_CACHE_MANAGER = "DM_CACHE_MANAGER"; - public static final String DM_CACHE = "DM_CACHE"; + // public static final String DM_CACHE = "DM_CACHE"; public static final String DM_CACHE_LIST = "DM_CACHE_LIST"; - public static final String DELEGATION_TASK_TYPE = "DELEGATION__TASK"; public static final String DELEGATION_TASK_NAME = "DELEGATION"; public static final String DELEGATION_TASK_CLAZZ = "org.wso2.carbon.policy.mgt.core.enforcement.DelegationTask"; + /** + Caller would reference the constants using PolicyManagementConstants.DEVICE_CONFIG_XML_NAME, + and so on. Any caller should be prevented from constructing objects of + this class, thus declaring this private constructor. + */ + private PolicyManagementConstants() { + throw new AssertionError(); + } } diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index d15bb08504..4d1c8edb69 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -28,7 +28,6 @@ 4.0.0 - org.wso2.carbon.devicemgt policy-mgt 1.1.0-SNAPSHOT pom @@ -43,7 +42,6 @@ org.wso2.carbon.complex.policy.decision.point - diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql index 67cc4d9e0a..38b251c24b 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -484,3 +484,31 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( ON DELETE NO ACTION ON UPDATE NO ACTION ); + +CREATE VIEW DEVICES_VIEW AS +SELECT +DEVICE_INFO.DEVICE_ID, +DEVICE_INFO.PLATFORM, +DEVICE_INFO.OWNERSHIP, +DEVICE_INFO.CONNECTIVITY_STATUS, +IFNULL(DEVICE_WITH_POLICY_INFO.POLICY_ID, -1) AS POLICY_ID, +IFNULL(DEVICE_WITH_POLICY_INFO.IS_COMPLIANT, -1) AS IS_COMPLIANT, +DEVICE_INFO.TENANT_ID +FROM +(SELECT +DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE_TYPE.NAME AS PLATFORM, +DM_ENROLMENT.OWNERSHIP AS OWNERSHIP, +DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS, +DM_DEVICE.TENANT_ID AS TENANT_ID +FROM DM_DEVICE, DM_DEVICE_TYPE, DM_ENROLMENT +WHERE DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND DM_DEVICE.ID = DM_ENROLMENT.DEVICE_ID) DEVICE_INFO +LEFT JOIN +(SELECT +DEVICE_ID, +POLICY_ID, +STATUS AS IS_COMPLIANT +FROM +DM_POLICY_COMPLIANCE_STATUS) DEVICE_WITH_POLICY_INFO +ON DEVICE_INFO.DEVICE_ID = DEVICE_WITH_POLICY_INFO.DEVICE_ID +ORDER BY DEVICE_INFO.DEVICE_ID; diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 8896bc9aa0..a30a6bb68e 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -27,7 +27,6 @@ 4.0.0 - org.wso2.carbon.devicemgt device-mgt-feature pom WSO2 Carbon - Device Management Feature @@ -39,6 +38,7 @@ org.wso2.carbon.device.mgt.feature org.wso2.carbon.device.mgt.extensions.feature org.wso2.carbon.device.mgt.analytics.data.publisher.feature + org.wso2.carbon.device.mgt.analytics.dashboard.feature \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3711d3cfe9..65f8dd5e8b 100644 --- a/pom.xml +++ b/pom.xml @@ -269,6 +269,11 @@ org.wso2.carbon.device.mgt.analytics.data.publisher ${carbon.device.mgt.version} + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.analytics.dashboard + ${carbon.device.mgt.version} + org.wso2.carbon.devicemgt org.wso2.carbon.device.mgt.server.feature