From 767ea70436bb597cc5aa69bf406b2366e65d06e6 Mon Sep 17 00:00:00 2001 From: Dileesha Rajapakse Date: Wed, 18 Nov 2015 22:05:15 +0530 Subject: [PATCH] Refactored CommandOperation DAO class --- .../mgt/dao/impl/CommandOperationDAOImpl.java | 3 ++- .../src/main/resources/dbscripts/cdm/postgresql.sql | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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 e5663b38445..8fdd35591a7 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 @@ -134,7 +134,8 @@ public class CommandOperationDAOImpl extends OperationDAOImpl { while (rs.next()) { commandOperation = new CommandOperation(); commandOperation.setId(rs.getInt("ID")); - commandOperation.setEnabled(rs.getInt("ENABLED") != 0); + //commandOperation.setEnabled(rs.getInt("ENABLED") != 0); + commandOperation.setEnabled(rs.getBoolean("ENABLED") != false); commandOperation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); commandOperation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); commandOperation.setCreatedTimeStamp(rs.getString("CREATED_TIMESTAMP")); 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 1740e5d551b..f42655f7903 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 @@ -316,6 +316,17 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION ( TENANT_ID INTEGER NOT NULL ); +CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING ( + ID BIGSERIAL NOT NULL PRIMARY KEY, + DEVICE_ID INTEGER NOT NULL, + APPLICATION_ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES + DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT fk_dm_application FOREIGN KEY (APPLICATION_ID) REFERENCES + DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); + -- POLICY RELATED TABLES FINISHED -- -- NOTIFICATION TABLE --