@Test public void testQueryCapabilities() throws Exception { SimpleFeatureSource transformed = transformWithSelection(); QueryCapabilities caps = transformed.getQueryCapabilities(); assertTrue(caps.isOffsetSupported()); assertFalse(caps.isVersionSupported()); QueryCapabilities originalCaps = STATES.getQueryCapabilities(); assertEquals(originalCaps.isJoiningSupported(), caps.isJoiningSupported()); assertEquals(originalCaps.isReliableFIDSupported(), caps.isReliableFIDSupported()); assertEquals(originalCaps.isUseProvidedFIDSupported(), caps.isUseProvidedFIDSupported()); }
@Override public QueryCapabilities getQueryCapabilities() { return new QueryCapabilities() { @Override public boolean isOffsetSupported() { return true; } @Override public boolean isReliableFIDSupported() { return source.getQueryCapabilities().isReliableFIDSupported(); } @Override public boolean isJoiningSupported() { return false; } @Override public boolean isUseProvidedFIDSupported() { return source.getQueryCapabilities().isUseProvidedFIDSupported(); } @Override public boolean isVersionSupported() { return source.getQueryCapabilities().isVersionSupported(); } @Override public boolean supportsSorting(SortBy[] sortAttributes) { for (SortBy sortBy : sortAttributes) { if (sortBy == SortBy.NATURAL_ORDER || sortBy == SortBy.REVERSE_ORDER) { continue; } else { String pn = sortBy.getPropertyName().getPropertyName(); AttributeDescriptor descriptor = transformer.getSchema().getDescriptor(pn); if (descriptor == null) { return false; } else { Class<?> binding = descriptor.getType().getBinding(); if (!Comparable.class.isAssignableFrom(binding)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log( Level.FINE, "Can't sort on {0} because its property type {1} is not comparable", new Object[] {descriptor.getLocalName(), binding}); } return false; } } } } return true; } }; }
TransformFeatureSource implements SimpleFeatureSource { @Override public QueryCapabilities getQueryCapabilities() { return new QueryCapabilities() { @Override public boolean isOffsetSupported() { return true; } @Override public boolean isReliableFIDSupported() { return source.getQueryCapabilities().isReliableFIDSupported(); } @Override public boolean isJoiningSupported() { return false; } @Override public boolean isUseProvidedFIDSupported() { return source.getQueryCapabilities().isUseProvidedFIDSupported(); } @Override public boolean isVersionSupported() { return source.getQueryCapabilities().isVersionSupported(); } @Override public boolean supportsSorting(SortBy[] sortAttributes) { for (SortBy sortBy : sortAttributes) { if (sortBy == SortBy.NATURAL_ORDER || sortBy == SortBy.REVERSE_ORDER) { continue; } else { String pn = sortBy.getPropertyName().getPropertyName(); AttributeDescriptor descriptor = transformer.getSchema().getDescriptor(pn); if (descriptor == null) { return false; } else { Class<?> binding = descriptor.getType().getBinding(); if (!Comparable.class.isAssignableFrom(binding)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log( Level.FINE, "Can't sort on {0} because its property type {1} is not comparable", new Object[] {descriptor.getLocalName(), binding}); } return false; } } } } return true; } }; } }
TransformFeatureSource implements SimpleFeatureSource { @Override public QueryCapabilities getQueryCapabilities() { return new QueryCapabilities() { @Override public boolean isOffsetSupported() { return true; } @Override public boolean isReliableFIDSupported() { return source.getQueryCapabilities().isReliableFIDSupported(); } @Override public boolean isJoiningSupported() { return false; } @Override public boolean isUseProvidedFIDSupported() { return source.getQueryCapabilities().isUseProvidedFIDSupported(); } @Override public boolean isVersionSupported() { return source.getQueryCapabilities().isVersionSupported(); } @Override public boolean supportsSorting(SortBy[] sortAttributes) { for (SortBy sortBy : sortAttributes) { if (sortBy == SortBy.NATURAL_ORDER || sortBy == SortBy.REVERSE_ORDER) { continue; } else { String pn = sortBy.getPropertyName().getPropertyName(); AttributeDescriptor descriptor = transformer.getSchema().getDescriptor(pn); if (descriptor == null) { return false; } else { Class<?> binding = descriptor.getType().getBinding(); if (!Comparable.class.isAssignableFrom(binding)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log( Level.FINE, "Can't sort on {0} because its property type {1} is not comparable", new Object[] {descriptor.getLocalName(), binding}); } return false; } } } } return true; } }; } TransformFeatureSource(
            SimpleFeatureSource source, Name name, List<Definition> definitions); }
