set active status for enroll device

4.x.x
manoj 10 years ago
parent 60e539b583
commit 6e262cb60b

@ -51,10 +51,11 @@ public class DeviceManagerImpl implements DeviceManager {
this.deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO(); 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()); DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(device.getType());
boolean status = dms.enrollDevice(device); boolean status = dms.enrollDevice(device);
try { try {
org.wso2.carbon.device.mgt.core.dto.Device deviceDto = DeviceManagementDAOUtil.convertDevice(device); org.wso2.carbon.device.mgt.core.dto.Device deviceDto = DeviceManagementDAOUtil.convertDevice(device);
Integer deviceTypeId = this.getDeviceTypeDAO().getDeviceTypeIdByDeviceTypeName(device.getType()); Integer deviceTypeId = this.getDeviceTypeDAO().getDeviceTypeIdByDeviceTypeName(device.getType());
@ -68,7 +69,8 @@ public class DeviceManagerImpl implements DeviceManager {
return status; 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()); DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(device.getType());
boolean status = dms.modifyEnrollment(device); boolean status = dms.modifyEnrollment(device);
try { try {
@ -80,27 +82,32 @@ public class DeviceManagerImpl implements DeviceManager {
return status; 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()); DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.disenrollDevice(deviceId); 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()); DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.isEnrolled(deviceId); 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()); DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.isActive(deviceId); 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()); DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.setActive(deviceId, status); return dms.setActive(deviceId, status);
} }
@Override public List<Device> getAllDevices(String type) throws DeviceManagementException { @Override
public List<Device> getAllDevices(String type) throws DeviceManagementException {
DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(type); DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(type);
List<Device> devicesList = new ArrayList<Device>(); List<Device> devicesList = new ArrayList<Device>();
try { try {
@ -124,7 +131,8 @@ public class DeviceManagerImpl implements DeviceManager {
return devicesList; 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()); DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
Device convertedDevice = null; Device convertedDevice = null;
try { try {
@ -147,12 +155,14 @@ public class DeviceManagerImpl implements DeviceManager {
return convertedDevice; 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()); DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(device.getType());
return dms.updateDeviceInfo(device); return dms.updateDeviceInfo(device);
} }
@Override public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) @Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
throws DeviceManagementException { throws DeviceManagementException {
DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType()); DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.setOwnership(deviceId, ownershipType); return dms.setOwnership(deviceId, ownershipType);

Loading…
Cancel
Save