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 12ee76ac6be..295fb475559 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 4f9368cf188..e947c258c04 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();