TransformFeatureSource implements SimpleFeatureSource { @Override public QueryCapabilities getQueryCapabilities() { return new QueryCapabilities() { @Override public boolean isOffsetSupported() { return true; } @Override public boolean isReliableFIDSupported() { return source.getQueryCapabilities().isReliableFIDSupported(); } @Override public boolean isJoiningSupported() { return false; } @Override public boolean isUseProvidedFIDSupported() { return source.getQueryCapabilities().isUseProvidedFIDSupported(); } @Override public boolean isVersionSupported() { return source.getQueryCapabilities().isVersionSupported(); } @Override public boolean supportsSorting(SortBy[] sortAttributes) { for (SortBy sortBy : sortAttributes) { if (sortBy == SortBy.NATURAL_ORDER || sortBy == SortBy.REVERSE_ORDER) { continue; } else { String pn = sortBy.getPropertyName().getPropertyName(); AttributeDescriptor descriptor = transformer.getSchema().getDescriptor(pn); if (descriptor == null) { return false; } else { Class<?> binding = descriptor.getType().getBinding(); if (!Comparable.class.isAssignableFrom(binding)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log( Level.FINE, "Can't sort on {0} because its property type {1} is not comparable", new Object[] {descriptor.getLocalName(), binding}); } return false; } } } } return true; } }; } TransformFeatureSource(
            SimpleFeatureSource source, Name name, List<Definition> definitions); @Override Name getName(); @Override ResourceInfo getInfo(); @Override DataAccess<SimpleFeatureType, SimpleFeature> getDataStore(); @Override QueryCapabilities getQueryCapabilities(); @Override void addFeatureListener(FeatureListener listener); @Override void removeFeatureListener(FeatureListener listener); @Override SimpleFeatureType getSchema(); @Override ReferencedEnvelope getBounds(); @Override ReferencedEnvelope getBounds(Query query); @Override int getCount(Query query); @Override Set<Key> getSupportedHints(); @Override SimpleFeatureCollection getFeatures(); @Override SimpleFeatureCollection getFeatures(Filter filter); @Override SimpleFeatureCollection getFeatures(Query query); }
TransformFeatureSource implements SimpleFeatureSource { @Override public QueryCapabilities getQueryCapabilities() { return new QueryCapabilities() { @Override public boolean isOffsetSupported() { return true; } @Override public boolean isReliableFIDSupported() { return source.getQueryCapabilities().isReliableFIDSupported(); } @Override public boolean isJoiningSupported() { return false; } @Override public boolean isUseProvidedFIDSupported() { return source.getQueryCapabilities().isUseProvidedFIDSupported(); } @Override public boolean isVersionSupported() { return source.getQueryCapabilities().isVersionSupported(); } @Override public boolean supportsSorting(SortBy[] sortAttributes) { for (SortBy sortBy : sortAttributes) { if (sortBy == SortBy.NATURAL_ORDER || sortBy == SortBy.REVERSE_ORDER) { continue; } else { String pn = sortBy.getPropertyName().getPropertyName(); AttributeDescriptor descriptor = transformer.getSchema().getDescriptor(pn); if (descriptor == null) { return false; } else { Class<?> binding = descriptor.getType().getBinding(); if (!Comparable.class.isAssignableFrom(binding)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log( Level.FINE, "Can't sort on {0} because its property type {1} is not comparable", new Object[] {descriptor.getLocalName(), binding}); } return false; } } } } return true; } }; } TransformFeatureSource(
            SimpleFeatureSource source, Name name, List<Definition> definitions); @Override Name getName(); @Override ResourceInfo getInfo(); @Override DataAccess<SimpleFeatureType, SimpleFeature> getDataStore(); @Override QueryCapabilities getQueryCapabilities(); @Override void addFeatureListener(FeatureListener listener); @Override void removeFeatureListener(FeatureListener listener); @Override SimpleFeatureType getSchema(); @Override ReferencedEnvelope getBounds(); @Override ReferencedEnvelope getBounds(Query query); @Override int getCount(Query query); @Override Set<Key> getSupportedHints(); @Override SimpleFeatureCollection getFeatures(); @Override SimpleFeatureCollection getFeatures(Filter filter); @Override SimpleFeatureCollection getFeatures(Query query);  }