Merge pull request #824 from Megala21/master

Fixing https://github.com/wso2/product-iots/issues/1388
merge-requests/1/head
Charitha Goonetilleke 7 years ago committed by GitHub
commit c3bf2a7975

@ -316,15 +316,15 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
@Path("/{id}/status") @Path("/{id}/status")
@Override @Override
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) {
boolean result;
DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id); DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id);
try { try {
result = AndroidAPIUtils.getDeviceManagementService().isEnrolled(deviceIdentifier); Device device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
if (result) { if (device != null) {
String status = String.valueOf(device.getEnrolmentInfo().getStatus());
Message responseMessage = new Message(); Message responseMessage = new Message();
responseMessage.setResponseCode(Response.Status.OK.toString()); responseMessage.setResponseCode(Response.Status.OK.toString());
responseMessage.setResponseMessage("Android device that carries the id '" + responseMessage
id + "' is enrolled"); .setResponseMessage("Status of android device that carries the id '" + id + "' is " + status);
return Response.status(Response.Status.OK).entity(responseMessage).build(); return Response.status(Response.Status.OK).entity(responseMessage).build();
} else { } else {
Message responseMessage = new Message(); Message responseMessage = new Message();

Loading…
Cancel
Save