fixing the role filtering api issues

revert-70aa11f8
kamidu 8 years ago
parent e205fd97cd
commit cda0dd417f

@ -181,7 +181,7 @@ public interface RoleManagementService {
@QueryParam("limit") int limit); @QueryParam("limit") int limit);
@GET @GET
@Path("/roles/filter/{prefix}") @Path("/filter/{prefix}")
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",

@ -88,6 +88,8 @@ public class RoleManagementServiceImpl implements RoleManagementService {
} }
} }
@GET
@Path("/filter/{prefix}")
@Override @Override
public Response getFilteredRoles( public Response getFilteredRoles(
@PathParam("prefix") String prefix, @PathParam("prefix") String prefix,
@ -109,7 +111,6 @@ public class RoleManagementServiceImpl implements RoleManagementService {
//Get the total role count that matches the given filter //Get the total role count that matches the given filter
List<String> filteredRoles = getRolesFromUserStore(filter, userStore); List<String> filteredRoles = getRolesFromUserStore(filter, userStore);
finalRoleList = new ArrayList<String>(); finalRoleList = new ArrayList<String>();
targetRoles.setCount(filteredRoles.size());
filteredRoles = FilteringUtil.getFilteredList(getRolesFromUserStore(filter, userStore), offset, limit); filteredRoles = FilteringUtil.getFilteredList(getRolesFromUserStore(filter, userStore), offset, limit);
for (String rolename : filteredRoles){ for (String rolename : filteredRoles){
@ -117,6 +118,7 @@ public class RoleManagementServiceImpl implements RoleManagementService {
finalRoleList.add(rolename); finalRoleList.add(rolename);
} }
} }
targetRoles.setCount(finalRoleList.size());
targetRoles.setList(finalRoleList); targetRoles.setList(finalRoleList);
return Response.ok().entity(targetRoles).build(); return Response.ok().entity(targetRoles).build();

Loading…
Cancel
Save