Refactored device info

4.x.x
mharindu 10 years ago
parent 6b84d65e29
commit ead4d3be69

@ -118,10 +118,11 @@ public interface DeviceManager {
/** /**
* Method to update device information. * Method to update device information.
* *
* @param deviceIdentifier identifier to identify the device
* @param device Updated device information related data * @param device Updated device information related data
* @throws DeviceManagementException If some unusual behaviour is observed while updating the device info * @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. * 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 { public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManager dms = DeviceManager dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType()); 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 @Override
@ -378,10 +387,10 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
} }
@Override @Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException { public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException {
DeviceManager dms = DeviceManager dms =
this.getPluginRepository().getDeviceManagementProvider(device.getType()); this.getPluginRepository().getDeviceManagementProvider(device.getType());
return dms.updateDeviceInfo(device); return dms.updateDeviceInfo(deviceIdentifier, device);
} }
@Override @Override

@ -98,21 +98,21 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
} }
@Override @Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException { public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider(). return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().
updateDeviceInfo(device); updateDeviceInfo(deviceIdentifier, device);
} }
@Override @Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException { public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().setOwnership(deviceId, return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().setOwnership(deviceId,
ownershipType); ownershipType);
} }
@Override @Override
public License getLicense(String deviceType, String languageCode) throws LicenseManagementException { public License getLicense(String deviceType, String languageCode) throws LicenseManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getLicense(deviceType, return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getLicense(deviceType,
languageCode); languageCode);
} }
@Override @Override

Loading…
Cancel
Save