|
|
|
@ -1994,10 +1994,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
|
int tenantId = this.getTenantId();
|
|
|
|
|
switch (newStatus) {
|
|
|
|
|
case ACTIVE:
|
|
|
|
|
updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
|
|
|
|
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
|
|
|
|
break;
|
|
|
|
|
case INACTIVE:
|
|
|
|
|
updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
|
|
|
|
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
|
|
|
|
break;
|
|
|
|
|
case REMOVED:
|
|
|
|
|
isDeviceUpdated = disenrollDevice(deviceIdentifier);
|
|
|
|
@ -2010,12 +2010,16 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
|
|
|
|
|
|
private boolean updateEnrollment(int deviceId, EnrolmentInfo enrolmentInfo, int tenantId)
|
|
|
|
|
throws DeviceManagementException {
|
|
|
|
|
boolean isUpdatedEnrollment = false;
|
|
|
|
|
boolean isAutoCommit = true;
|
|
|
|
|
try {
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
isAutoCommit = DeviceManagementDAOFactory.getConnection().getAutoCommit();
|
|
|
|
|
DeviceManagementDAOFactory.getConnection().setAutoCommit(true);
|
|
|
|
|
enrollmentDAO.updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
|
|
|
|
int updatedRows = enrollmentDAO.updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
|
|
|
|
if (updatedRows > 0) {
|
|
|
|
|
isUpdatedEnrollment = true;
|
|
|
|
|
}
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
@ -2029,7 +2033,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
|
}
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
return isUpdatedEnrollment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|