|
|
@ -200,7 +200,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
device.setDeviceInfo(androidDevice.getDeviceInfo());
|
|
|
|
device.setDeviceInfo(androidDevice.getDeviceInfo());
|
|
|
|
device.setDeviceIdentifier(androidDevice.getDeviceIdentifier());
|
|
|
|
device.setDeviceIdentifier(androidDevice.getDeviceIdentifier());
|
|
|
|
device.setDescription(androidDevice.getDescription());
|
|
|
|
device.setDescription(androidDevice.getDescription());
|
|
|
|
device.setType(androidDevice.getType());
|
|
|
|
|
|
|
|
device.setName(androidDevice.getName());
|
|
|
|
device.setName(androidDevice.getName());
|
|
|
|
device.setFeatures(androidDevice.getFeatures());
|
|
|
|
device.setFeatures(androidDevice.getFeatures());
|
|
|
|
device.setProperties(androidDevice.getProperties());
|
|
|
|
device.setProperties(androidDevice.getProperties());
|
|
|
@ -208,23 +207,23 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
boolean status = AndroidAPIUtils.getDeviceManagementService().enrollDevice(device);
|
|
|
|
boolean status = AndroidAPIUtils.getDeviceManagementService().enrollDevice(device);
|
|
|
|
|
|
|
|
|
|
|
|
PolicyManagerService policyManagerService = AndroidAPIUtils.getPolicyManagerService();
|
|
|
|
PolicyManagerService policyManagerService = AndroidAPIUtils.getPolicyManagerService();
|
|
|
|
policyManagerService.getEffectivePolicy(new DeviceIdentifier(androidDevice.getDeviceIdentifier(), androidDevice.getType()));
|
|
|
|
policyManagerService.getEffectivePolicy(new DeviceIdentifier(androidDevice.getDeviceIdentifier(), device.getType()));
|
|
|
|
if (status) {
|
|
|
|
if (status) {
|
|
|
|
return Response.status(Response.Status.OK).entity("Android device, which carries the id '" +
|
|
|
|
return Response.status(Response.Status.OK).entity("Android device, which carries the id '" +
|
|
|
|
androidDevice.getDeviceIdentifier() + "' has successfully been enrolled").build();
|
|
|
|
androidDevice.getDeviceIdentifier() + "' has successfully been enrolled").build();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Failed to enroll '" +
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Failed to enroll '" +
|
|
|
|
androidDevice.getType() + "' device, which carries the id '" +
|
|
|
|
device.getType() + "' device, which carries the id '" +
|
|
|
|
androidDevice.getDeviceIdentifier() + "'").build();
|
|
|
|
androidDevice.getDeviceIdentifier() + "'").build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
String msg = "Error occurred while enrolling the '" + androidDevice.getType() + "', which carries the id '" +
|
|
|
|
String msg = "Error occurred while enrolling the android, which carries the id '" +
|
|
|
|
androidDevice.getDeviceIdentifier() + "'";
|
|
|
|
androidDevice.getDeviceIdentifier() + "'";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
throw new UnexpectedServerErrorException(
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
|
|
|
} catch (PolicyManagementException e) {
|
|
|
|
} catch (PolicyManagementException e) {
|
|
|
|
String msg = "Error occurred while enforcing default enrollment policy upon '" + androidDevice.getType() +
|
|
|
|
String msg = "Error occurred while enforcing default enrollment policy upon android " +
|
|
|
|
"', which carries the id '" +
|
|
|
|
"', which carries the id '" +
|
|
|
|
androidDevice.getDeviceIdentifier() + "'";
|
|
|
|
androidDevice.getDeviceIdentifier() + "'";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
@ -267,7 +266,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
device.setDeviceInfo(androidDevice.getDeviceInfo());
|
|
|
|
device.setDeviceInfo(androidDevice.getDeviceInfo());
|
|
|
|
device.setDeviceIdentifier(androidDevice.getDeviceIdentifier());
|
|
|
|
device.setDeviceIdentifier(androidDevice.getDeviceIdentifier());
|
|
|
|
device.setDescription(androidDevice.getDescription());
|
|
|
|
device.setDescription(androidDevice.getDescription());
|
|
|
|
device.setType(androidDevice.getType());
|
|
|
|
|
|
|
|
device.setName(androidDevice.getName());
|
|
|
|
device.setName(androidDevice.getName());
|
|
|
|
device.setFeatures(androidDevice.getFeatures());
|
|
|
|
device.setFeatures(androidDevice.getFeatures());
|
|
|
|
device.setProperties(androidDevice.getProperties());
|
|
|
|
device.setProperties(androidDevice.getProperties());
|
|
|
|