Refactored device info

merge-requests/7/head
mharindu 10 years ago
parent 6b84d65e29
commit ead4d3be69

@ -118,10 +118,11 @@ public interface DeviceManager {
/**
* Method to update device information.
*
* @param deviceIdentifier identifier to identify the device
* @param device Updated device information related data
* @throws DeviceManagementException If some unusual behaviour is observed while updating the device info
*/
boolean updateDeviceInfo(Device device) throws DeviceManagementException;
boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException;
/**
* Method to set the ownership type of a particular device. i.e. BYOD, COPE.

@ -136,7 +136,16 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManager dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.disenrollDevice(deviceId);
boolean status = dms.disenrollDevice(deviceId);
try {
org.wso2.carbon.device.mgt.core.dto.Device device = this.getDeviceDAO().getDevice(deviceId);
device.setStatus(Status.INACTIVE);
this.getDeviceDAO().updateDevice(device);
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while modifying the device " +
"'" + deviceId.getId() + "'", e);
}
return status;
}
@Override
@ -378,10 +387,10 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
}
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException {
DeviceManager dms =
this.getPluginRepository().getDeviceManagementProvider(device.getType());
return dms.updateDeviceInfo(device);
return dms.updateDeviceInfo(deviceIdentifier, device);
}
@Override

@ -98,9 +98,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
}
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().
updateDeviceInfo(device);
updateDeviceInfo(deviceIdentifier, device);
}
@Override

Loading…
Cancel
Save