int limitedAttributeSize = mixed.getProperties() != null ? mixed.getProperties().size() : 0; final FeatureCollection<T, F> fc = delegate.getFeatures(mixed); if (fc == null) {
List<PropertyName> securityProperties = securityQuery.getProperties(); if (securityProperties != null && securityProperties.size() > 0) { List<PropertyName> userProperties = userQuery.getProperties(); if (userProperties == null) { result.setProperties(securityProperties);
List<PropertyName> nativeProperties = nativeQuery.getProperties(); Query q = new Query(nativeQuery); if (nativeProperties == Query.ALL_PROPERTIES) {
/** * Returns true if the query will hit all the geometry columns with no row filtering (a * condition that allows to use spatial index statistics to compute the table bounds) * * @param query * @param schema * @return */ private boolean isFullBoundsQuery(Query query, SimpleFeatureType schema) { if (query == null) { return true; } if (!Filter.INCLUDE.equals(query.getFilter())) { return false; } if (query.getProperties() == Query.ALL_PROPERTIES) { return true; } List<String> names = Arrays.asList(query.getPropertyNames()); for (AttributeDescriptor ad : schema.getAttributeDescriptors()) { if (ad instanceof GeometryDescriptor) { if (!names.contains(ad.getLocalName())) { return false; } } } return true; }
if (query.getProperties() == null) { return; for (PropertyName attribute : query.getProperties()) { if (attribute.evaluate(schema) == null) { if (schema instanceof SimpleFeatureType) {
/** * Copy contructor. * * @param query the query to copy */ public Query(Query query) { this( query.getTypeName(), query.getNamespace(), query.getFilter(), query.getMaxFeatures(), query.getProperties(), query.getHandle()); this.sortBy = query.getSortBy(); this.coordinateSystem = query.getCoordinateSystem(); this.coordinateSystemReproject = query.getCoordinateSystemReproject(); this.version = query.getVersion(); this.hints = query.getHints(); this.startIndex = query.getStartIndex(); this.alias = query.getAlias(); this.joins = new ArrayList(); for (Join j : query.getJoins()) { this.joins.add(new Join(j)); } }
/** Test of set/getProperties method, of class org.geotools.data.Query. */ public void testProperties() { final FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); // System.out.println("testProperties"); Query query = new Query(); assertNull(query.getProperties()); List<PropertyName> properties = new ArrayList<PropertyName>(); NamespaceSupport nsContext = new NamespaceSupport(); nsContext.declarePrefix("foo", "FooNamespace"); PropertyName fooProp = ff.property("foo", nsContext); PropertyName barProp = ff.property("bar", nsContext); properties.add(fooProp); properties.add(barProp); query.setProperties(properties); List<PropertyName> properties2 = query.getProperties(); assertNotNull(properties); assertEquals(fooProp, properties2.get(0)); assertEquals(barProp, properties2.get(1)); assertEquals(nsContext, properties2.get(0).getNamespaceContext()); // test compatibility with getPropertyNames method String[] names = query.getPropertyNames(); assertEquals("foo", names[0]); assertEquals("bar", names[1]); query.setProperties(Query.ALL_PROPERTIES); assertNull(query.getProperties()); query = new Query("Test", Filter.INCLUDE, properties); assertNotNull(query.getProperties()); }
joinAttributes(firstQuery.getProperties(), secondQuery.getProperties());
/** * Copy contructor, clones the state of a generic Query into a DefaultQuery * * @param query */ public DefaultQuery(Query query) { this( query.getTypeName(), query.getNamespace(), query.getFilter(), query.getMaxFeatures(), query.getProperties(), query.getHandle()); this.sortBy = query.getSortBy(); this.coordinateSystem = query.getCoordinateSystem(); this.coordinateSystemReproject = query.getCoordinateSystemReproject(); this.version = query.getVersion(); this.hints = query.getHints(); this.startIndex = query.getStartIndex(); this.alias = query.getAlias(); this.joins = query.getJoins(); } }
if (query != null && query.getProperties() != null) { setPropertyNames(query.getProperties()); } else {
List<PropertyName> propNames = getSurrogatePropertyNames( query.getProperties(), mapping, includeProps instanceof Boolean
/** Test of getPropertyNames method, of class org.geotools.data.Query. */ public void testPropertyNames() { // System.out.println("testPropertyNames"); Query query = new Query(); assertNull(query.getPropertyNames()); query.setPropertyNames(new String[] {"foo", "bar"}); String names[] = query.getPropertyNames(); assertNotNull(names); assertEquals("foo", names[0]); List list = Arrays.asList(names); query.setPropertyNames(list); names = query.getPropertyNames(); assertEquals("bar", names[1]); // test compatibility with getProperties method List<PropertyName> properties2 = query.getProperties(); assertNotNull(properties2); assertEquals("foo", properties2.get(0).getPropertyName()); assertEquals("bar", properties2.get(1).getPropertyName()); query.setPropertyNames(Query.ALL_NAMES); assertNull(query.getPropertyNames()); query = new Query("Test", Filter.INCLUDE, new String[] {"foo", "wibble"}); assertNotNull(query.getPropertyNames()); }
private Query namedQuery(Query query) { Query namedQuery = namedQuery( query.getFilter(), query.getMaxFeatures(), query instanceof JoiningQuery); namedQuery.setProperties(query.getProperties()); namedQuery.setCoordinateSystem(query.getCoordinateSystem()); namedQuery.setCoordinateSystemReproject(query.getCoordinateSystemReproject()); namedQuery.setHandle(query.getHandle()); namedQuery.setMaxFeatures(query.getMaxFeatures()); namedQuery.setStartIndex(query.getStartIndex()); namedQuery.setSortBy(query.getSortBy()); namedQuery.setHints(query.getHints()); if (query instanceof JoiningQuery) { ((JoiningQuery) namedQuery).setQueryJoins(((JoiningQuery) query).getQueryJoins()); ((JoiningQuery) namedQuery).setRootMapping(((JoiningQuery) query).getRootMapping()); } return namedQuery; }
/** * Searches for an optional property among the query attributes. Returns true only if the * property is explicitly listed * * @param query * @param property * @return */ protected boolean hasOutputProperty(Query query, Name property, boolean includedByDefault) { if (query.getProperties() == null) { return includedByDefault; } final String localPart = property.getLocalPart(); final String namespaceURI = property.getNamespaceURI(); for (PropertyName pn : query.getProperties()) { if (localPart.equals(pn.getPropertyName()) && (pn.getNamespaceContext() == null || namespaceURI.equals(pn.getNamespaceContext().getURI("")))) { return true; } } return false; }
return false; if(query.getProperties() == Query.ALL_PROPERTIES) { return true;
/** * Checks the attributes in the query (which we got from the SLD) match the * schema, throws an {@link IllegalFilterException} otherwise * @param schema * @param attributeNames */ void checkAttributeExistence(FeatureType schema, Query query) { if(query.getProperties() == null) { return; } for (PropertyName attribute : query.getProperties()) { if(attribute.evaluate(schema) == null) { if (schema instanceof SimpleFeatureType) { List<Name> allNames = new ArrayList<Name>(); for (PropertyDescriptor pd : schema.getDescriptors()) { allNames.add(pd.getName()); } throw new IllegalFilterException("Could not find '" + attribute + "' in the FeatureType (" + schema.getName() + "), available attributes are: " + allNames); } else { throw new IllegalFilterException("Could not find '" + attribute + "' in the FeatureType (" + schema.getName() + ")"); } } } }
if (q.getProperties() != null && q.getProperties().size() > 0) { records = new RetypingFeatureCollection(records, q.getProperties());
if (query != null && query.getProperties() != null) { setPropertyNames(query.getProperties()); } else {
/** * Copy contructor, clones the state of a generic Query into a DefaultQuery * @param query */ public DefaultQuery(Query query) { this(query.getTypeName(), query.getNamespace(), query.getFilter(), query.getMaxFeatures(), query.getProperties(), query.getHandle()); this.sortBy = query.getSortBy(); this.coordinateSystem = query.getCoordinateSystem(); this.coordinateSystemReproject = query.getCoordinateSystemReproject(); this.version = query.getVersion(); this.hints = query.getHints(); this.startIndex = query.getStartIndex(); this.alias = query.getAlias(); this.joins = query.getJoins(); }
private Query namedQuery(Query query) { Query namedQuery = namedQuery(query.getFilter(), query.getMaxFeatures(), query instanceof JoiningQuery); namedQuery.setProperties(query.getProperties()); namedQuery.setCoordinateSystem(query.getCoordinateSystem()); namedQuery.setCoordinateSystemReproject(query.getCoordinateSystemReproject()); namedQuery.setHandle(query.getHandle()); namedQuery.setMaxFeatures(query.getMaxFeatures()); namedQuery.setSortBy(query.getSortBy()); namedQuery.setHints(query.getHints()); if (query instanceof JoiningQuery) { ((JoiningQuery) namedQuery).setQueryJoins(((JoiningQuery) query).getQueryJoins()); } return namedQuery; }