mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Merge branch 'carbon-kernel-4.4.3' of https://github.com/wso2/carbon-device-mgt-plugins into carbon-kernel-4.4.3
This commit is contained in:
commit
0504f34e22
@ -209,12 +209,18 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
PolicyManagerService policyManagerService = AndroidAPIUtils.getPolicyManagerService();
|
PolicyManagerService policyManagerService = AndroidAPIUtils.getPolicyManagerService();
|
||||||
policyManagerService.getEffectivePolicy(new DeviceIdentifier(androidDevice.getDeviceIdentifier(), device.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 '" +
|
Message responseMessage = new Message();
|
||||||
androidDevice.getDeviceIdentifier() + "' has successfully been enrolled").build();
|
responseMessage.setResponseCode(Response.Status.OK.toString());
|
||||||
|
responseMessage.setResponseMessage("Android device, which carries the id '" +
|
||||||
|
androidDevice.getDeviceIdentifier() + "' has successfully been enrolled");
|
||||||
|
return Response.status(Response.Status.OK).entity(responseMessage).build();
|
||||||
} else {
|
} else {
|
||||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Failed to enroll '" +
|
Message responseMessage = new Message();
|
||||||
|
responseMessage.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString());
|
||||||
|
responseMessage.setResponseMessage("Failed to enroll '" +
|
||||||
device.getType() + "' device, which carries the id '" +
|
device.getType() + "' device, which carries the id '" +
|
||||||
androidDevice.getDeviceIdentifier() + "'").build();
|
androidDevice.getDeviceIdentifier() + "'");
|
||||||
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(responseMessage).build();
|
||||||
}
|
}
|
||||||
} catch (DeviceManagementException e) {
|
} catch (DeviceManagementException e) {
|
||||||
String msg = "Error occurred while enrolling the android, which carries the id '" +
|
String msg = "Error occurred while enrolling the android, which carries the id '" +
|
||||||
@ -241,11 +247,16 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
try {
|
try {
|
||||||
result = AndroidAPIUtils.getDeviceManagementService().isEnrolled(deviceIdentifier);
|
result = AndroidAPIUtils.getDeviceManagementService().isEnrolled(deviceIdentifier);
|
||||||
if (result) {
|
if (result) {
|
||||||
return Response.status(Response.Status.OK).entity("Android device that carries the id '" +
|
Message responseMessage = new Message();
|
||||||
id + "' is enrolled").build();
|
responseMessage.setResponseCode(Response.Status.OK.toString());
|
||||||
|
responseMessage.setResponseMessage("Android device that carries the id '" +
|
||||||
|
id + "' is enrolled");
|
||||||
|
return Response.status(Response.Status.OK).entity(responseMessage).build();
|
||||||
} else {
|
} else {
|
||||||
return Response.status(Response.Status.NOT_FOUND).entity("No Android device is found upon the id '" +
|
Message responseMessage = new Message();
|
||||||
id + "'").build();
|
responseMessage.setResponseCode(Response.Status.NOT_FOUND.toString());
|
||||||
|
responseMessage.setResponseMessage("No Android device is found upon the id '" + id + "'");
|
||||||
|
return Response.status(Response.Status.NOT_FOUND).entity(responseMessage).build();
|
||||||
}
|
}
|
||||||
} catch (DeviceManagementException e) {
|
} catch (DeviceManagementException e) {
|
||||||
String msg = "Error occurred while checking enrollment status of the device.";
|
String msg = "Error occurred while checking enrollment status of the device.";
|
||||||
@ -283,11 +294,17 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
||||||
result = AndroidAPIUtils.getDeviceManagementService().modifyEnrollment(device);
|
result = AndroidAPIUtils.getDeviceManagementService().modifyEnrollment(device);
|
||||||
if (result) {
|
if (result) {
|
||||||
return Response.status(Response.Status.ACCEPTED).entity("Enrollment of Android device that " +
|
Message responseMessage = new Message();
|
||||||
"carries the id '" + id + "' has successfully updated").build();
|
responseMessage.setResponseCode(Response.Status.ACCEPTED.toString());
|
||||||
|
responseMessage.setResponseMessage("Enrollment of Android device that " +
|
||||||
|
"carries the id '" + id + "' has successfully updated");
|
||||||
|
return Response.status(Response.Status.ACCEPTED).entity(responseMessage).build();
|
||||||
} else {
|
} else {
|
||||||
return Response.status(Response.Status.NOT_MODIFIED).entity("Enrollment of Android device that " +
|
Message responseMessage = new Message();
|
||||||
"carries the id '" + id + "' has not been updated").build();
|
responseMessage.setResponseCode(Response.Status.NOT_MODIFIED.toString());
|
||||||
|
responseMessage.setResponseMessage("Enrollment of Android device that " +
|
||||||
|
"carries the id '" + id + "' has not been updated");
|
||||||
|
return Response.status(Response.Status.NOT_MODIFIED).entity(responseMessage).build();
|
||||||
}
|
}
|
||||||
} catch (DeviceManagementException e) {
|
} catch (DeviceManagementException e) {
|
||||||
msg = "Error occurred while modifying enrollment of the Android device that carries the id '" +
|
msg = "Error occurred while modifying enrollment of the Android device that carries the id '" +
|
||||||
@ -307,11 +324,17 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
try {
|
try {
|
||||||
result = AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier);
|
result = AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier);
|
||||||
if (result) {
|
if (result) {
|
||||||
return Response.status(Response.Status.OK).entity("Android device that carries id '" + id +
|
Message responseMessage = new Message();
|
||||||
"' has successfully dis-enrolled").build();
|
responseMessage.setResponseCode(Response.Status.OK.toString());
|
||||||
|
responseMessage.setResponseMessage("Android device that carries id '" + id +
|
||||||
|
"' has successfully dis-enrolled");
|
||||||
|
return Response.status(Response.Status.OK).entity(responseMessage).build();
|
||||||
} else {
|
} else {
|
||||||
return Response.status(Response.Status.NOT_FOUND).entity("Android device that carries id '" + id +
|
Message responseMessage = new Message();
|
||||||
"' has not been dis-enrolled").build();
|
responseMessage.setResponseCode(Response.Status.NOT_FOUND.toString());
|
||||||
|
responseMessage.setResponseMessage("Android device that carries id '" + id +
|
||||||
|
"' has not been dis-enrolled");
|
||||||
|
return Response.status(Response.Status.NOT_FOUND).entity(responseMessage).build();
|
||||||
}
|
}
|
||||||
} catch (DeviceManagementException e) {
|
} catch (DeviceManagementException e) {
|
||||||
String msg = "Error occurred while dis-enrolling the Android device that carries the id '" + id + "'";
|
String msg = "Error occurred while dis-enrolling the Android device that carries the id '" + id + "'";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user