From 58666bc4b0d50f35ceac79f6f4b72484bac13507 Mon Sep 17 00:00:00 2001 From: Ace Date: Fri, 8 Jul 2016 14:57:43 +0530 Subject: [PATCH] Adding device name url param for device search --- .../mgt/jaxrs/service/api/DeviceManagementService.java | 5 +++++ .../mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java index f10a95e3ff..05df689189 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java @@ -96,6 +96,11 @@ public interface DeviceManagementService { permissions = {"/permission/admin/device-mgt/admin/devices/list"} ) Response getDevices( + @ApiParam( + name = "name", + value = "The device name, such as shamu, bullhead or angler.", + required = false) + String name, @ApiParam( name = "type", value = "The device type, such as ios, android or windows.", 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 a150bed327..6a7c3fec47 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 @@ -62,6 +62,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @GET @Override public Response getDevices( + @QueryParam("name") String name, @QueryParam("type") String type, @QueryParam("user") String user, @QueryParam("roleName") String roleName, @@ -79,6 +80,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { PaginationResult result; DeviceList devices = new DeviceList(); + if(name != null && !name.isEmpty()){ + request.setDeviceName(name); + } if (type != null && !type.isEmpty()) { request.setDeviceType(type); }