From e151bca0c76e0a28852e91d47f7fb6a232909fc0 Mon Sep 17 00:00:00 2001 From: dilanua Date: Wed, 11 May 2016 16:25:00 +0530 Subject: [PATCH 1/2] Adding device-identification attribute for database views in dashboard analytics feature --- .../src/main/resources/dbscripts/cdm/h2.sql | 3 +++ .../src/main/resources/dbscripts/cdm/mssql.sql | 3 +++ .../src/main/resources/dbscripts/cdm/mysql.sql | 3 +++ .../src/main/resources/dbscripts/cdm/oracle.sql | 3 +++ .../src/main/resources/dbscripts/cdm/postgresql.sql | 3 +++ 5 files changed, 15 insertions(+) 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 34b385655c..67cdf57a33 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 @@ -515,6 +515,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY ( CREATE VIEW DEVICES_VIEW_1 AS SELECT DEVICE_INFO.DEVICE_ID, +DEVICE_INFO.DEVICE_IDENTIFICATION, DEVICE_INFO.PLATFORM, DEVICE_INFO.OWNERSHIP, DEVICE_INFO.CONNECTIVITY_STATUS, @@ -524,6 +525,7 @@ DEVICE_INFO.TENANT_ID FROM (SELECT DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE_TYPE.NAME AS PLATFORM, DM_ENROLMENT.OWNERSHIP, DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS, @@ -542,6 +544,7 @@ ORDER BY DEVICE_INFO.DEVICE_ID; CREATE VIEW DEVICES_VIEW_2 AS SELECT DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE_DETAIL.DEVICE_MODEL, DM_DEVICE_DETAIL.VENDOR, DM_DEVICE_DETAIL.OS_VERSION, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql index e709195f19..e18fcf915a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -507,6 +507,7 @@ CREATE INDEX FK_DM_DEVICE_DETAILS_DEVICE_idx ON DM_DEVICE_DETAIL (DEVICE_ID ASC) CREATE VIEW DEVICES_VIEW_1 AS SELECT TOP 100 PERCENT DEVICE_INFO.DEVICE_ID, +DEVICE_INFO.DEVICE_IDENTIFICATION, DEVICE_INFO.PLATFORM, DEVICE_INFO.OWNERSHIP, DEVICE_INFO.CONNECTIVITY_STATUS, @@ -517,6 +518,7 @@ DEVICE_INFO.TENANT_ID FROM (SELECT DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE_TYPE.NAME AS PLATFORM, DM_ENROLMENT.OWNERSHIP, DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS, @@ -537,6 +539,7 @@ GO CREATE VIEW DEVICES_VIEW_2 AS SELECT TOP 100 PERCENT DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE_DETAIL.DEVICE_MODEL, DM_DEVICE_DETAIL.VENDOR, DM_DEVICE_DETAIL.OS_VERSION, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql index e031ea2fe2..0fd8889cc3 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -527,6 +527,7 @@ ENGINE = InnoDB; CREATE VIEW DEVICE_INFO_VIEW AS SELECT DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE_TYPE.NAME AS PLATFORM, DM_ENROLMENT.OWNERSHIP, DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS, @@ -544,6 +545,7 @@ FROM DM_POLICY_COMPLIANCE_STATUS; CREATE VIEW DEVICES_VIEW_1 AS SELECT DEVICE_INFO_VIEW.DEVICE_ID, +DEVICE_INFO_VIEW.DEVICE_IDENTIFICATION, DEVICE_INFO_VIEW.PLATFORM, DEVICE_INFO_VIEW.OWNERSHIP, DEVICE_INFO_VIEW.CONNECTIVITY_STATUS, @@ -560,6 +562,7 @@ ORDER BY DEVICE_INFO_VIEW.DEVICE_ID; CREATE VIEW DEVICES_VIEW_2 AS SELECT DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE_DETAIL.DEVICE_MODEL, DM_DEVICE_DETAIL.VENDOR, DM_DEVICE_DETAIL.OS_VERSION, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql index c4a2fd0267..7a41ae3a66 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -853,6 +853,7 @@ WHEN (NEW.ID IS NULL) CREATE VIEW DEVICES_VIEW_1 AS SELECT DEVICE_INFO.DEVICE_ID, +DEVICE_INFO.DEVICE_IDENTIFICATION, DEVICE_INFO.PLATFORM, DEVICE_INFO.OWNERSHIP, DEVICE_INFO.CONNECTIVITY_STATUS, @@ -862,6 +863,7 @@ DEVICE_INFO.TENANT_ID FROM (SELECT DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE_TYPE.NAME AS PLATFORM, DM_ENROLMENT.OWNERSHIP, DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS, @@ -880,6 +882,7 @@ ORDER BY DEVICE_INFO.DEVICE_ID; CREATE VIEW DEVICES_VIEW_2 AS SELECT DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE_DETAIL.DEVICE_MODEL, DM_DEVICE_DETAIL.VENDOR, DM_DEVICE_DETAIL.OS_VERSION, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 7e8c8a3e0c..9ec4ef3778 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -434,6 +434,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( CREATE VIEW DEVICES_VIEW_1 AS SELECT DEVICE_INFO.DEVICE_ID, +DEVICE_INFO.DEVICE_IDENTIFICATION, DEVICE_INFO.PLATFORM, DEVICE_INFO.OWNERSHIP, DEVICE_INFO.CONNECTIVITY_STATUS, @@ -443,6 +444,7 @@ DEVICE_INFO.TENANT_ID FROM (SELECT DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE_TYPE.NAME AS PLATFORM, DM_ENROLMENT.OWNERSHIP, DM_ENROLMENT.STATUS AS CONNECTIVITY_STATUS, @@ -461,6 +463,7 @@ ORDER BY DEVICE_INFO.DEVICE_ID; CREATE VIEW DEVICES_VIEW_2 AS SELECT DM_DEVICE.ID AS DEVICE_ID, +DM_DEVICE.DEVICE_IDENTIFICATION, DM_DEVICE_DETAIL.DEVICE_MODEL, DM_DEVICE_DETAIL.VENDOR, DM_DEVICE_DETAIL.OS_VERSION, From bb3bcdfd2d0940f1d25afb3efe0f18fedbef954c Mon Sep 17 00:00:00 2001 From: dilanua Date: Wed, 11 May 2016 20:01:02 +0530 Subject: [PATCH 2/2] Adding device-identification attribute for DetailedDeviceEntry in dashboard analytics feature --- .../dashboard/dao/AbstractGadgetDataServiceDAO.java | 9 ++++++--- .../dashboard/dao/bean/DetailedDeviceEntry.java | 10 ++++++++++ .../dao/impl/GenericGadgetDataServiceDAOImpl.java | 10 ++++++---- .../dao/impl/MSSQLGadgetDataServiceDAOImpl.java | 10 ++++++---- .../dao/impl/OracleGadgetDataServiceDAOImpl.java | 12 +++++++----- .../dao/impl/PostgreSQLGadgetDataServiceDAOImpl.java | 10 ++++++---- 6 files changed, 41 insertions(+), 20 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/AbstractGadgetDataServiceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/AbstractGadgetDataServiceDAO.java index 964eb02dd8..d41ba45a62 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/AbstractGadgetDataServiceDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/AbstractGadgetDataServiceDAO.java @@ -485,7 +485,8 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD try { con = this.getConnection(); String sql; - sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 WHERE TENANT_ID = ?"; + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " + + "DEVICES_VIEW_1 WHERE TENANT_ID = ?"; // appending filters to support advanced filtering options // [1] appending filter columns, if exist if (filters != null && filters.size() > 0) { @@ -514,6 +515,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD while (rs.next()) { filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); + filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); @@ -543,8 +545,8 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD try { con = this.getConnection(); String sql; - sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 " + - "WHERE TENANT_ID = ? AND FEATURE_CODE = ?"; + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " + + "DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ?"; // appending filters to support advanced filtering options // [1] appending filter columns, if exist if (filters != null && filters.size() > 0) { @@ -574,6 +576,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD while (rs.next()) { filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); + filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/bean/DetailedDeviceEntry.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/bean/DetailedDeviceEntry.java index c8885b6833..307a202ba3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/bean/DetailedDeviceEntry.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/bean/DetailedDeviceEntry.java @@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean; public class DetailedDeviceEntry { private int deviceId; + private String deviceIdentification; private String platform; private String ownershipType; private String connectivityStatus; @@ -34,6 +35,15 @@ public class DetailedDeviceEntry { this.deviceId = deviceId; } + @SuppressWarnings("unused") + public String getDeviceIdentification() { + return deviceIdentification; + } + + public void setDeviceIdentification(String deviceIdentification) { + this.deviceIdentification = deviceIdentification; + } + @SuppressWarnings("unused") public String getPlatform() { return platform; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/GenericGadgetDataServiceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/GenericGadgetDataServiceDAOImpl.java index 3126d7736a..feb8b7024a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/GenericGadgetDataServiceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/GenericGadgetDataServiceDAOImpl.java @@ -127,8 +127,8 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; } } - sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 " + - "WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC LIMIT ?, ?"; + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " + + "DEVICES_VIEW_1 WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC LIMIT ?, ?"; stmt = con.prepareStatement(sql); // [2] appending filter column values, if exist stmt.setInt(1, tenantId); @@ -155,6 +155,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA while (rs.next()) { filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); + filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); @@ -217,8 +218,8 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; } } - sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 " + - "WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering + + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " + + "DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC LIMIT ?, ?"; stmt = con.prepareStatement(sql); // [2] appending filter column values, if exist @@ -247,6 +248,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA while (rs.next()) { filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); + filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/MSSQLGadgetDataServiceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/MSSQLGadgetDataServiceDAOImpl.java index 4e5bef4d45..b1a725e2bf 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/MSSQLGadgetDataServiceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/MSSQLGadgetDataServiceDAOImpl.java @@ -128,8 +128,8 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; } } - sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 " + - "WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC " + + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " + + "DEVICES_VIEW_1 WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC " + "OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; stmt = con.prepareStatement(sql); // [2] appending filter column values, if exist @@ -157,6 +157,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO while (rs.next()) { filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); + filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); @@ -219,8 +220,8 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; } } - sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 " + - "WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering + + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " + + "DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; stmt = con.prepareStatement(sql); // [2] appending filter column values, if exist @@ -249,6 +250,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO while (rs.next()) { filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); + filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/OracleGadgetDataServiceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/OracleGadgetDataServiceDAOImpl.java index a433bca813..a84b906f34 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/OracleGadgetDataServiceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/OracleGadgetDataServiceDAOImpl.java @@ -78,7 +78,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO } // fetching total records count sql = "SELECT COUNT(FEATURE_CODE) AS NON_COMPLIANT_FEATURE_COUNT FROM " + - "(SELECT DISTINCT FEATURE_CODE FROM DEVICES_VIEW_2 WHERE TENANT_ID = ?) NON_COMPLIANT_FEATURE_CODE"; + "(SELECT DISTINCT FEATURE_CODE FROM DEVICES_VIEW_2 WHERE TENANT_ID = ?) NON_COMPLIANT_FEATURE_CODE"; stmt = con.prepareStatement(sql); stmt.setInt(1, tenantId); @@ -128,8 +128,8 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; } } - sql = "SELECT * FROM (SELECT ROWNUM offset, rs.* FROM (SELECT DEVICE_ID, PLATFORM, OWNERSHIP, " + - "CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 WHERE TENANT_ID = ? " + advancedSqlFiltering + + sql = "SELECT * FROM (SELECT ROWNUM offset, rs.* FROM (SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, " + + "OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC) rs) WHERE offset >= ? AND ROWNUM <= ?"; stmt = con.prepareStatement(sql); // [2] appending filter column values, if exist @@ -157,6 +157,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO while (rs.next()) { filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); + filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); @@ -219,8 +220,8 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; } } - sql = "SELECT * FROM (SELECT ROWNUM offset, rs.* FROM (SELECT DEVICE_ID, PLATFORM, OWNERSHIP, " + - "CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + + sql = "SELECT * FROM (SELECT ROWNUM offset, rs.* FROM (SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, " + + "OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC) rs) WHERE offset >= ? AND ROWNUM <= ?"; stmt = con.prepareStatement(sql); // [2] appending filter column values, if exist @@ -249,6 +250,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO while (rs.next()) { filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); + filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/PostgreSQLGadgetDataServiceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/PostgreSQLGadgetDataServiceDAOImpl.java index d28a5e5b50..26986df2fe 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/PostgreSQLGadgetDataServiceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/PostgreSQLGadgetDataServiceDAOImpl.java @@ -127,8 +127,8 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; } } - sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 " + - "WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC OFFSET ? LIMIT ?"; + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " + + "DEVICES_VIEW_1 WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC OFFSET ? LIMIT ?"; stmt = con.prepareStatement(sql); // [2] appending filter column values, if exist stmt.setInt(1, tenantId); @@ -155,6 +155,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic while (rs.next()) { filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); + filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); @@ -217,8 +218,8 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; } } - sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 " + - "WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering + + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " + + "DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC OFFSET ? LIMIT ?"; stmt = con.prepareStatement(sql); // [2] appending filter column values, if exist @@ -247,6 +248,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic while (rs.next()) { filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); + filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));