Adding device-identification attribute for DetailedDeviceEntry in dashboard analytics feature

revert-70aa11f8
dilanua 9 years ago
parent e151bca0c7
commit bb3bcdfd2d

@ -485,7 +485,8 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
try { try {
con = this.getConnection(); con = this.getConnection();
String sql; 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 // appending filters to support advanced filtering options
// [1] appending filter columns, if exist // [1] appending filter columns, if exist
if (filters != null && filters.size() > 0) { if (filters != null && filters.size() > 0) {
@ -514,6 +515,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DetailedDeviceEntry();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP"));
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));
@ -543,8 +545,8 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
try { try {
con = this.getConnection(); con = this.getConnection();
String sql; String sql;
sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 " + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " +
"WHERE TENANT_ID = ? AND FEATURE_CODE = ?"; "DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ?";
// appending filters to support advanced filtering options // appending filters to support advanced filtering options
// [1] appending filter columns, if exist // [1] appending filter columns, if exist
if (filters != null && filters.size() > 0) { if (filters != null && filters.size() > 0) {
@ -574,6 +576,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DetailedDeviceEntry();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP"));
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));

@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
public class DetailedDeviceEntry { public class DetailedDeviceEntry {
private int deviceId; private int deviceId;
private String deviceIdentification;
private String platform; private String platform;
private String ownershipType; private String ownershipType;
private String connectivityStatus; private String connectivityStatus;
@ -34,6 +35,15 @@ public class DetailedDeviceEntry {
this.deviceId = deviceId; this.deviceId = deviceId;
} }
@SuppressWarnings("unused")
public String getDeviceIdentification() {
return deviceIdentification;
}
public void setDeviceIdentification(String deviceIdentification) {
this.deviceIdentification = deviceIdentification;
}
@SuppressWarnings("unused") @SuppressWarnings("unused")
public String getPlatform() { public String getPlatform() {
return platform; return platform;

@ -127,8 +127,8 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? ";
} }
} }
sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 " + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " +
"WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC LIMIT ?, ?"; "DEVICES_VIEW_1 WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC LIMIT ?, ?";
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
@ -155,6 +155,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DetailedDeviceEntry();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP"));
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));
@ -217,8 +218,8 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? ";
} }
} }
sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 " + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " +
"WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering + "DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering +
"ORDER BY DEVICE_ID ASC LIMIT ?, ?"; "ORDER BY DEVICE_ID ASC LIMIT ?, ?";
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
@ -247,6 +248,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DetailedDeviceEntry();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP"));
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));

@ -128,8 +128,8 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? ";
} }
} }
sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 " + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " +
"WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC " + "DEVICES_VIEW_1 WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC " +
"OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; "OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
@ -157,6 +157,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DetailedDeviceEntry();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP"));
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));
@ -219,8 +220,8 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? ";
} }
} }
sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 " + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " +
"WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering + "DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering +
"ORDER BY DEVICE_ID ASC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; "ORDER BY DEVICE_ID ASC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
@ -249,6 +250,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DetailedDeviceEntry();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP"));
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));

@ -128,8 +128,8 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? ";
} }
} }
sql = "SELECT * FROM (SELECT ROWNUM offset, rs.* FROM (SELECT DEVICE_ID, PLATFORM, OWNERSHIP, " + sql = "SELECT * FROM (SELECT ROWNUM offset, rs.* FROM (SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, " +
"CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 WHERE TENANT_ID = ? " + advancedSqlFiltering + "OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 WHERE TENANT_ID = ? " + advancedSqlFiltering +
"ORDER BY DEVICE_ID ASC) rs) WHERE offset >= ? AND ROWNUM <= ?"; "ORDER BY DEVICE_ID ASC) rs) WHERE offset >= ? AND ROWNUM <= ?";
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
@ -157,6 +157,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DetailedDeviceEntry();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP"));
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));
@ -219,8 +220,8 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? ";
} }
} }
sql = "SELECT * FROM (SELECT ROWNUM offset, rs.* FROM (SELECT DEVICE_ID, PLATFORM, OWNERSHIP, " + sql = "SELECT * FROM (SELECT ROWNUM offset, rs.* FROM (SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, " +
"CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + "OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ? " +
advancedSqlFiltering + "ORDER BY DEVICE_ID ASC) rs) WHERE offset >= ? AND ROWNUM <= ?"; advancedSqlFiltering + "ORDER BY DEVICE_ID ASC) rs) WHERE offset >= ? AND ROWNUM <= ?";
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
@ -249,6 +250,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DetailedDeviceEntry();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP"));
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));

@ -127,8 +127,8 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? ";
} }
} }
sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_1 " + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " +
"WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC OFFSET ? LIMIT ?"; "DEVICES_VIEW_1 WHERE TENANT_ID = ? " + advancedSqlFiltering + "ORDER BY DEVICE_ID ASC OFFSET ? LIMIT ?";
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
@ -155,6 +155,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DetailedDeviceEntry();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP"));
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));
@ -217,8 +218,8 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? "; advancedSqlFiltering = advancedSqlFiltering + "AND " + column + " = ? ";
} }
} }
sql = "SELECT DEVICE_ID, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM DEVICES_VIEW_2 " + sql = "SELECT DEVICE_ID, DEVICE_IDENTIFICATION, PLATFORM, OWNERSHIP, CONNECTIVITY_STATUS FROM " +
"WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering + "DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ? " + advancedSqlFiltering +
"ORDER BY DEVICE_ID ASC OFFSET ? LIMIT ?"; "ORDER BY DEVICE_ID ASC OFFSET ? LIMIT ?";
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
@ -247,6 +248,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DetailedDeviceEntry();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP")); filteredDeviceWithDetails.setOwnershipType(rs.getString("OWNERSHIP"));
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS")); filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));

Loading…
Cancel
Save