From 7fb3a594b88492205066d3cc393eb1f84d43968f Mon Sep 17 00:00:00 2001 From: manoj Date: Fri, 29 May 2015 18:23:42 +0530 Subject: [PATCH] Instansiate Policy DAO in operations dao factory --- .../device/mgt/core/operation/mgt/OperationManagerImpl.java | 1 + .../core/operation/mgt/dao/OperationManagementDAOFactory.java | 4 ++++ .../core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java index 48a7fc7bc3..1678e7b477 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -60,6 +60,7 @@ public class OperationManagerImpl implements OperationManager { commandOperationDAO = OperationManagementDAOFactory.getCommandOperationDAO(); configOperationDAO = OperationManagementDAOFactory.getConfigOperationDAO(); profileOperationDAO = OperationManagementDAOFactory.getProfileOperationDAO(); + policyOperationDAO = OperationManagementDAOFactory.getPolicyOperationDAO(); operationMappingDAO = OperationManagementDAOFactory.getOperationMappingDAO(); operationDAO = OperationManagementDAOFactory.getOperationDAO(); deviceManagementService = new DeviceManagementServiceImpl(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java index 6879cd553b..117420ca87 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java @@ -49,6 +49,10 @@ public class OperationManagementDAOFactory { return new ProfileOperationDAOImpl(); } + public static OperationDAO getPolicyOperationDAO() { + return new PolicyOperationDAOImpl(); + } + public static OperationMappingDAO getOperationMappingDAO() { return new OperationMappingDAOImpl(); } 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 03d1b080de..e5d4c0db25 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 @@ -182,7 +182,7 @@ public class ConfigOperationDAOImpl extends OperationDAOImpl { try { Connection conn = OperationManagementDAOFactory.getConnection(); - String sql = "Select co.OPERATION_ID, ENABLED, OPERATION_DETAILS from DM_CONFIG_OPERATION co " + + String sql = "Select co.OPERATION_ID, co.OPERATION_CONFIG from DM_CONFIG_OPERATION co " + "INNER JOIN " + "(Select * From DM_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID=? " + "AND STATUS=?) dm ON dm.OPERATION_ID = co.OPERATION_ID"; @@ -194,7 +194,7 @@ public class ConfigOperationDAOImpl extends OperationDAOImpl { rs = stmt.executeQuery(); while (rs.next()) { - byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); + byte[] operationDetails = rs.getBytes("OPERATION_CONFIG"); bais = new ByteArrayInputStream(operationDetails); ois = new ObjectInputStream(bais); configOperation = (ConfigOperation) ois.readObject();