@Test public void testGetRequestPropertyIds() { Set<String> providerPropertyIds = new HashSet<String>(); providerPropertyIds.add("foo"); providerPropertyIds.add("bar"); providerPropertyIds.add("cat1/sub1"); BaseProvider provider = new TestProvider(providerPropertyIds); Request request = PropertyHelper.getReadRequest("foo"); Set<String> requestedPropertyIds = provider.getRequestPropertyIds(request, null); assertEquals(1, requestedPropertyIds.size()); assertTrue(requestedPropertyIds.contains("foo")); request = PropertyHelper.getReadRequest("foo", "bar"); requestedPropertyIds = provider.getRequestPropertyIds(request, null); assertEquals(2, requestedPropertyIds.size()); assertTrue(requestedPropertyIds.contains("foo")); assertTrue(requestedPropertyIds.contains("bar")); request = PropertyHelper.getReadRequest("foo", "baz", "bar", "cat", "cat1/prop1"); requestedPropertyIds = provider.getRequestPropertyIds(request, null); assertEquals(2, requestedPropertyIds.size()); assertTrue(requestedPropertyIds.contains("foo")); assertTrue(requestedPropertyIds.contains("bar")); request = PropertyHelper.getReadRequest("foo", "cat1/sub1/prop1"); requestedPropertyIds = provider.getRequestPropertyIds(request, null); assertEquals(2, requestedPropertyIds.size()); assertTrue(requestedPropertyIds.contains("foo")); assertTrue(requestedPropertyIds.contains("cat1/sub1/prop1")); }
protected Set<String> getRequestPropertyIds(Request request, Predicate predicate) { Set<String> propertyIds = request.getPropertyIds(); if (propertyIds == null || propertyIds.isEmpty()) { return new HashSet<String>(this.propertyIds); } propertyIds = new HashSet<String>(propertyIds); if (predicate != null) { propertyIds.addAll(PredicateHelper.getPropertyIds(predicate)); } if (!combinedIds.containsAll(propertyIds)) { Set<String> keepers = new HashSet<String>(); Set<String> unsupportedPropertyIds = new HashSet<String>(propertyIds); unsupportedPropertyIds.removeAll(combinedIds); for (String unsupportedPropertyId : unsupportedPropertyIds) { if (checkCategory(unsupportedPropertyId) || checkRegExp(unsupportedPropertyId)) { keepers.add(unsupportedPropertyId); } } propertyIds.retainAll(combinedIds); propertyIds.addAll(keepers); } return propertyIds; }
BaseProvider { protected Set<String> getRequestPropertyIds(Request request, Predicate predicate) { Set<String> propertyIds = request.getPropertyIds(); if (propertyIds == null || propertyIds.isEmpty()) { return new HashSet<String>(this.propertyIds); } propertyIds = new HashSet<String>(propertyIds); if (predicate != null) { propertyIds.addAll(PredicateHelper.getPropertyIds(predicate)); } if (!combinedIds.containsAll(propertyIds)) { Set<String> keepers = new HashSet<String>(); Set<String> unsupportedPropertyIds = new HashSet<String>(propertyIds); unsupportedPropertyIds.removeAll(combinedIds); for (String unsupportedPropertyId : unsupportedPropertyIds) { if (checkCategory(unsupportedPropertyId) || checkRegExp(unsupportedPropertyId)) { keepers.add(unsupportedPropertyId); } } propertyIds.retainAll(combinedIds); propertyIds.addAll(keepers); } return propertyIds; } }
BaseProvider { protected Set<String> getRequestPropertyIds(Request request, Predicate predicate) { Set<String> propertyIds = request.getPropertyIds(); if (propertyIds == null || propertyIds.isEmpty()) { return new HashSet<String>(this.propertyIds); } propertyIds = new HashSet<String>(propertyIds); if (predicate != null) { propertyIds.addAll(PredicateHelper.getPropertyIds(predicate)); } if (!combinedIds.containsAll(propertyIds)) { Set<String> keepers = new HashSet<String>(); Set<String> unsupportedPropertyIds = new HashSet<String>(propertyIds); unsupportedPropertyIds.removeAll(combinedIds); for (String unsupportedPropertyId : unsupportedPropertyIds) { if (checkCategory(unsupportedPropertyId) || checkRegExp(unsupportedPropertyId)) { keepers.add(unsupportedPropertyId); } } propertyIds.retainAll(combinedIds); propertyIds.addAll(keepers); } return propertyIds; } BaseProvider(Set<String> propertyIds); }
BaseProvider { protected Set<String> getRequestPropertyIds(Request request, Predicate predicate) { Set<String> propertyIds = request.getPropertyIds(); if (propertyIds == null || propertyIds.isEmpty()) { return new HashSet<String>(this.propertyIds); } propertyIds = new HashSet<String>(propertyIds); if (predicate != null) { propertyIds.addAll(PredicateHelper.getPropertyIds(predicate)); } if (!combinedIds.containsAll(propertyIds)) { Set<String> keepers = new HashSet<String>(); Set<String> unsupportedPropertyIds = new HashSet<String>(propertyIds); unsupportedPropertyIds.removeAll(combinedIds); for (String unsupportedPropertyId : unsupportedPropertyIds) { if (checkCategory(unsupportedPropertyId) || checkRegExp(unsupportedPropertyId)) { keepers.add(unsupportedPropertyId); } } propertyIds.retainAll(combinedIds); propertyIds.addAll(keepers); } return propertyIds; } BaseProvider(Set<String> propertyIds); Set<String> checkPropertyIds(Set<String> propertyIds); Set<String> getPropertyIds(); Set<String> getCategoryIds(); }
BaseProvider { protected Set<String> getRequestPropertyIds(Request request, Predicate predicate) { Set<String> propertyIds = request.getPropertyIds(); if (propertyIds == null || propertyIds.isEmpty()) { return new HashSet<String>(this.propertyIds); } propertyIds = new HashSet<String>(propertyIds); if (predicate != null) { propertyIds.addAll(PredicateHelper.getPropertyIds(predicate)); } if (!combinedIds.containsAll(propertyIds)) { Set<String> keepers = new HashSet<String>(); Set<String> unsupportedPropertyIds = new HashSet<String>(propertyIds); unsupportedPropertyIds.removeAll(combinedIds); for (String unsupportedPropertyId : unsupportedPropertyIds) { if (checkCategory(unsupportedPropertyId) || checkRegExp(unsupportedPropertyId)) { keepers.add(unsupportedPropertyId); } } propertyIds.retainAll(combinedIds); propertyIds.addAll(keepers); } return propertyIds; } BaseProvider(Set<String> propertyIds); Set<String> checkPropertyIds(Set<String> propertyIds); Set<String> getPropertyIds(); Set<String> getCategoryIds();  }