|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.data.DefaultQuery
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.
Field Summary |
Fields inherited from interface org.geotools.data.Query |
ALL, ALL_NAMES, DEFAULT_MAX, FIDS, NO_NAMES, NO_NAMESPACE |
Constructor Summary | |
DefaultQuery()
No argument constructor. |
|
DefaultQuery(Query query)
Copy contructor, clones the state of a generic Query into a DefaultQuery |
|
DefaultQuery(java.lang.String typeName)
Query with typeName. |
|
DefaultQuery(java.lang.String typeName,
Filter filter)
Constructor with typeName and filter. |
|
DefaultQuery(java.lang.String typeName,
Filter filter,
int maxFeatures,
java.lang.String[] propNames,
java.lang.String handle)
Constructor that sets all fields. |
|
DefaultQuery(java.lang.String typeName,
Filter filter,
java.lang.String[] properties)
Constructor that sets the filter and properties |
|
DefaultQuery(java.lang.String typeName,
java.net.URI namespace,
Filter filter,
int maxFeatures,
java.lang.String[] propNames,
java.lang.String handle)
Constructor that sets all fields. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Equality based on propertyNames, maxFeatures, filter, typeName and version. |
org.opengis.referencing.crs.CoordinateReferenceSystem |
getCoordinateSystem()
getCoordinateSystem purpose. |
org.opengis.referencing.crs.CoordinateReferenceSystem |
getCoordinateSystemReproject()
getCoordinateSystemReproject purpose. |
Filter |
getFilter()
The Filter can be used to define constraints on a query. |
java.lang.String |
getHandle()
The handle attribute is included to allow a client to associate a mnemonic name to the Query request. |
int |
getMaxFeatures()
The optional maxFeatures can be used to limit the number of features that a query request retrieves. |
java.net.URI |
getNamespace()
The namespace attribute is used to indicate the namespace of the schema being represented. |
java.lang.String[] |
getPropertyNames()
The property names is used to specify the attributes that should be selected for the return feature collection. |
SortBy[] |
getSortBy()
Retrive list of SortBy information. |
java.lang.String |
getTypeName()
The typeName attribute is used to indicate the name of the feature type to be queried. |
java.lang.String |
getVersion()
From WFS Spec: The version attribute is included in order to accommodate systems that support feature versioning. |
int |
hashCode()
Hashcode based on propertyName, maxFeatures and filter. |
boolean |
retrieveAllProperties()
Convenience method to determine if the query should use the full schema (all properties) of the data source for the features returned. |
void |
setCoordinateSystem(org.opengis.referencing.crs.CoordinateReferenceSystem system)
setCoordinateSystem purpose. |
void |
setCoordinateSystemReproject(org.opengis.referencing.crs.CoordinateReferenceSystem system)
setCoordinateSystemReproject purpose. |
void |
setFilter(Filter filter)
Sets the filter to constrain the query. |
void |
setHandle(java.lang.String handle)
Sets a mnemonic name for the query request. |
void |
setMaxFeatures(int maxFeatures)
Sets the max features to retrieved by this query. |
void |
setPropertyNames(java.util.List propNames)
Sets the proper attributeTypes constructed from a schema and a list of propertyNames. |
void |
setPropertyNames(java.lang.String[] propNames)
Sets the properties to retrieve from the db. |
void |
setTypeName(java.lang.String typeName)
Sets the typename. |
java.lang.String |
toString()
Over ride of toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DefaultQuery()
public DefaultQuery(java.lang.String typeName)
typeName
- the name of the featureType to retrievepublic DefaultQuery(java.lang.String typeName, Filter filter)
typeName
- the name of the featureType to retrieve.filter
- the OGC filter to constrain the request.public DefaultQuery(java.lang.String typeName, Filter filter, java.lang.String[] properties)
typeName
- filter
- the OGC filter to constrain the request.properties
- an array of the properties to fetch.public DefaultQuery(java.lang.String typeName, Filter filter, int maxFeatures, java.lang.String[] propNames, java.lang.String handle)
typeName
- the name of the featureType to retrieve.filter
- the OGC filter to constrain the request.maxFeatures
- the maximum number of features to be returned.propNames
- an array of the properties to fetch.handle
- the name to associate with the query.public DefaultQuery(java.lang.String typeName, java.net.URI namespace, Filter filter, int maxFeatures, java.lang.String[] propNames, java.lang.String handle)
typeName
- the name of the featureType to retrieve.namespace
- Namespace for provided typeName, or null if unspecifiedfilter
- the OGC filter to constrain the request.maxFeatures
- the maximum number of features to be returned.propNames
- an array of the properties to fetch.handle
- the name to associate with the query.public DefaultQuery(Query query)
query
- Method Detail |
public java.lang.String[] getPropertyNames()
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.
getPropertyNames
in interface Query
public void setPropertyNames(java.lang.String[] propNames)
propNames
- The names of attributes to load from the datasouce.public void setPropertyNames(java.util.List propNames)
propNames
- the names of the properties to check against the
schema. If null then all attributes will be returned. If a List
of size 0 is used then only the featureIDs should be used.public boolean retrieveAllProperties()
retrieveAllProperties
in interface Query
public int getMaxFeatures()
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.
getMaxFeatures
in interface Query
public void setMaxFeatures(int maxFeatures)
maxFeatures
- the maximum number of features the getFeature call
should return.public Filter getFilter()
getFilter
in interface Query
public void setFilter(Filter filter)
filter
- the OGC filter to limit the datasource getFeatures
request.public java.lang.String getTypeName()
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.
getTypeName
in interface Query
public java.net.URI getNamespace()
Query
getNamespace
in interface Query
public void setTypeName(java.lang.String typeName)
typeName
- the name of the featureType to retrieve.public java.lang.String getHandle()
getHandle
in interface Query
public void setHandle(java.lang.String handle)
handle
- the name to refer to this query.public java.lang.String getVersion()
This is ready for use, it will be up to data store implementors to support it.
getVersion
in interface Query
public int hashCode()
public boolean equals(java.lang.Object obj)
Changing the handle does not change the meaning of the Query.
obj
- Other object to compare against
true
if obj
matches this filterpublic java.lang.String toString()
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateSystem()
Description ...
getCoordinateSystem
in interface Query
public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateSystemReproject()
Description ...
getCoordinateSystemReproject
in interface Query
public void setCoordinateSystem(org.opengis.referencing.crs.CoordinateReferenceSystem system)
Description ...
system
- public void setCoordinateSystemReproject(org.opengis.referencing.crs.CoordinateReferenceSystem system)
Description ...
system
- public SortBy[] getSortBy()
Note we are using SortBy2, to be standards complient you may limit yourself to to SortBy information.
getSortBy
in interface Query
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |