| java.lang.Object org.geotools.data.DefaultQuery
DefaultQuery | public class DefaultQuery implements Query(Code) | | The query object is used by the
FeatureSource.getFeatures method of
the DataSource interface, to encapsulate a request. It defines which
feature type to query, what properties to retrieve and what constraints
(spatial and non-spatial) to apply to those properties. It is designed to
closesly match a WFS Query element of a getFeatures request.
The only difference is the addition of the maxFeatures element, which
allows more control over the features selected. It allows a full
getFeatures request to properly control how many features it
gets from each query, instead of requesting and discarding when the max is
reached.
author: Chris Holmes |
Constructor Summary | |
public | DefaultQuery() /**
No argument constructor. | public | DefaultQuery(String typeName) Query with typeName. | public | DefaultQuery(String typeName, Filter filter) Constructor with typeName and filter. | public | DefaultQuery(String typeName, Filter filter, String[] properties) | public | DefaultQuery(String typeName, Filter filter, int maxFeatures, String[] propNames, String handle) Constructor that sets all fields. | public | DefaultQuery(String typeName, URI namespace, Filter filter, int maxFeatures, String[] propNames, String handle) Constructor that sets all fields. | public | DefaultQuery(Query query) |
Method Summary | |
public boolean | equals(Object obj) Equality based on propertyNames, maxFeatures, filter, typeName and
version. | public CoordinateReferenceSystem | getCoordinateSystem() getCoordinateSystem purpose. | public CoordinateReferenceSystem | getCoordinateSystemReproject() getCoordinateSystemReproject purpose. | public Filter | getFilter() The Filter can be used to define constraints on a query. | public String | getHandle() The handle attribute is included to allow a client to associate a
mnemonic name to the Query request. | public Hints | getHints() | public int | getMaxFeatures() The optional maxFeatures can be used to limit the number of features
that a query request retrieves. | public URI | getNamespace() | public String[] | getPropertyNames() The property names is used to specify the attributes that should be
selected for the return feature collection. | public SortBy[] | getSortBy() Retrive list of SortBy information. | public String | getTypeName() The typeName attribute is used to indicate the name of the feature type
to be queried. | public String | getVersion() From WFS Spec: The version attribute is included in order to
accommodate systems that support feature versioning. | public int | hashCode() Hashcode based on propertyName, maxFeatures and filter. | public boolean | retrieveAllProperties() Convenience method to determine if the query should use the full schema
(all properties) of the data source for the features returned. | public void | setCoordinateSystem(CoordinateReferenceSystem system) setCoordinateSystem purpose. | public void | setCoordinateSystemReproject(CoordinateReferenceSystem system) setCoordinateSystemReproject purpose. | public void | setFilter(Filter filter) Sets the filter to constrain the query. | public void | setHandle(String handle) Sets a mnemonic name for the query request. | public void | setHints(Hints hints) | public void | setMaxFeatures(int maxFeatures) Sets the max features to retrieved by this query. | public void | setPropertyNames(String[] propNames) Sets the properties to retrieve from the db. | public void | setPropertyNames(List propNames) Sets the proper attributeTypes constructed from a schema and a list of
propertyNames.
Parameters: propNames - the names of the properties to check against theschema. | public void | setSortBy(SortBy[] sortBy) Sets the sort by information. | public void | setTypeName(String typeName) Sets the typename. | public void | setVersion(String version) | public String | toString() |
DefaultQuery | public DefaultQuery()(Code) | | /**
No argument constructor.
|
DefaultQuery | public DefaultQuery(String typeName)(Code) | | Query with typeName.
Parameters: typeName - the name of the featureType to retrieve |
DefaultQuery | public DefaultQuery(String typeName, Filter filter)(Code) | | Constructor with typeName and filter. Note that current datasource
implementations only have one type per datasource, so the typeName
field will likely be ignored.
Parameters: typeName - the name of the featureType to retrieve. Parameters: filter - the OGC filter to constrain the request. |
DefaultQuery | public DefaultQuery(String typeName, Filter filter, String[] properties)(Code) | | Constructor that sets the filter and properties
Parameters: typeName - Parameters: filter - the OGC filter to constrain the request. Parameters: properties - an array of the properties to fetch. |
DefaultQuery | public DefaultQuery(String typeName, Filter filter, int maxFeatures, String[] propNames, String handle)(Code) | | Constructor that sets all fields.
Parameters: typeName - the name of the featureType to retrieve. Parameters: filter - the OGC filter to constrain the request. Parameters: maxFeatures - the maximum number of features to be returned. Parameters: propNames - an array of the properties to fetch. Parameters: handle - the name to associate with the query. |
DefaultQuery | public DefaultQuery(String typeName, URI namespace, Filter filter, int maxFeatures, String[] propNames, String handle)(Code) | | Constructor that sets all fields.
Parameters: typeName - the name of the featureType to retrieve. Parameters: namespace - Namespace for provided typeName, or null if unspecified Parameters: filter - the OGC filter to constrain the request. Parameters: maxFeatures - the maximum number of features to be returned. Parameters: propNames - an array of the properties to fetch. Parameters: handle - the name to associate with the query. |
DefaultQuery | public DefaultQuery(Query query)(Code) | | Copy contructor, clones the state of a generic Query into a DefaultQuery
Parameters: query - |
equals | public boolean equals(Object obj)(Code) | | Equality based on propertyNames, maxFeatures, filter, typeName and
version.
Changing the handle does not change the meaning of the Query.
Parameters: obj - Other object to compare against true if obj matches this filter |
getCoordinateSystem | public CoordinateReferenceSystem getCoordinateSystem()(Code) | | getCoordinateSystem purpose.
Description ...
|
getCoordinateSystemReproject | public CoordinateReferenceSystem getCoordinateSystemReproject()(Code) | | getCoordinateSystemReproject purpose.
Description ...
|
getFilter | public Filter getFilter()(Code) | | The Filter can be used to define constraints on a query. If no Filter
is present then the query is unconstrained and all feature instances
should be retrieved.
The filter that defines constraints on the query. |
getHandle | public String getHandle()(Code) | | The handle attribute is included to allow a client to associate a
mnemonic name to the Query request. The purpose of the handle attribute
is to provide an error handling mechanism for locating a statement
that might fail.
the mnemonic name of the query request. |
getMaxFeatures | public int getMaxFeatures()(Code) | | The optional maxFeatures can be used to limit the number of features
that a query request retrieves. If no maxFeatures is specified then
all features should be returned.
This is the only method that is not directly out of the Query element in
the WFS spec. It is instead a part of a getFeatures
request, which can hold one or more queries. But each of those in turn
will need a maxFeatures, so it is needed here.
the max features the getFeature call should return. |
getPropertyNames | public String[] getPropertyNames()(Code) | | The property names is used to specify the attributes that should be
selected for the return feature collection. If the property array is
null, then the datasource should return all available properties, its
full schema. If an array of specified then the full schema should be
used (all property names). The property names can be determined with a
getSchema call from the DataSource interface.
This replaces our funky setSchema method of retrieving select
properties. I think it makes it easier to understand how to get
certain properties out of the datasource, instead of having users get
the schema and then compose a new schema using the attributes that
they want. The old way was also giving me problems because I couldn't
have multiple object reuse the same datasource object, since some other
object could come along and change its schema, and would then return
the wrong properties.
the property names to be used in the returned FeatureCollection. |
getSortBy | public SortBy[] getSortBy()(Code) | | Retrive list of SortBy information.
Note we are using SortBy2, to be standards complient
you may limit yourself to to SortBy information.
|
getTypeName | public String getTypeName()(Code) | | The typeName attribute is used to indicate the name of the feature type
to be queried.
The DataStore API does not assume one feature type per datastore.
It currently makes use of this field to to specify with each request
what type to get.
the name of the feature type to be returned with this query. |
getVersion | public String getVersion()(Code) | | From WFS Spec: The version attribute is included in order to
accommodate systems that support feature versioning. A value of ALL
indicates that all versions of a feature should be fetched. Otherwise
an integer, n, can be specified to return the n th version of a
feature. The version numbers start at '1' which is the oldest version.
If a version value larger than the largest version is specified then
the latest version is return. The default action shall be for the query
to return the latest version. Systems that do not support versioning
can ignore the parameter and return the only version that they have.
This is ready for use, it will be up to data store implementors to
support it.
the version of the feature to return, or null for latest. |
hashCode | public int hashCode()(Code) | | Hashcode based on propertyName, maxFeatures and filter.
hascode for filter |
retrieveAllProperties | public boolean retrieveAllProperties()(Code) | | Convenience method to determine if the query should use the full schema
(all properties) of the data source for the features returned. This
method is equivalent to if (query.getProperties() == null), but allows
for more clarity on the part of datasource implementors, so they do not
need to examine and use null values. All Query implementations should
return true for this function if getProperties returns null.
if all datasource attributes should be included in the schemaof the returned FeatureCollection. |
setCoordinateSystem | public void setCoordinateSystem(CoordinateReferenceSystem system)(Code) | | setCoordinateSystem purpose.
Description ...
Parameters: system - |
setCoordinateSystemReproject | public void setCoordinateSystemReproject(CoordinateReferenceSystem system)(Code) | | setCoordinateSystemReproject purpose.
Description ...
Parameters: system - |
setFilter | public void setFilter(Filter filter)(Code) | | Sets the filter to constrain the query.
Parameters: filter - the OGC filter to limit the datasource getFeaturesrequest. |
setHandle | public void setHandle(String handle)(Code) | | Sets a mnemonic name for the query request.
Parameters: handle - the name to refer to this query. |
setHints | public void setHints(Hints hints)(Code) | | Sets the query hints
Parameters: hints - |
setMaxFeatures | public void setMaxFeatures(int maxFeatures)(Code) | | Sets the max features to retrieved by this query.
Parameters: maxFeatures - the maximum number of features the getFeature callshould return. |
setPropertyNames | public void setPropertyNames(String[] propNames)(Code) | | Sets the properties to retrieve from the db. If the boolean to load all
properties is set to true then the AttributeTypes that are not in the
database's schema will just be filled with null values.
Parameters: propNames - The names of attributes to load from the datasouce. |
setPropertyNames | public void setPropertyNames(List propNames)(Code) | | Sets the proper attributeTypes constructed from a schema and a list of
propertyNames.
Parameters: propNames - the names of the properties to check against theschema. If null then all attributes will be returned. If a Listof size 0 is used then only the featureIDs should be used. |
setSortBy | public void setSortBy(SortBy[] sortBy)(Code) | | Sets the sort by information.
|
setTypeName | public void setTypeName(String typeName)(Code) | | Sets the typename.
Parameters: typeName - the name of the featureType to retrieve. |
toString | public String toString()(Code) | | Over ride of toString
a string representation of this query object. |
|
|