From 4198764cb27b3f45ff26b632a93c58ef306ec5ca Mon Sep 17 00:00:00 2001 From: Dilshan Edirisuriya Date: Wed, 1 Apr 2015 19:23:04 +0530 Subject: [PATCH 1/2] Implementing services --- .../mgt/core/DeviceManagementServiceProviderImpl.java | 4 ++-- .../mgt/core/service/DeviceManagementServiceImpl.java | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java index bfdce76945..4fbfde4dac 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java @@ -357,13 +357,13 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ @Override public Operation getNextPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException { - return null; + return operationManager.getNextPendingOperation(deviceId); } @Override public Operation updateOperation(int id, DeviceIdentifier deviceIdentifier, String payLoad) throws OperationManagementException { - return null; + return operationManager.updateOperation(id, deviceIdentifier, payLoad); } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementServiceImpl.java index 7c88e429cc..cef57fffa6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementServiceImpl.java @@ -116,7 +116,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @Override public boolean addOperation(Operation operation, - List devices) throws OperationManagementException { + List devices) throws OperationManagementException { return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(operation, devices); } @@ -133,13 +133,14 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @Override public Operation getNextPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException { - return null; + return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getNextPendingOperation(deviceId); } @Override public Operation updateOperation(int operationId, DeviceIdentifier deviceIdentifier, String responsePayLoad) throws OperationManagementException { - return null; + return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider(). + updateOperation(operationId, deviceIdentifier, responsePayLoad); } @Override From 52b48f3223c1bdd1768123186dc304163912292a Mon Sep 17 00:00:00 2001 From: Dilshan Edirisuriya Date: Wed, 1 Apr 2015 19:32:25 +0530 Subject: [PATCH 2/2] Reading from enum --- .../operation/mgt/dao/impl/OperationDAOImpl.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 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/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 0db1da2dbf..52e74ea845 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 @@ -20,20 +20,18 @@ package org.wso2.carbon.device.mgt.core.operation.mgt.dao.impl; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; -import org.wso2.carbon.device.mgt.core.operation.mgt.dao.*; +import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationDAO; +import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; +import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; +import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; -import javax.sql.DataSource; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.ObjectInputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; -import java.sql.SQLException; import java.util.List; public class OperationDAOImpl implements OperationDAO { @@ -165,11 +163,11 @@ public class OperationDAOImpl implements OperationDAO { } private Operation.Status getStatus(String status) { - return null; + return Operation.Status.valueOf(status); } private Operation.Type getType(String type) { - return null; + return Operation.Type.valueOf(type); }