From 61beca5048860e6369351f33ead2fecd285311f3 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Wed, 1 Jun 2016 01:30:02 +0530 Subject: [PATCH] Fixing getDevice method to support status, ownership, etc as query param filters --- .../mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java | 4 ++++ .../mgt/jaxrs/service/impl/UserManagementServiceImpl.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java index 75e886cb92d..4464f06e5c7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -77,14 +77,18 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { PaginationResult result; if (type != null) { + request.setDeviceType(type); result = dms.getDevicesByType(request); } else if (user != null) { + request.setOwner(user); result = dms.getDevicesOfUser(request); } else if (ownership != null) { RequestValidationUtil.validateOwnershipType(ownership); + request.setOwnership(ownership); result = dms.getDevicesByOwnership(request); } else if (status != null) { RequestValidationUtil.validateStatus(status); + request.setStatus(status); result = dms.getDevicesByStatus(request); } else { result = dms.getAllDevices(request); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java index af2b599109d..74b1769c38a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java @@ -79,7 +79,7 @@ public class UserManagementServiceImpl implements UserManagementService { this.inviteNewlyAddedUserToEnrollDevice(userWrapper.getUsername(), initialUserPassword); // Outputting debug message upon successful addition of user if (log.isDebugEnabled()) { - log.debug("User by username: " + userWrapper.getUsername() + " was successfully added."); + log.debug("User '" + userWrapper.getUsername() + "' has successfully been added."); } // returning response with success state return Response.status(Response.Status.OK).entity("User by username: " + userWrapper.getUsername() +