private CatalogServiceBulkRep queryBulkResourceReps(List<URI> ids, CatalogServiceFilter filter) { List<CatalogServiceRestRep> catalogServiceRestReps = new ArrayList<CatalogServiceRestRep>(); List<CatalogServiceAndFields> catalogServicesWithFields = catalogServiceManager.getCatalogServicesWithFields(ids); Map<String, ServiceDescriptor> descriptors = getServiceDescriptors(); for (CatalogServiceAndFields catalogServiceAndField : catalogServicesWithFields) { if ((filter == null) || filter.isAccessible(catalogServiceAndField.getCatalogService())) { CatalogService service = catalogServiceAndField.getCatalogService(); ServiceDescriptor descriptor = descriptors.get(service.getBaseService()); List<CatalogServiceField> serviceFields = catalogServiceAndField.getCatalogServiceFields(); catalogServiceRestReps.add(map(service, descriptor, serviceFields)); } } catalogServiceRestReps = SortedIndexUtils.createSortedList(catalogServiceRestReps.iterator()); return new CatalogServiceBulkRep(catalogServiceRestReps); }
public List<CatalogServiceAndFields> getCatalogServicesWithFields(List<URI> ids) { List<CatalogServiceAndFields> catalogServicesWithFields = new ArrayList<CatalogServiceAndFields>(); if (ids == null) { return null; } for (URI id : ids) { CatalogService catalogService = client.catalogServices().findById(id); if (catalogService != null) { List<CatalogServiceField> fields = getCatalogServiceFields(catalogService.getId()); SortedIndexUtils.sort(fields); CatalogServiceAndFields catalogServiceWithFields = new CatalogServiceAndFields(); catalogServiceWithFields.setCatalogService(catalogService); catalogServiceWithFields.setCatalogServiceFields(fields); catalogServicesWithFields.add(catalogServiceWithFields); } } return catalogServicesWithFields; }