From 8d52735e6ad21ecfc15da2ee98052b5e732fba5b Mon Sep 17 00:00:00 2001 From: Kasun Delgolla Date: Tue, 20 Oct 2015 09:51:43 +0530 Subject: [PATCH 1/6] Adding app list + info to monitoring operation --- .../mgt/core/mgt/impl/MonitoringManagerImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java index 75350b3fdc..f6d14166a4 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java @@ -62,6 +62,8 @@ public class MonitoringManagerImpl implements MonitoringManager { private static final Log log = LogFactory.getLog(MonitoringManagerImpl.class); private static final String OPERATION_MONITOR = "MONITOR"; + private static final String OPERATION_INFO = "DEVICE_INFO"; + private static final String OPERATION_APP_LIST = "APPLICATION_LIST"; public MonitoringManagerImpl() { this.policyDAO = PolicyManagementDAOFactory.getPolicyDAO(); @@ -378,9 +380,19 @@ public class MonitoringManagerImpl implements MonitoringManager { monitoringOperation.setEnabled(true); monitoringOperation.setType(Operation.Type.COMMAND); monitoringOperation.setCode(OPERATION_MONITOR); + CommandOperation infoOperation = new CommandOperation(); + infoOperation.setEnabled(true); + infoOperation.setType(Operation.Type.COMMAND); + infoOperation.setCode(OPERATION_INFO); + CommandOperation appListOperation = new CommandOperation(); + appListOperation.setEnabled(true); + appListOperation.setType(Operation.Type.COMMAND); + appListOperation.setCode(OPERATION_APP_LIST); DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); service.addOperation(monitoringOperation, deviceIdentifiers); + service.addOperation(infoOperation, deviceIdentifiers); + service.addOperation(appListOperation, deviceIdentifiers); } private List getDeviceIdentifiersFromDevices(List devices) { From 5ec27d989fd2bddadfa3f474b2e814d7c39edba5 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Thu, 29 Oct 2015 14:02:21 +0530 Subject: [PATCH 2/6] Removing unnecessary INSERT statements found in device management schema --- .../src/main/resources/dbscripts/cdm/h2.sql | 3 --- .../src/main/resources/dbscripts/cdm/mssql.sql | 4 ---- 2 files changed, 7 deletions(-) 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 42ee0a0df1..f0c0e17f1a 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 @@ -398,6 +398,3 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( ); -- NOTIFICATION TABLE END -- --- TO:DO - Remove this INSERT sql statement. -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (1, 'android'); -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (2, 'ios'); 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 b0962b5085..de4c58d2df 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 @@ -401,7 +401,3 @@ CREATE TABLE DM_NOTIFICATION ( ); -- NOTIFICATION TABLE END -- --- TO:DO - Remove this INSERT sql statement. -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (1, 'android'); -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (2, 'ios'); - From 90240e7d3fccf1f96a52ce4fc0c6c9142ef9b637 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Thu, 29 Oct 2015 14:11:24 +0530 Subject: [PATCH 3/6] Merging https://github.com/wso2/carbon-device-mgt/pull/40 and resolving conflicts --- .../mgt/dao/impl/CommandOperationDAOImpl.java | 2 +- .../mgt/dao/impl/ConfigOperationDAOImpl.java | 2 +- .../mgt/dao/impl/OperationDAOImpl.java | 12 ++-- .../mgt/dao/impl/OperationMappingDAOImpl.java | 4 +- .../mgt/dao/impl/PolicyOperationDAOImpl.java | 2 +- .../mgt/dao/impl/ProfileOperationDAOImpl.java | 2 +- .../src/test/resources/sql/h2.sql | 2 +- .../src/test/resources/sql/CreateH2TestDB.sql | 2 +- .../src/main/resources/dbscripts/cdm/h2.sql | 2 +- .../main/resources/dbscripts/cdm/mssql.sql | 2 +- .../main/resources/dbscripts/cdm/mysql.sql | 3 +- .../main/resources/dbscripts/cdm/oracle.sql | 10 +-- .../resources/dbscripts/cdm/postgresql.sql | 62 +++++++++---------- 13 files changed, 50 insertions(+), 57 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java index f485408d67..d65835a760 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java @@ -123,7 +123,7 @@ public class CommandOperationDAOImpl extends OperationDAOImpl { String sql = "SELECT o.ID, co1.ENABLED, co1.STATUS, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " + "o.OPERATION_CODE FROM (SELECT co.OPERATION_ID, co.ENABLED, dm.STATUS " + "FROM DM_COMMAND_OPERATION co INNER JOIN (SELECT ENROLMENT_ID, OPERATION_ID, STATUS " + - "FROM DM_ENROLMENT_OPERATION_MAPPING WHERE ENROLMENT_ID = ? AND STATUS = ?) dm " + + "FROM DM_ENROLMENT_OP_MAPPING WHERE ENROLMENT_ID = ? AND STATUS = ?) dm " + "ON dm.OPERATION_ID = co.OPERATION_ID) co1 INNER JOIN DM_OPERATION o ON co1.OPERATION_ID = o.ID"; stmt = conn.prepareStatement(sql); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java index 7d62fa8d79..be3b1ab788 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java @@ -164,7 +164,7 @@ public class ConfigOperationDAOImpl extends OperationDAOImpl { try { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "SELECT co.OPERATION_ID, co.OPERATION_CONFIG FROM DM_CONFIG_OPERATION co " + - "INNER JOIN (SELECT * FROM DM_ENROLMENT_OPERATION_MAPPING WHERE ENROLMENT_ID = ? " + + "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING WHERE ENROLMENT_ID = ? " + "AND STATUS = ?) dm ON dm.OPERATION_ID = co.OPERATION_ID"; stmt = conn.prepareStatement(sql); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java index 3608d11be7..7908dc63a8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java @@ -87,7 +87,7 @@ public class OperationDAOImpl implements OperationDAO { PreparedStatement stmt = null; try { Connection connection = OperationManagementDAOFactory.getConnection(); - stmt = connection.prepareStatement("UPDATE DM_ENROLMENT_OPERATION_MAPPING O SET O.STATUS=? " + + stmt = connection.prepareStatement("UPDATE DM_ENROLMENT_OP_MAPPING O SET O.STATUS=? " + "WHERE O.ENROLMENT_ID=? and O.OPERATION_ID=?"); stmt.setString(1, status.toString()); stmt.setInt(2, enrolmentId); @@ -203,7 +203,7 @@ public class OperationDAOImpl implements OperationDAO { String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATION_CODE " + " FROM (SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, STATUS," + "OPERATION_CODE FROM DM_OPERATION WHERE id = ?) o INNER JOIN (SELECT * FROM " + - "DM_ENROLMENT_OPERATION_MAPPING dm where dm.OPERATION_ID = ? AND dm.ENROLMENT_ID = ?) om " + + "DM_ENROLMENT_OP_MAPPING dm where dm.OPERATION_ID = ? AND dm.ENROLMENT_ID = ?) om " + "ON o.ID = om.OPERATION_ID "; stmt = conn.prepareStatement(sql); stmt.setInt(1, operationId); @@ -243,7 +243,7 @@ public class OperationDAOImpl implements OperationDAO { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE " + "FROM DM_OPERATION o " + - "INNER JOIN (SELECT * FROM DM_ENROLMENT_OPERATION_MAPPING dm " + + "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP ASC"; stmt = conn.prepareStatement(sql); stmt.setInt(1, enrolmentId); @@ -283,7 +283,7 @@ public class OperationDAOImpl implements OperationDAO { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " + "OPERATION_CODE, om.STATUS FROM DM_OPERATION o " + - "INNER JOIN (SELECT * FROM DM_ENROLMENT_OPERATION_MAPPING dm " + + "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP ASC"; stmt = conn.prepareStatement(sql); stmt.setInt(1, enrolmentId); @@ -320,7 +320,7 @@ public class OperationDAOImpl implements OperationDAO { Connection connection = OperationManagementDAOFactory.getConnection(); stmt = connection.prepareStatement("SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " + "OPERATION_CODE FROM DM_OPERATION o " + - "INNER JOIN (SELECT * FROM DM_ENROLMENT_OPERATION_MAPPING dm " + + "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID " + "ORDER BY o.CREATED_TIMESTAMP ASC LIMIT 1"); stmt.setInt(1, enrolmentId); @@ -361,7 +361,7 @@ public class OperationDAOImpl implements OperationDAO { String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE FROM " + "(SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE " + "FROM DM_OPERATION o WHERE o.TYPE = ?) o " + - "INNER JOIN (SELECT * FROM DM_ENROLMENT_OPERATION_MAPPING dm " + + "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP ASC"; stmt = conn.prepareStatement(sql); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java index 9f69b1a6f5..71de8548be 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java @@ -35,7 +35,7 @@ public class OperationMappingDAOImpl implements OperationMappingDAO { PreparedStatement stmt = null; try { Connection conn = OperationManagementDAOFactory.getConnection(); - String sql = "INSERT INTO DM_ENROLMENT_OPERATION_MAPPING(ENROLMENT_ID, OPERATION_ID, STATUS) VALUES (?, ?,?)"; + String sql = "INSERT INTO DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID, OPERATION_ID, STATUS) VALUES (?, ?,?)"; stmt = conn.prepareStatement(sql); stmt.setInt(1, deviceId); stmt.setInt(2, operationId); @@ -54,7 +54,7 @@ public class OperationMappingDAOImpl implements OperationMappingDAO { PreparedStatement stmt = null; try { Connection conn = OperationManagementDAOFactory.getConnection(); - String sql = "DELETE FROM DM_ENROLMENT_OPERATION_MAPPING WHERE ENROLMENT_ID = ? AND OPERATION_ID = ?"; + String sql = "DELETE FROM DM_ENROLMENT_OP_MAPPING WHERE ENROLMENT_ID = ? AND OPERATION_ID = ?"; stmt = conn.prepareStatement(sql); stmt.setInt(1, 0); stmt.setInt(2, operationId); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java index 4f501bb8a6..07c6112bd6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java @@ -164,7 +164,7 @@ public class PolicyOperationDAOImpl extends OperationDAOImpl { try { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "SELECT po.OPERATION_ID, ENABLED, OPERATION_DETAILS FROM DM_POLICY_OPERATION po " + - "INNER JOIN (SELECT * FROM DM_ENROLMENT_OPERATION_MAPPING WHERE ENROLMENT_ID = ? " + + "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING WHERE ENROLMENT_ID = ? " + "AND STATUS = ?) dm ON dm.OPERATION_ID = po.OPERATION_ID"; stmt = conn.prepareStatement(sql); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java index 56da664251..664ac370da 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java @@ -167,7 +167,7 @@ public class ProfileOperationDAOImpl extends OperationDAOImpl { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "Select po.OPERATION_ID, ENABLED, OPERATION_DETAILS from DM_PROFILE_OPERATION po " + "INNER JOIN " + - "(Select * From DM_ENROLMENT_OPERATION_MAPPING WHERE ENROLMENT_ID=? " + + "(Select * From DM_ENROLMENT_OP_MAPPING WHERE ENROLMENT_ID=? " + "AND STATUS=?) dm ON dm.OPERATION_ID = po.OPERATION_ID"; stmt = conn.prepareStatement(sql); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql index 8919ac5441..0eaa54a00f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql @@ -64,7 +64,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OPERATION_MAPPING ( +CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( ID INTEGER AUTO_INCREMENT NOT NULL, ENROLMENT_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL, diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql index 6af5c86031..9f488a8694 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql @@ -79,7 +79,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION ( DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OPERATION_MAPPING ( +CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( ID INTEGER AUTO_INCREMENT NOT NULL, ENROLMENT_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL, 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 f0c0e17f1a..1959c2f241 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 @@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OPERATION_MAPPING ( +CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( ID INTEGER AUTO_INCREMENT NOT NULL, ENROLMENT_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL, 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 de4c58d2df..7e824bfd95 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 @@ -73,7 +73,7 @@ CREATE TABLE DM_ENROLMENT ( DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE DM_ENROLMENT_OPERATION_MAPPING ( +CREATE TABLE DM_ENROLMENT_OP_MAPPING ( ID INTEGER IDENTITY NOT NULL, ENROLMENT_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL, 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 e0b9135f24..a8a64597d6 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 @@ -81,7 +81,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( )ENGINE = InnoDB; -CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OPERATION_MAPPING ( +CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( ID INTEGER AUTO_INCREMENT NOT NULL, ENROLMENT_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL, @@ -397,4 +397,3 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( )ENGINE = InnoDB; -- END NOTIFICATION TABLES -- - 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 0b82e2e525..fa522c3dc7 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 @@ -117,7 +117,7 @@ BEGIN END; / -CREATE TABLE DM_ENROLMENT_OPERATION_MAPPING ( +CREATE TABLE DM_ENROLMENT_OP_MAPPING ( ID NUMBER(10) NOT NULL, ENROLMENT_ID NUMBER(10) NOT NULL, OPERATION_ID NUMBER(10) NOT NULL, @@ -130,13 +130,13 @@ CREATE TABLE DM_ENROLMENT_OPERATION_MAPPING ( ); -- Generate ID using sequence and trigger -CREATE SEQUENCE DM_ENROLMENT_OPERATION_MAPPING_seq START WITH 1 INCREMENT BY 1; +CREATE SEQUENCE DM_ENROLMENT_OP_MAPPING_seq START WITH 1 INCREMENT BY 1; -CREATE OR REPLACE TRIGGER DM_ENROLMENT_OPERATION_MAPPING_seq_tr - BEFORE INSERT ON DM_ENROLMENT_OPERATION_MAPPING FOR EACH ROW +CREATE OR REPLACE TRIGGER DM_ENROLMENT_OP_MAPPING_seq_tr + BEFORE INSERT ON DM_ENROLMENT_OP_MAPPING FOR EACH ROW WHEN (NEW.ID IS NULL) BEGIN - SELECT DM_ENROLMENT_OPERATION_MAPPING_seq.NEXTVAL INTO :NEW.ID FROM DUAL; + SELECT DM_ENROLMENT_OP_MAPPING_seq.NEXTVAL INTO :NEW.ID FROM DUAL; END; / 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 ac0eef4f66..9e6ecafa39 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 @@ -1,9 +1,9 @@ -CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE ( +CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE ( ID BIGSERIAL PRIMARY KEY, NAME VARCHAR(300) DEFAULT NULL ); -CREATE TABLE IF NOT EXISTS DM_DEVICE ( +CREATE TABLE IF NOT EXISTS DM_DEVICE ( ID BIGSERIAL NOT NULL PRIMARY KEY, DESCRIPTION TEXT DEFAULT NULL, NAME VARCHAR(100) DEFAULT NULL, @@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE ( REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_OPERATION ( +CREATE TABLE IF NOT EXISTS DM_OPERATION ( ID BIGSERIAL NOT NULL PRIMARY KEY, TYPE VARCHAR(50) NOT NULL, CREATED_TIMESTAMP TIMESTAMP NOT NULL, @@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( OPERATION_CODE VARCHAR(1000) NOT NULL ); -CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION ( +CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION ( OPERATION_ID INTEGER NOT NULL, OPERATION_CONFIG BYTEA DEFAULT NULL, PRIMARY KEY (OPERATION_ID), @@ -30,7 +30,7 @@ CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION ( DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION ( +CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION ( OPERATION_ID INTEGER NOT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, PRIMARY KEY (OPERATION_ID), @@ -38,7 +38,7 @@ CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION ( DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_POLICY_OPERATION ( +CREATE TABLE IF NOT EXISTS DM_POLICY_OPERATION ( OPERATION_ID INTEGER NOT NULL, ENABLED INTEGER NOT NULL DEFAULT 0, OPERATION_DETAILS BYTEA DEFAULT NULL, @@ -47,7 +47,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_OPERATION ( DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION ( +CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION ( OPERATION_ID INTEGER NOT NULL, ENABLED INTEGER NOT NULL DEFAULT 0, OPERATION_DETAILS BYTEA DEFAULT NULL, @@ -56,7 +56,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION ( DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( +CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( ID BIGSERIAL NOT NULL PRIMARY KEY, DEVICE_ID INTEGER NOT NULL, OWNER VARCHAR(50) NOT NULL, @@ -69,7 +69,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OPERATION_MAPPING ( +CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( ID BIGSERIAL NOT NULL PRIMARY KEY, ENROLMENT_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL, @@ -80,7 +80,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OPERATION_MAPPING ( DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE ( +CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE ( ID BIGSERIAL NOT NULL PRIMARY KEY, DEVICE_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL, @@ -93,7 +93,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE ( -- POLICY RELATED TABLES --- -CREATE TABLE IF NOT EXISTS DM_PROFILE ( +CREATE TABLE DM_PROFILE ( ID BIGSERIAL NOT NULL PRIMARY KEY, PROFILE_NAME VARCHAR(45) NOT NULL , TENANT_ID INTEGER NOT NULL , @@ -107,8 +107,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE ( ON UPDATE NO ACTION ); - -CREATE TABLE IF NOT EXISTS DM_POLICY ( +CREATE TABLE DM_POLICY ( ID BIGSERIAL NOT NULL PRIMARY KEY, NAME VARCHAR(45) DEFAULT NULL , DESCRIPTION VARCHAR(1000) NULL, @@ -126,7 +125,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY ( ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY ( +CREATE TABLE DM_DEVICE_POLICY ( ID BIGSERIAL NOT NULL PRIMARY KEY, DEVICE_ID INTEGER NOT NULL , ENROLMENT_ID INTEGER NOT NULL, @@ -144,7 +143,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY ( ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY ( +CREATE TABLE DM_DEVICE_TYPE_POLICY ( ID INTEGER NOT NULL, DEVICE_TYPE_ID INTEGER NOT NULL , POLICY_ID INTEGER NOT NULL , @@ -161,7 +160,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY ( ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES ( +CREATE TABLE DM_PROFILE_FEATURES ( ID BIGSERIAL NOT NULL PRIMARY KEY, PROFILE_ID INTEGER NOT NULL, FEATURE_CODE VARCHAR(30) NOT NULL, @@ -175,7 +174,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES ( ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY ( +CREATE TABLE DM_ROLE_POLICY ( ID BIGSERIAL NOT NULL PRIMARY KEY, ROLE_NAME VARCHAR(45) NOT NULL , POLICY_ID INTEGER NOT NULL, @@ -186,7 +185,7 @@ CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY ( ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_USER_POLICY ( +CREATE TABLE DM_USER_POLICY ( ID BIGSERIAL NOT NULL PRIMARY KEY, POLICY_ID INT NOT NULL , USERNAME VARCHAR(45) NOT NULL, @@ -197,7 +196,7 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY ( ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED ( +CREATE TABLE DM_DEVICE_POLICY_APPLIED ( ID BIGSERIAL NOT NULL PRIMARY KEY, DEVICE_ID INTEGER NOT NULL , ENROLMENT_ID INTEGER NOT NULL, @@ -220,13 +219,13 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED ( ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_CRITERIA ( +CREATE TABLE IF NOT EXISTS DM_CRITERIA ( ID BIGSERIAL NOT NULL PRIMARY KEY, TENANT_ID INT NOT NULL, NAME VARCHAR(50) NULL ); -CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA ( +CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA ( ID BIGSERIAL NOT NULL PRIMARY KEY, CRITERIA_ID INT NOT NULL, POLICY_ID INT NOT NULL, @@ -242,7 +241,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA ( ON UPDATE NO ACTION ); -CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES ( +CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES ( ID BIGSERIAL NOT NULL PRIMARY KEY, POLICY_CRITERION_ID INT NOT NULL, PROP_KEY VARCHAR(45) NULL, @@ -256,8 +255,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES ( ); COMMENT ON COLUMN DM_POLICY_CRITERIA_PROPERTIES.CONTENT IS 'This is used to '; - -CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS ( +CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS ( ID BIGSERIAL NOT NULL PRIMARY KEY, DEVICE_ID INTEGER NOT NULL, ENROLMENT_ID INTEGER NOT NULL, @@ -276,16 +274,14 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS ( ); CREATE UNIQUE INDEX DEVICE_ID_UNIQUE ON DM_POLICY_COMPLIANCE_STATUS (DEVICE_ID ASC); - -CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT ( +CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT ( ID BIGSERIAL NOT NULL PRIMARY KEY, POLICY_ID INTEGER NOT NULL, DEVICE_TYPE_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL ); - -CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES ( +CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES ( ID BIGSERIAL NOT NULL PRIMARY KEY, COMPLIANCE_STATUS_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, @@ -298,8 +294,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES ( ON UPDATE NO ACTION ); - -CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( +CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( ID BIGSERIAL NOT NULL PRIMARY KEY, DEVICE_ID INTEGER NOT NULL, OWNER VARCHAR(50) NOT NULL, @@ -312,8 +307,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); - -CREATE TABLE IF NOT EXISTS DM_APPLICATION ( +CREATE TABLE IF NOT EXISTS DM_APPLICATION ( ID BIGSERIAL NOT NULL PRIMARY KEY, NAME VARCHAR(50) NOT NULL, APP_IDENTIFIER VARCHAR(150) NOT NULL, @@ -330,7 +324,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION ( -- POLICY RELATED TABLES FINISHED -- -- NOTIFICATION TABLE -- -CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( +CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( NOTIFICATION_ID BIGSERIAL NOT NULL PRIMARY KEY, DEVICE_ID INTEGER NOT NULL, OPERATION_ID INTEGER NOT NULL, @@ -342,5 +336,5 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( CONSTRAINT fk_dm_operation_notification FOREIGN KEY (OPERATION_ID) REFERENCES DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); --- NOTIFICATION TABLE END -- +-- NOTIFICATION TABLE END -- \ No newline at end of file From 7c0996270f363b30c1240df29a5a0241c4447d3d Mon Sep 17 00:00:00 2001 From: harshanl Date: Thu, 29 Oct 2015 17:53:09 +0530 Subject: [PATCH 4/6] Fixed EMM-887 --- .../DynamicClientRegistrationServiceImpl.java | 4 ++-- .../DynamicClientWebAppRegistrationManager.java | 12 ++++++------ .../DynamicClientWebAppRegistrationUtil.java | 2 +- .../authenticator/OAuthAuthenticator.java | 16 ++++++---------- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java index 0679b5f1e2..859a0d8c55 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationServiceImpl.java @@ -123,7 +123,7 @@ public class DynamicClientRegistrationServiceImpl implements DynamicClientRegist boolean isSaaSApp = profile.isSaasApp(); String audience = profile.getAudience(); String assertionConsumerURL = profile.getAssertionConsumerURL(); - String recepientValidationURL = profile.getRecepientValidationURL(); + String recipientValidationURL = profile.getRecepientValidationURL(); if (userId == null || userId.isEmpty()) { return null; @@ -223,7 +223,7 @@ public class DynamicClientRegistrationServiceImpl implements DynamicClientRegist samlssoServiceProviderDTO.setDoSignResponse(true); samlssoServiceProviderDTO.setRequestedAudiences(new String[] { audience }); samlssoServiceProviderDTO.setDefaultAssertionConsumerUrl(assertionConsumerURL); - samlssoServiceProviderDTO.setRequestedRecipients(new String[] {recepientValidationURL}); + samlssoServiceProviderDTO.setRequestedRecipients(new String[] {recipientValidationURL}); samlssoServiceProviderDTO.setDoSignAssertions(true); diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java index fbb6023251..14e2ca00b6 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/DynamicClientWebAppRegistrationManager.java @@ -117,7 +117,7 @@ public class DynamicClientWebAppRegistrationManager { } public void initiateDynamicClientRegistration() { - String requiredDynamicClientRegistration, webAppName; + String requiredDynamicClientRegistration, webAppName, serviceProviderName; ServletContext servletContext; RegistrationProfile registrationProfile; OAuthAppDetails oAuthAppDetails; @@ -131,15 +131,15 @@ public class DynamicClientWebAppRegistrationManager { while (enumeration.hasMoreElements()) { oAuthAppDetails = new OAuthAppDetails(); webAppName = (String) enumeration.nextElement(); + serviceProviderName = DynamicClientWebAppRegistrationUtil.getUserName() + "_" + webAppName; servletContext = DynamicClientWebAppRegistrationManager.webAppContexts.get(webAppName); requiredDynamicClientRegistration = servletContext.getInitParameter( DynamicClientWebAppRegistrationConstants.DYNAMIC_CLIENT_REQUIRED_FLAG); //Java web-app section - if ((requiredDynamicClientRegistration != null) && (Boolean. - parseBoolean( - requiredDynamicClientRegistration))) { + if ((requiredDynamicClientRegistration != null) && (Boolean.parseBoolean( + requiredDynamicClientRegistration))) { //Check whether this is an already registered application - if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(webAppName)) { + if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(serviceProviderName)) { //Construct the RegistrationProfile registrationProfile = DynamicClientWebAppRegistrationUtil. constructRegistrationProfile(servletContext, webAppName); @@ -155,7 +155,7 @@ public class DynamicClientWebAppRegistrationManager { JaggeryOAuthConfigurationSettings jaggeryOAuthConfigurationSettings = DynamicClientWebAppRegistrationUtil.getJaggeryAppOAuthSettings(servletContext); if (jaggeryOAuthConfigurationSettings.isRequireDynamicClientRegistration()) { - if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(webAppName)) { + if (!dynamicClientWebAppRegistrationManager.isRegisteredOAuthApplication(serviceProviderName)) { registrationProfile = DynamicClientWebAppRegistrationUtil. constructRegistrationProfile(jaggeryOAuthConfigurationSettings, webAppName); diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java index 9540d0e9e8..034e1e3f8c 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/src/main/java/org/wso2/carbon/dynamic/client/web/app/registration/util/DynamicClientWebAppRegistrationUtil.java @@ -116,7 +116,7 @@ public class DynamicClientWebAppRegistrationUtil { resource.setContent(writer.toString()); resource.setMediaType(DynamicClientWebAppRegistrationConstants.ContentTypes.MEDIA_TYPE_XML); String resourcePath = DynamicClientWebAppRegistrationConstants.OAUTH_APP_DATA_REGISTRY_PATH + "/" + - oAuthAppDetails.getWebAppName(); + oAuthAppDetails.getClientName(); status = DynamicClientWebAppRegistrationUtil.putRegistryResource(resourcePath, resource); } catch (RegistryException e) { throw new DynamicClientRegistrationException( diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java index da7734a046..abe4eac0c4 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java @@ -102,7 +102,8 @@ public class OAuthAuthenticator implements WebappAuthenticator { resourceContextParam.setValue(requestUri + ":" + requestMethod); OAuth2TokenValidationRequestDTO.TokenValidationContextParam[] - tokenValidationContextParams = new OAuth2TokenValidationRequestDTO.TokenValidationContextParam[1]; + tokenValidationContextParams = + new OAuth2TokenValidationRequestDTO.TokenValidationContextParam[1]; tokenValidationContextParams[0] = resourceContextParam; dto.setContext(tokenValidationContextParams); @@ -110,14 +111,9 @@ public class OAuthAuthenticator implements WebappAuthenticator { AuthenticatorFrameworkDataHolder.getInstance().getoAuth2TokenValidationService().validate(dto); if (oAuth2TokenValidationResponseDTO.isValid()) { String username = oAuth2TokenValidationResponseDTO.getAuthorizedUser(); - // try { - authenticationInfo.setUsername(username); - authenticationInfo.setTenantDomain(MultitenantUtils.getTenantDomain(username)); - authenticationInfo.setTenantId(Utils.getTenantIdOFUser(username)); -// } catch (AuthenticationException e) { -// throw new AuthenticationException( -// "Error occurred while retrieving the tenant ID of user '" + username + "'", e); -// } + authenticationInfo.setUsername(username); + authenticationInfo.setTenantDomain(MultitenantUtils.getTenantDomain(username)); + authenticationInfo.setTenantId(Utils.getTenantIdOFUser(username)); if (oAuth2TokenValidationResponseDTO.isValid()) { authenticationInfo.setStatus(Status.CONTINUE); } @@ -148,7 +144,7 @@ public class OAuthAuthenticator implements WebappAuthenticator { tokenValue = tokenValue.substring(matcher.end()); } } - if(log.isDebugEnabled()) { + if (log.isDebugEnabled()) { log.debug("Oauth Token : " + tokenValue); } return tokenValue; From c00b1ee713e74b48cf5646711106c615a7838b8e Mon Sep 17 00:00:00 2001 From: Kasun Delgolla Date: Thu, 29 Oct 2015 20:46:48 +0530 Subject: [PATCH 5/6] Committing fix for JIRA- EMM-860 --- .../carbon/device/mgt/core/dao/DeviceDAO.java | 9 ++++++ .../core/dao/impl/GenericDeviceDAOImpl.java | 29 ++++++++++++++++++- .../core/dao/impl/OracleDeviceDAOImpl.java | 27 ++++++++++++++++- .../dao/impl/PostgreSQLDeviceDAOImpl.java | 27 ++++++++++++++++- .../core/dao/impl/SQLServerDeviceDAOImpl.java | 28 +++++++++++++++++- .../dao/util/DeviceManagementDAOUtil.java | 8 +++++ .../DeviceManagementProviderService.java | 4 +++ .../DeviceManagementProviderServiceImpl.java | 18 +++++++++++- 8 files changed, 145 insertions(+), 5 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java index 6b593e85c6..f3d878393f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java @@ -23,6 +23,7 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo.Status; import org.wso2.carbon.device.mgt.common.PaginationResult; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; import java.util.HashMap; import java.util.List; @@ -163,6 +164,14 @@ public interface DeviceDAO { */ int getDeviceCount(int tenantId) throws DeviceManagementDAOException; + /** + * This method is used to retrieve the available device types of a given tenant. + * + * @return returns list of device types. + * @throws DeviceManagementDAOException + */ + List getDeviceTypes() throws DeviceManagementDAOException; + /** * This method is used to retrieve devices of a given device name. * diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/GenericDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/GenericDeviceDAOImpl.java index f24b3c761e..4df319c577 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/GenericDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/GenericDeviceDAOImpl.java @@ -24,6 +24,7 @@ import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; import java.sql.Connection; import java.sql.PreparedStatement; @@ -120,7 +121,33 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { return result; } - private Connection getConnection() throws SQLException { + @Override + public List getDeviceTypes() + throws DeviceManagementDAOException { + Connection conn; + PreparedStatement stmt = null; + ResultSet rs = null; + List deviceTypes; + try { + conn = this.getConnection(); + String sql = "SELECT t.ID, t.NAME " + + "FROM DM_DEVICE_TYPE t"; + stmt = conn.prepareStatement(sql); + rs = stmt.executeQuery(); + deviceTypes = new ArrayList<>(); + while (rs.next()) { + DeviceType deviceType = DeviceManagementDAOUtil.loadDeviceType(rs); + deviceTypes.add(deviceType); + } + } catch (SQLException e) { + throw new DeviceManagementDAOException("Error occurred while listing device types.", e); + } finally { + DeviceManagementDAOUtil.cleanupResources(stmt, rs); + } + return deviceTypes; + } + + private Connection getConnection() throws SQLException { return DeviceManagementDAOFactory.getConnection(); } } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/OracleDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/OracleDeviceDAOImpl.java index 2524945f59..92d790fe60 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/OracleDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/OracleDeviceDAOImpl.java @@ -23,6 +23,7 @@ import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; import java.sql.Connection; import java.sql.PreparedStatement; @@ -116,7 +117,31 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl { return result; } - private Connection getConnection() throws SQLException { + @Override public List getDeviceTypes() throws DeviceManagementDAOException { + Connection conn; + PreparedStatement stmt = null; + ResultSet rs = null; + List deviceTypes; + try { + conn = this.getConnection(); + String sql = "SELECT t.ID, t.NAME " + + "FROM DM_DEVICE_TYPE t"; + stmt = conn.prepareStatement(sql); + rs = stmt.executeQuery(); + deviceTypes = new ArrayList<>(); + while (rs.next()) { + DeviceType deviceType = DeviceManagementDAOUtil.loadDeviceType(rs); + deviceTypes.add(deviceType); + } + } catch (SQLException e) { + throw new DeviceManagementDAOException("Error occurred while listing device types.", e); + } finally { + DeviceManagementDAOUtil.cleanupResources(stmt, rs); + } + return deviceTypes; + } + + private Connection getConnection() throws SQLException { return DeviceManagementDAOFactory.getConnection(); } } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/PostgreSQLDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/PostgreSQLDeviceDAOImpl.java index 5a65c807c2..26b0d34d9d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/PostgreSQLDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/PostgreSQLDeviceDAOImpl.java @@ -23,6 +23,7 @@ import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; import java.sql.Connection; import java.sql.PreparedStatement; @@ -116,7 +117,31 @@ public class PostgreSQLDeviceDAOImpl extends AbstractDeviceDAOImpl { return result; } - private Connection getConnection() throws SQLException { + @Override public List getDeviceTypes() throws DeviceManagementDAOException { + Connection conn; + PreparedStatement stmt = null; + ResultSet rs = null; + List deviceTypes; + try { + conn = this.getConnection(); + String sql = "SELECT t.ID, t.NAME " + + "FROM DM_DEVICE_TYPE t"; + stmt = conn.prepareStatement(sql); + rs = stmt.executeQuery(); + deviceTypes = new ArrayList<>(); + while (rs.next()) { + DeviceType deviceType = DeviceManagementDAOUtil.loadDeviceType(rs); + deviceTypes.add(deviceType); + } + } catch (SQLException e) { + throw new DeviceManagementDAOException("Error occurred while listing device types.", e); + } finally { + DeviceManagementDAOUtil.cleanupResources(stmt, rs); + } + return deviceTypes; + } + + private Connection getConnection() throws SQLException { return DeviceManagementDAOFactory.getConnection(); } } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/SQLServerDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/SQLServerDeviceDAOImpl.java index 224c7ee280..21c3ef8848 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/SQLServerDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/SQLServerDeviceDAOImpl.java @@ -23,6 +23,7 @@ import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; import java.sql.Connection; import java.sql.PreparedStatement; @@ -116,7 +117,32 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl { return result; } - private Connection getConnection() throws SQLException { + @Override + public List getDeviceTypes() throws DeviceManagementDAOException { + Connection conn; + PreparedStatement stmt = null; + ResultSet rs = null; + List deviceTypes; + try { + conn = this.getConnection(); + String sql = "SELECT t.ID, t.NAME " + + "FROM DM_DEVICE_TYPE t"; + stmt = conn.prepareStatement(sql); + rs = stmt.executeQuery(); + deviceTypes = new ArrayList<>(); + while (rs.next()) { + DeviceType deviceType = DeviceManagementDAOUtil.loadDeviceType(rs); + deviceTypes.add(deviceType); + } + } catch (SQLException e) { + throw new DeviceManagementDAOException("Error occurred while listing device types.", e); + } finally { + DeviceManagementDAOUtil.cleanupResources(stmt, rs); + } + return deviceTypes; + } + + private Connection getConnection() throws SQLException { return DeviceManagementDAOFactory.getConnection(); } } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java index 201265f4d5..c7bc50eb2b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java @@ -23,6 +23,7 @@ import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.tenant.TenantManager; @@ -153,4 +154,11 @@ public final class DeviceManagementDAOUtil { device.setEnrolmentInfo(loadEnrolment(rs)); return device; } + + public static DeviceType loadDeviceType(ResultSet rs) throws SQLException { + DeviceType deviceType = new DeviceType(); + deviceType.setId(rs.getInt("ID")); + deviceType.setName(rs.getString("NAME")); + return deviceType; + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java index aead0bda52..5f0677756a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java @@ -24,6 +24,8 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; + import java.util.List; /** @@ -127,6 +129,8 @@ public interface DeviceManagementProviderService extends OperationManager { Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException; + List getAvailableDeviceTypes() throws DeviceManagementException; + boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException; boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index f28c7f8bcf..054e4c5e3b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -617,7 +617,23 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return device; } - @Override + @Override + public List getAvailableDeviceTypes() throws DeviceManagementException { + List deviceTypes; + try { + DeviceManagementDAOFactory.openConnection(); + deviceTypes = deviceDAO.getDeviceTypes(); + } catch (DeviceManagementDAOException e) { + throw new DeviceManagementException("Error occurred while obtaining the device types.", e); + } catch (SQLException e) { + throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + return deviceTypes; + } + + @Override public boolean updateDeviceInfo(DeviceIdentifier deviceId, Device device) throws DeviceManagementException { DeviceManager deviceManager = this.getDeviceManager(deviceId.getType()); if (deviceManager == null) { From d2b8224f318291254fbdcfd9f3f8568a17b15fa5 Mon Sep 17 00:00:00 2001 From: mharindu Date: Fri, 30 Oct 2015 11:28:57 +0530 Subject: [PATCH 6/6] Changed the VARCHAR size of application identifier --- .../src/main/resources/dbscripts/cdm/h2.sql | 4 ++-- .../src/main/resources/dbscripts/cdm/mssql.sql | 2 +- .../src/main/resources/dbscripts/cdm/mysql.sql | 2 +- .../src/main/resources/dbscripts/cdm/oracle.sql | 2 +- .../src/main/resources/dbscripts/cdm/postgresql.sql | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) 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 1959c2f241..10e15533ed 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 @@ -355,8 +355,8 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( CREATE TABLE IF NOT EXISTS DM_APPLICATION ( ID INTEGER AUTO_INCREMENT NOT NULL, - NAME VARCHAR(50) NOT NULL, - APP_IDENTIFIER VARCHAR(50) NOT NULL, + NAME VARCHAR(150) NOT NULL, + APP_IDENTIFIER VARCHAR(150) NOT NULL, PLATFORM VARCHAR(50) DEFAULT NULL, CATEGORY VARCHAR(50) NULL, VERSION VARCHAR(50) NULL, 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 f71fbdd52c..c61879a5e3 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 @@ -358,7 +358,7 @@ CREATE TABLE DM_ENROLMENT ( CREATE TABLE DM_APPLICATION ( ID INTEGER IDENTITY NOT NULL, - NAME VARCHAR(50) NOT NULL, + NAME VARCHAR(150) NOT NULL, APP_IDENTIFIER VARCHAR(150) NOT NULL, PLATFORM VARCHAR(50) DEFAULT NULL, CATEGORY VARCHAR(50) NULL, 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 a8a64597d6..00a519c65e 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 @@ -352,7 +352,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( CREATE TABLE IF NOT EXISTS DM_APPLICATION ( ID INTEGER AUTO_INCREMENT NOT NULL, - NAME VARCHAR(50) NOT NULL, + NAME VARCHAR(150) NOT NULL, APP_IDENTIFIER VARCHAR(150) NOT NULL, PLATFORM VARCHAR(50) DEFAULT NULL, CATEGORY VARCHAR(50) NULL, 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 fa522c3dc7..51c6900506 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 @@ -551,7 +551,7 @@ END; CREATE TABLE DM_APPLICATION ( ID NUMBER(10) NOT NULL, - NAME VARCHAR2(50) NOT NULL, + NAME VARCHAR2(150) NOT NULL, APP_IDENTIFIER VARCHAR2(150) NOT NULL, PLATFORM VARCHAR2(50) DEFAULT NULL, CATEGORY VARCHAR2(50) NULL, 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 e68e127f06..d874edf690 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 @@ -309,7 +309,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( CREATE TABLE IF NOT EXISTS DM_APPLICATION ( ID BIGSERIAL NOT NULL PRIMARY KEY, - NAME VARCHAR(50) NOT NULL, + NAME VARCHAR(150) NOT NULL, APP_IDENTIFIER VARCHAR(150) NOT NULL, PLATFORM VARCHAR(50) DEFAULT NULL, CATEGORY VARCHAR(50) NULL,