});
}
@Override
protected ResourceCriteria getFetchCriteria(final DSRequest request) {
ResourceCriteria criteria = new ResourceCriteria();
printRequestCriteria(request);
criteria.addFilterId(getFilter(request, "id", Integer.class));
criteria.addFilterParentResourceId(getFilter(request, "parentId", Integer.class));
criteria.addFilterCurrentAvailability(getFilter(request, AVAILABILITY.propertyName(), AvailabilityType.class));
criteria.addFilterResourceCategories(getArrayFilter(request, CATEGORY.propertyName(), ResourceCategory.class));
criteria.addFilterIds(getArrayFilter(request, FILTER_RESOURCE_IDS, Integer.class));
criteria.addFilterExplicitGroupIds(getFilter(request, FILTER_GROUP_ID, Integer.class));
criteria.addFilterName(getFilter(request, NAME.propertyName(), String.class));
criteria.addFilterResourceTypeId(getFilter(request, TYPE.propertyName(), Integer.class));
criteria.addFilterPluginName(getFilter(request, PLUGIN.propertyName(), String.class));
criteria.addFilterTagNamespace(getFilter(request, "tagNamespace", String.class));
criteria.addFilterTagSemantic(getFilter(request, "tagSemantic", String.class));
criteria.addFilterTagName(getFilter(request, "tagName", String.class));
criteria.addFilterVersion(getFilter(request, "version", String.class));
criteria.addFilterParentResourceCategory(getFilter(request, FILTER_PARENT_CATEGORY, ResourceCategory.class));
// we never want to filter on null status - that would return resources for every status (committed, new, deleted, etc).
// we want to rely on whatever the default setting is for the criteria and only override that if we explicitly have a status to filter.
InventoryStatus invStatusFilter = getFilter(request, INVENTORY_STATUS.propertyName(), InventoryStatus.class);
if (invStatusFilter != null) {
criteria.addFilterInventoryStatus(invStatusFilter);
}
InventoryStatus parentInvStatusFilter = getFilter(request, PARENT_INVENTORY_STATUS.propertyName(),
InventoryStatus.class);
if (parentInvStatusFilter != null) {
List<InventoryStatus> statuses = new ArrayList<InventoryStatus>(1);
statuses.add(parentInvStatusFilter);
criteria.addFilterParentInventoryStatuses(statuses);
}
//@todo: Remove me when finished debugging search expression
Log.debug(" *** ResourceCriteria Search String: " + getFilter(request, "search", String.class));
criteria.setSearchExpression(getFilter(request, "search", String.class));
// filter out unsortable fields (i.e. fields sorted client-side only)
PageControl pageControl = getPageControl(request);
pageControl.removeOrderingField(AncestryUtil.RESOURCE_ANCESTRY);
criteria.setPageControl(pageControl);
return criteria;
}