mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' into 'master'
Update device property table in dm db when updating properties See merge request entgra/carbon-device-mgt!804
This commit is contained in:
commit
877192368b
@ -489,13 +489,14 @@ public class DeviceTypeManager implements DeviceManager {
|
||||
throws DeviceManagementException {
|
||||
boolean status = false;
|
||||
if (propertiesExist) {
|
||||
Device updatedDevice = new Device();
|
||||
updatedDevice.setDeviceIdentifier(deviceId.getId());
|
||||
updatedDevice.setProperties(propertyList);
|
||||
try {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Getting the details of " + deviceType + " device : '" + deviceId.getId() + "'");
|
||||
log.debug("Updating device properties of " + deviceType + " device : '"
|
||||
+ deviceId.getId() + "'");
|
||||
}
|
||||
Device updatedDevice = new Device();
|
||||
updatedDevice.setDeviceIdentifier(deviceId.getId());
|
||||
updatedDevice.setProperties(propertyList);
|
||||
deviceTypePluginDAOManager.getDeviceTypeDAOHandler().beginTransaction();
|
||||
status = deviceTypePluginDAOManager.getDeviceDAO().updateDevice(updatedDevice);
|
||||
deviceTypePluginDAOManager.getDeviceTypeDAOHandler().commitTransaction();
|
||||
@ -506,6 +507,24 @@ public class DeviceTypeManager implements DeviceManager {
|
||||
} finally {
|
||||
deviceTypePluginDAOManager.getDeviceTypeDAOHandler().closeConnection();
|
||||
}
|
||||
if (propertyBasedDeviceTypePluginDAOManager != null && status) {
|
||||
try {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Updating device properties of " + deviceType + " device : '"
|
||||
+ deviceId.getId() + "'");
|
||||
}
|
||||
propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().beginTransaction();
|
||||
status = propertyBasedDeviceTypePluginDAOManager.getDeviceDAO().updateDevice(updatedDevice);
|
||||
propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().commitTransaction();
|
||||
} catch (DeviceTypeMgtPluginException e) {
|
||||
propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().rollbackTransaction();
|
||||
String msg = "Error while updating properties for " + deviceType + " device : " +
|
||||
deviceId.getId();
|
||||
throw new DeviceManagementException(msg, e);
|
||||
} finally {
|
||||
propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().closeConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user