public PageList<Resource> fetchDataForPage(PageControl pc) { Subject subject = EnterpriseFacesContextUtility.getSubject(); ResourceManagerLocal manager = LookupUtil.getResourceManager(); int repoId = Integer.parseInt(FacesContextUtility.getRequiredRequestParameter("id")); String search = FacesContextUtility.getOptionalRequestParameter( "repoUnsubscriptionsListForm:searchStringFilter"); String category = FacesContextUtility.getOptionalRequestParameter( "repoUnsubscriptionsListForm:searchCategoryFilter"); ResourceCategory categoryEnum = ResourceCategory.PLATFORM; if (search != null && search.trim().equals("")) { search = null; } if (category != null) { categoryEnum = ResourceCategory.valueOf(category); } PageList<Resource> results = manager.findAvailableResourcesForRepo(subject, repoId, search, categoryEnum, pc); // PageList<ResourceComposite> results = manager.findResourceComposites(subject, categoryEnum, // null, null, search, pc); return results; }
@Override public ResourceType findResourceType(String name, String pluginType, String resourceCategory) { ResourceTypeCriteria crit = new ResourceTypeCriteria(); crit.addFilterName(name); crit.addFilterCategory(ResourceCategory.valueOf(resourceCategory)); crit.addFilterPluginName(pluginType); crit.fetchMetricDefinitions(true); crit.setStrict(true); List<ResourceType> resourceTypes = resourceTypeManagerRemote.findResourceTypesByCriteria(baseRemote.getSubject(), crit); if (resourceTypes.size() > 1) { throw new IllegalStateException( "More than one resource type found. Expected only one resource type"); } return resourceTypes.get(0); }