From 6e262cb60b17e0e61569186fe54b5d7d00d9dca6 Mon Sep 17 00:00:00 2001 From: manoj Date: Tue, 27 Jan 2015 20:22:38 +0530 Subject: [PATCH] set active status for enroll device --- .../device/mgt/core/DeviceManagerImpl.java | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagerImpl.java index 8038fee69b..139679fb3f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagerImpl.java @@ -51,10 +51,11 @@ public class DeviceManagerImpl implements DeviceManager { this.deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO(); } - @Override public boolean enrollDevice(Device device) throws DeviceManagementException { + @Override + public boolean enrollDevice(Device device) throws DeviceManagementException { + DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(device.getType()); boolean status = dms.enrollDevice(device); - try { org.wso2.carbon.device.mgt.core.dto.Device deviceDto = DeviceManagementDAOUtil.convertDevice(device); Integer deviceTypeId = this.getDeviceTypeDAO().getDeviceTypeIdByDeviceTypeName(device.getType()); @@ -68,7 +69,8 @@ public class DeviceManagerImpl implements DeviceManager { return status; } - @Override public boolean modifyEnrollment(Device device) throws DeviceManagementException { + @Override + public boolean modifyEnrollment(Device device) throws DeviceManagementException { DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(device.getType()); boolean status = dms.modifyEnrollment(device); try { @@ -80,27 +82,32 @@ public class DeviceManagerImpl implements DeviceManager { return status; } - @Override public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { + @Override + public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType()); return dms.disenrollDevice(deviceId); } - @Override public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException { + @Override + public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException { DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType()); return dms.isEnrolled(deviceId); } - @Override public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException { + @Override + public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException { DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType()); return dms.isActive(deviceId); } - @Override public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException { + @Override + public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException { DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType()); return dms.setActive(deviceId, status); } - @Override public List getAllDevices(String type) throws DeviceManagementException { + @Override + public List getAllDevices(String type) throws DeviceManagementException { DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(type); List devicesList = new ArrayList(); try { @@ -124,7 +131,8 @@ public class DeviceManagerImpl implements DeviceManager { return devicesList; } - @Override public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException { + @Override + public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException { DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType()); Device convertedDevice = null; try { @@ -147,12 +155,14 @@ public class DeviceManagerImpl implements DeviceManager { return convertedDevice; } - @Override public boolean updateDeviceInfo(Device device) throws DeviceManagementException { + @Override + public boolean updateDeviceInfo(Device device) throws DeviceManagementException { DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(device.getType()); return dms.updateDeviceInfo(device); } - @Override public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) + @Override + public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException { DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType()); return dms.setOwnership(deviceId, ownershipType);