Fixed modify enrollment bug

revert-70aa11f8
mharindu 9 years ago
parent 73a82f743f
commit 72591eff44

@ -215,6 +215,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
@Override @Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException { public boolean modifyEnrollment(Device device) throws DeviceManagementException {
DeviceManager deviceManager = this.getDeviceManager(device.getType()); DeviceManager deviceManager = this.getDeviceManager(device.getType());
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(device.getDeviceIdentifier(), device.getType());
if (deviceManager == null) { if (deviceManager == null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " +
@ -227,6 +228,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
int tenantId = this.getTenantId(); int tenantId = this.getTenantId();
DeviceManagementDAOFactory.beginTransaction(); DeviceManagementDAOFactory.beginTransaction();
DeviceType type = deviceTypeDAO.getDeviceType(device.getType()); DeviceType type = deviceTypeDAO.getDeviceType(device.getType());
Device currentDevice = deviceDAO.getDevice(deviceIdentifier, tenantId);
device.setId(currentDevice.getId());
device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId());
deviceDAO.updateDevice(type.getId(), device, tenantId); deviceDAO.updateDevice(type.getId(), device, tenantId);
enrollmentDAO.updateEnrollment(device.getEnrolmentInfo()); enrollmentDAO.updateEnrollment(device.getEnrolmentInfo());
DeviceManagementDAOFactory.commitTransaction(); DeviceManagementDAOFactory.commitTransaction();

Loading…
Cancel
Save