public class DefaultFeatureQuery extends Object implements FeatureQuery
A FeatureQuery is always defined by a FeatureType, or by the list of attribute names of the FeatureStore to return.
The filter allows to select Features whose properties have values with the characteristics defined by the filter.
The order is used to set the order of the result FeatureCollection, based on the values of the properties of the Features.
The scale parameter can be used by the FeatureStore as a hint about the quality or resolution of the data needed to view or operate with the data returned. As an example, the FeatureStore may use the scale to return only a representative subset of the data, or maybe to return Features with less detail, like a point or a line instead of a polygon.
If an implementation of FeatureStore is able to get other parameters to customize the behavior of the getDataCollection methods, there is an option to set more parameters through the setAttribute method.
| Modifier and Type | Field and Description |
|---|---|
static String |
SCALE_PARAM_NAME |
| Constructor and Description |
|---|
DefaultFeatureQuery()
Creates a FeatureQuery which will load all available Features of a type.
|
DefaultFeatureQuery(FeatureType featureType)
Creates a FeatureQuery which will load all available Features of a type.
|
DefaultFeatureQuery(FeatureType featureType,
Evaluator filter)
Creates a FeatureQuery with the type of features, a filter and the order
for the FeatureCollection.
|
DefaultFeatureQuery(FeatureType featureType,
Evaluator filter,
double scale)
Creates a FeatureQuery with the type of features, a filter, the order for
the FeatureCollection and the view scale.
|
DefaultFeatureQuery(String[] attributeNames)
Creates a FeatureQuery which will load a list of attribute names of all
available Features.
|
DefaultFeatureQuery(String[] attributeNames,
Evaluator filter)
Creates a FeatureQuery with the list of attribute names of feature, a
filter and the order for the FeatureCollection.
|
DefaultFeatureQuery(String[] attributeNames,
Evaluator filter,
double scale)
Creates a FeatureQuery with the list of attribute names of feature, a
filter, the order for the FeatureCollection and the view scale.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttributeName(String attributeName)
Adds the name of an attribute that has to be used to load each
Feature. |
void |
addConstantAttributeName(String attributeName)
Add an attribute name that will be treated as constant for each
Feature. |
void |
addFilter(Evaluator evaluator)
Adds a filter to apply to the
Features to load. |
void |
clearAttributeNames()
Remove all the attribute names specifieds.
|
void |
clearConstantsAttributeNames()
Remove all the names specified as constants attributes.
|
Object |
clone()
Creates a copy of the object.
|
String[] |
getAttributeNames()
Returns the names of the attributes to load from each
Feature. |
String[] |
getConstantsAttributeNames()
Returns the names of the attributes that are constants in each
Feature. |
FeatureQuery |
getCopy() |
String |
getFeatureTypeId()
Returns the
FeatureType id of the Features to load. |
Evaluator |
getFilter()
Returns the filter to apply to the
Features to load. |
long |
getLimit()
Returns the maximum number of elements to return with this query.
|
FeatureQueryOrder |
getOrder()
Returns the order of the
Features to load. |
long |
getPageSize()
Returns the load page size, as the number of elements to be retrieved in
block by the data source.
|
Object |
getQueryParameter(String name)
Returns the value of an query parameter.
|
double |
getScale()
Returns the scale of the data to load.
|
boolean |
hasAttributeNames()
Return true if has set attribute names
|
boolean |
hasConstantsAttributeNames()
Return true if has set constants attribute names
|
boolean |
hasFilter()
Returns if a filter has been defined for the query.
|
boolean |
hasOrder()
Returns if an order has been set for the elements returned by the query.
|
void |
loadFromState(PersistentState state)
Set the state of the object from the state passed as parameter.
|
static void |
registerPersistent()
Register the class on PersistenceManager
|
void |
saveToState(PersistentState state)
Saves the internal state of the object on the provided
PersistentState object.
|
void |
setAttributeNames(String[] attributeNames)
Sets the names of the attributes to load from each
Feature. |
void |
setConstantsAttributeNames(String[] constantsAttributeNames)
Set of attribute names to be treated as constants for each
Feature. |
void |
setFeatureType(FeatureType featureType)
Sets the
FeatureType of the Features to load. |
void |
setFeatureTypeId(String featureTypeId)
Sets the
FeatureType id of the Features to load. |
void |
setFilter(Evaluator filter)
Sets the filter to apply to the
Features to load. |
void |
setLimit(long limit)
Sets the maximum number of elements to return with this query.
|
void |
setOrder(FeatureQueryOrder order)
Sets the order of the
Features to load. |
void |
setPageSize(long pageSize)
Sets the load page size, as the number of elements to be retrieved in
block by the data source.
|
void |
setQueryParameter(String name,
Object value)
Sets the value of an query parameter.
|
void |
setScale(double scale)
Sets the scale.
|
public static final String SCALE_PARAM_NAME
public DefaultFeatureQuery()
featureType - the type of Features of the querypublic DefaultFeatureQuery(FeatureType featureType)
featureType - the type of Features of the querypublic DefaultFeatureQuery(FeatureType featureType, Evaluator filter)
featureType - the type of Features of the queryfilter - based on the properties of the Featuresorder - for the resultpublic DefaultFeatureQuery(FeatureType featureType, Evaluator filter, double scale)
featureType - the type of Features of the queryfilter - based on the properties of the Featuresorder - for the resultscale - to view the Features.public DefaultFeatureQuery(String[] attributeNames)
attributeNames - the list of attribute names to loadpublic DefaultFeatureQuery(String[] attributeNames, Evaluator filter)
attributeNames - the list of attribute names to loadfilter - based on the properties of the Featuresorder - for the resultpublic DefaultFeatureQuery(String[] attributeNames, Evaluator filter, double scale)
attributeNames - the list of attribute names to loadfilter - based on the properties of the Featuresorder - for the resultscale - to view the Features.public double getScale()
DataQuerypublic void setScale(double scale)
DataQuerypublic Object getQueryParameter(String name)
DataQuerygetQueryParameter in interface DataQueryname - of the parameterpublic void setQueryParameter(String name, Object value)
DataQuerysetQueryParameter in interface DataQueryname - of the query parametervalue - for the query parameterpublic void setFeatureType(FeatureType featureType)
FeatureQueryFeatureType of the Features to load. It may be
used as an alternative way to set a subset of the list of attribute names
to load, by creating a sub-FeatureType.setFeatureType in interface FeatureQueryfeatureType - the feature type of the data to loadpublic String[] getAttributeNames()
FeatureQueryFeature.getAttributeNames in interface FeatureQuerypublic void setAttributeNames(String[] attributeNames)
FeatureQueryFeature.setAttributeNames in interface FeatureQueryattributeNames - the attribute names to loadpublic void addAttributeName(String attributeName)
FeatureQueryFeature.addAttributeName in interface FeatureQueryattributeName - the attribute name to loadpublic boolean hasAttributeNames()
FeatureQueryhasAttributeNames in interface FeatureQuerypublic void clearAttributeNames()
FeatureQueryclearAttributeNames in interface FeatureQuerypublic Evaluator getFilter()
FeatureQueryFeatures to load.getFilter in interface FeatureQuerypublic void setFilter(Evaluator filter)
FeatureQueryFeatures to load.setFilter in interface FeatureQueryfilter - the filter to apply to the Features to loadpublic void addFilter(Evaluator evaluator)
FeatureQueryFeatures to load. A query
can have more that one filter and all of them are applied when
the query is applied.
If filter is null do nothing.addFilter in interface FeatureQueryevaluator - a filter to apply to the Features to loadpublic FeatureQueryOrder getOrder()
FeatureQueryFeatures to load.getOrder in interface FeatureQueryFeatures to loadpublic void setOrder(FeatureQueryOrder order)
FeatureQueryFeatures to load.setOrder in interface FeatureQueryorder - the order of the Features to loadpublic boolean hasFilter()
FeatureQueryhasFilter in interface FeatureQuerypublic boolean hasOrder()
FeatureQueryhasOrder in interface FeatureQuerypublic Object clone() throws CloneNotSupportedException
Cloneableclone in class ObjectCloneNotSupportedException - if the instance of the object cannot
be cloned. As this is extending Cloneable so
its sure it implements it, so this exception may be used for problems
on specific object instances.Object#clone()}.public FeatureQuery getCopy()
getCopy in interface FeatureQueryCloneable.clone()public String getFeatureTypeId()
FeatureQueryFeatureType id of the Features to load.getFeatureTypeId in interface FeatureQueryFeatureType id of the Features to loadpublic void setFeatureTypeId(String featureTypeId)
FeatureQuerysetFeatureTypeId in interface FeatureQueryfeatureTypeId - the FeatureType id of the Features to loadpublic void saveToState(PersistentState state) throws PersistenceException
PersistentsaveToState in interface PersistentPersistenceExceptionpublic void loadFromState(PersistentState state) throws PersistenceException
PersistentloadFromState in interface PersistentPersistenceExceptionpublic static void registerPersistent()
public long getLimit()
FeatureQueryNOTE: this value may be ignored by the underlying data source, or only used as a hint, so don't rely on it being used, as you may actually get more values than the limit.
getLimit in interface FeatureQuerypublic long getPageSize()
FeatureQuerygetPageSize in interface FeatureQuerypublic void setLimit(long limit)
FeatureQueryNOTE: this value may be ignored by the underlying data source, or only used as a hint, so don't rely on it being used, as you may actually get more values than the limit.
setLimit in interface FeatureQuerylimit - the maximum number of elements to return with this querypublic void setPageSize(long pageSize)
FeatureQuerysetPageSize in interface FeatureQuerypageSize - the load page sizepublic String[] getConstantsAttributeNames()
FeatureQueryFeature.
These attributes will not be charged.getConstantsAttributeNames in interface FeatureQuerypublic void setConstantsAttributeNames(String[] constantsAttributeNames)
FeatureQueryFeature.setConstantsAttributeNames in interface FeatureQueryconstantsAttributeNames - the attribute names to be constantspublic void addConstantAttributeName(String attributeName)
FeatureQueryFeature.addConstantAttributeName in interface FeatureQueryattributeName - the attribute name to be treated as constantpublic boolean hasConstantsAttributeNames()
FeatureQueryhasConstantsAttributeNames in interface FeatureQuerypublic void clearConstantsAttributeNames()
FeatureQueryclearConstantsAttributeNames in interface FeatureQuery