@Test public void testPopulateResources_allTypes() throws Exception { TestProviderModule providerModule = new TestProviderModule(); ClusterControllerImpl controller = new ClusterControllerImpl(providerModule); Request request = PropertyHelper.getReadRequest(); Predicate predicate = new PredicateBuilder().property("c3/p6").equals(1).toPredicate(); for (Resource.Type type : Resource.Type.values()) { Resource resource = new ResourceImpl(type); controller.populateResources(type, Collections.singleton(resource), request, predicate); } }
@Override public Set<Resource> populateResources(Type type, Set<Resource> resources, Request request, Predicate predicate) throws SystemException { Set<Resource> keepers = resources; List<PropertyProvider> propertyProviders = ensurePropertyProviders(type); for (PropertyProvider propertyProvider : propertyProviders) { if (providesRequestProperties(propertyProvider, request, predicate)) { keepers = propertyProvider.populateResources(keepers, request, predicate); } } return keepers; }
ClusterControllerImpl implements ClusterController { @Override public Set<Resource> populateResources(Type type, Set<Resource> resources, Request request, Predicate predicate) throws SystemException { Set<Resource> keepers = resources; List<PropertyProvider> propertyProviders = ensurePropertyProviders(type); for (PropertyProvider propertyProvider : propertyProviders) { if (providesRequestProperties(propertyProvider, request, predicate)) { keepers = propertyProvider.populateResources(keepers, request, predicate); } } return keepers; } }
ClusterControllerImpl implements ClusterController { @Override public Set<Resource> populateResources(Type type, Set<Resource> resources, Request request, Predicate predicate) throws SystemException { Set<Resource> keepers = resources; List<PropertyProvider> propertyProviders = ensurePropertyProviders(type); for (PropertyProvider propertyProvider : propertyProviders) { if (providesRequestProperties(propertyProvider, request, predicate)) { keepers = propertyProvider.populateResources(keepers, request, predicate); } } return keepers; } ClusterControllerImpl(ProviderModule providerModule); }
ClusterControllerImpl implements ClusterController { @Override public Set<Resource> populateResources(Type type, Set<Resource> resources, Request request, Predicate predicate) throws SystemException { Set<Resource> keepers = resources; List<PropertyProvider> propertyProviders = ensurePropertyProviders(type); for (PropertyProvider propertyProvider : propertyProviders) { if (providesRequestProperties(propertyProvider, request, predicate)) { keepers = propertyProvider.populateResources(keepers, request, predicate); } } return keepers; } ClusterControllerImpl(ProviderModule providerModule); @Override Predicate getAmendedPredicate(Type type, Predicate predicate); @Override QueryResponse getResources(Type type, Request request, Predicate predicate); @Override Set<Resource> populateResources(Type type,
                                         Set<Resource> resources,
                                         Request request,
                                         Predicate predicate); @Override Iterable<Resource> getIterable(Type type, QueryResponse queryResponse,
                                        Request request, Predicate predicate,
                                        PageRequest pageRequest,
                                        SortRequest sortRequest); @Override PageResponse getPage(Type type, QueryResponse queryResponse,
                              Request request, Predicate predicate,
                              PageRequest pageRequest, SortRequest sortRequest); @Override Schema getSchema(Type type); @Override RequestStatus createResources(Type type, Request request); @Override RequestStatus updateResources(Type type, Request request, Predicate predicate); @Override RequestStatus deleteResources(Type type, Request request, Predicate predicate); @Override ResourceProvider ensureResourceProvider(Type type); }
ClusterControllerImpl implements ClusterController { @Override public Set<Resource> populateResources(Type type, Set<Resource> resources, Request request, Predicate predicate) throws SystemException { Set<Resource> keepers = resources; List<PropertyProvider> propertyProviders = ensurePropertyProviders(type); for (PropertyProvider propertyProvider : propertyProviders) { if (providesRequestProperties(propertyProvider, request, predicate)) { keepers = propertyProvider.populateResources(keepers, request, predicate); } } return keepers; } ClusterControllerImpl(ProviderModule providerModule); @Override Predicate getAmendedPredicate(Type type, Predicate predicate); @Override QueryResponse getResources(Type type, Request request, Predicate predicate); @Override Set<Resource> populateResources(Type type,
                                         Set<Resource> resources,
                                         Request request,
                                         Predicate predicate); @Override Iterable<Resource> getIterable(Type type, QueryResponse queryResponse,
                                        Request request, Predicate predicate,
                                        PageRequest pageRequest,
                                        SortRequest sortRequest); @Override PageResponse getPage(Type type, QueryResponse queryResponse,
                              Request request, Predicate predicate,
                              PageRequest pageRequest, SortRequest sortRequest); @Override Schema getSchema(Type type); @Override RequestStatus createResources(Type type, Request request); @Override RequestStatus updateResources(Type type, Request request, Predicate predicate); @Override RequestStatus deleteResources(Type type, Request request, Predicate predicate); @Override ResourceProvider ensureResourceProvider(Type type);  }