mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Update pending operations status of device to be disenrolled
This commit is contained in:
parent
bd8d89b53a
commit
281e0a636e
@ -455,6 +455,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
||||
if (permanentDelete) {
|
||||
result = AndroidAPIUtils.getDeviceManagementService().deleteDevice(deviceIdentifier);
|
||||
} else {
|
||||
AndroidDeviceUtils.updateDisEnrollOperationStatus(deviceIdentifier);
|
||||
result = AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier);
|
||||
}
|
||||
if (result) {
|
||||
|
||||
@ -572,4 +572,25 @@ public class AndroidDeviceUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update status of pending operations to error when a dis-enroll operation is triggered.
|
||||
*
|
||||
* @param deviceIdentifier Identifier of the device
|
||||
* @throws DeviceManagementException
|
||||
*/
|
||||
public static void updateDisEnrollOperationStatus(DeviceIdentifier deviceIdentifier)
|
||||
throws DeviceManagementException {
|
||||
try {
|
||||
List<? extends Operation> pendingOperations = getPendingOperations(deviceIdentifier);
|
||||
for (Operation operation : pendingOperations) {
|
||||
operation.setStatus(Operation.Status.ERROR);
|
||||
AndroidAPIUtils.getDeviceManagementService().updateOperation(deviceIdentifier, operation);
|
||||
}
|
||||
} catch (OperationManagementException e) {
|
||||
String msg = "Error occurred while retrieving pending operations to update operation statuses of " +
|
||||
"device to be dis-enrolled";
|
||||
log.error(msg);
|
||||
throw new DeviceManagementException(msg, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user