|
|
@ -223,10 +223,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
|
|
|
|
|
|
|
|
private void updateOperations(Device device, List<? extends Operation> operations)
|
|
|
|
private void updateOperations(Device device, List<? extends Operation> operations)
|
|
|
|
throws OperationManagementException, PolicyComplianceException,
|
|
|
|
throws OperationManagementException, PolicyComplianceException,
|
|
|
|
ApplicationManagementException, NotificationManagementException, DeviceManagementException {
|
|
|
|
ApplicationManagementException, NotificationManagementException {
|
|
|
|
DeviceIdentifier id = new DeviceIdentifier();
|
|
|
|
|
|
|
|
id.setId(device.getDeviceIdentifier());
|
|
|
|
|
|
|
|
id.setType(AndroidConstants.DEVICE_TYPE_ANDROID);
|
|
|
|
|
|
|
|
String deviceName = device.getName();
|
|
|
|
String deviceName = device.getName();
|
|
|
|
for (Operation operation : operations) {
|
|
|
|
for (Operation operation : operations) {
|
|
|
|
AndroidDeviceUtils.updateOperation(device, operation);
|
|
|
|
AndroidDeviceUtils.updateOperation(device, operation);
|
|
|
@ -238,7 +235,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
Status.NEW.toString());
|
|
|
|
Status.NEW.toString());
|
|
|
|
notification.setDescription(operation.getCode() + " operation failed to execute on device " +
|
|
|
|
notification.setDescription(operation.getCode() + " operation failed to execute on device " +
|
|
|
|
deviceName + " (ID: " + device.getDeviceIdentifier() + ")");
|
|
|
|
deviceName + " (ID: " + device.getDeviceIdentifier() + ")");
|
|
|
|
AndroidAPIUtils.getNotificationManagementService().addNotification(id, notification);
|
|
|
|
AndroidAPIUtils.getNotificationManagementService().addNotification(device, notification);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
log.debug("Updating operation '" + operation.toString() + "'");
|
|
|
|
log.debug("Updating operation '" + operation.toString() + "'");
|
|
|
@ -358,7 +355,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
public Response isEnrolled(@PathParam("id") String id, @HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
public Response isEnrolled(@PathParam("id") String id, @HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id);
|
|
|
|
DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Device device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
|
|
|
|
Device device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false);
|
|
|
|
if (device != null) {
|
|
|
|
if (device != null) {
|
|
|
|
String status = String.valueOf(device.getEnrolmentInfo().getStatus());
|
|
|
|
String status = String.valueOf(device.getEnrolmentInfo().getStatus());
|
|
|
|
Message responseMessage = new Message();
|
|
|
|
Message responseMessage = new Message();
|
|
|
@ -389,7 +386,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
deviceIdentifier.setId(id);
|
|
|
|
deviceIdentifier.setId(id);
|
|
|
|
deviceIdentifier.setType(AndroidConstants.DEVICE_TYPE_ANDROID);
|
|
|
|
deviceIdentifier.setType(AndroidConstants.DEVICE_TYPE_ANDROID);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
|
|
|
|
device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false);
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" +
|
|
|
|
String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" +
|
|
|
|
id + "'";
|
|
|
|
id + "'";
|
|
|
|