From cda0dd417f2a2d46de96c3899ff11f60bc02ccb2 Mon Sep 17 00:00:00 2001 From: kamidu Date: Thu, 23 Mar 2017 12:21:41 +0530 Subject: [PATCH] fixing the role filtering api issues --- .../device/mgt/jaxrs/service/api/RoleManagementService.java | 2 +- .../mgt/jaxrs/service/impl/RoleManagementServiceImpl.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java index 12ee76ac6b..295fb47555 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java @@ -181,7 +181,7 @@ public interface RoleManagementService { @QueryParam("limit") int limit); @GET - @Path("/roles/filter/{prefix}") + @Path("/filter/{prefix}") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "GET", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/RoleManagementServiceImpl.java index 4f9368cf18..e947c258c0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/RoleManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/RoleManagementServiceImpl.java @@ -88,6 +88,8 @@ public class RoleManagementServiceImpl implements RoleManagementService { } } + @GET + @Path("/filter/{prefix}") @Override public Response getFilteredRoles( @PathParam("prefix") String prefix, @@ -109,7 +111,6 @@ public class RoleManagementServiceImpl implements RoleManagementService { //Get the total role count that matches the given filter List filteredRoles = getRolesFromUserStore(filter, userStore); finalRoleList = new ArrayList(); - targetRoles.setCount(filteredRoles.size()); filteredRoles = FilteringUtil.getFilteredList(getRolesFromUserStore(filter, userStore), offset, limit); for (String rolename : filteredRoles){ @@ -117,6 +118,7 @@ public class RoleManagementServiceImpl implements RoleManagementService { finalRoleList.add(rolename); } } + targetRoles.setCount(finalRoleList.size()); targetRoles.setList(finalRoleList); return Response.ok().entity(targetRoles).build();