@ApiParam(value = "Limit to Inventory status of the resources", allowableValues = "ALL, NEW, IGNORED, COMMITTED, DELETED, UNINVENTORIED")
@DefaultValue("COMMITTED") @QueryParam("status") String status,
@Context HttpHeaders headers,
@Context UriInfo uriInfo) {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addSortName(PageOrdering.ASC);
if (!status.toLowerCase().equals("all")) {
try {
criteria.addFilterInventoryStatus(InventoryStatus.valueOf(status.toUpperCase()));
} catch (IllegalArgumentException iae) {
throw new BadArgumentException("status","Value " + status + " is not in the list of allowed values: ALL, NEW, IGNORED, COMMITTED, DELETED, UNINVENTORIED" );
}
} else {
// JavaDoc says to explicitly set to null in order to get all Status
criteria.addFilterInventoryStatus(null);
}
if (q!=null) {
criteria.addFilterName(q);
}
if (category!=null) {
criteria.addFilterResourceCategories(ResourceCategory.valueOf(category.toUpperCase()));
}
if (page!=null) {
criteria.setPaging(page,pageSize);
}
PageList<Resource> ret = resMgr.findResourcesByCriteria(caller,criteria);
Response.ResponseBuilder builder = getResponseBuilderForResourceList(headers,uriInfo,ret);