Merge pull request #781 from inoshperera/master

fixing the agent unable to enroll issue
revert-70aa11f8
Madawa Soysa 8 years ago committed by GitHub
commit 98e8dfea68

@ -335,23 +335,25 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} }
return false; return false;
} }
try {
int tenantId = this.getTenantId();
Device device = this.getDevice(deviceId, false); int tenantId = this.getTenantId();
if (device == null) {
if (log.isDebugEnabled()) { Device device = this.getDevice(deviceId, false);
log.debug("Device not found for id '" + deviceId.getId() + "'"); if (device == null) {
} if (log.isDebugEnabled()) {
return false; log.debug("Device not found for id '" + deviceId.getId() + "'");
} }
return false;
}
if (device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.REMOVED)) { if (device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.REMOVED)) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Device has already disenrolled : " + deviceId.getId() + "'"); log.debug("Device has already disenrolled : " + deviceId.getId() + "'");
}
return false;
} }
return true;
}
try {
device.getEnrolmentInfo().setDateOfLastUpdate(new Date().getTime()); device.getEnrolmentInfo().setDateOfLastUpdate(new Date().getTime());
device.getEnrolmentInfo().setStatus(EnrolmentInfo.Status.REMOVED); device.getEnrolmentInfo().setStatus(EnrolmentInfo.Status.REMOVED);
DeviceManagementDAOFactory.beginTransaction(); DeviceManagementDAOFactory.beginTransaction();

Loading…
Cancel
Save