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