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
Feature s 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 Feature s to load. |
Evaluator |
getFilter()
Returns the filter to apply to the
Feature s to load. |
long |
getLimit()
Returns the maximum number of elements to return with this query.
|
FeatureQueryOrder |
getOrder()
Returns the order of the
Feature s 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 Feature s to load. |
void |
setFeatureTypeId(String featureTypeId)
Sets the
FeatureType id of the Feature s to load. |
void |
setFilter(Evaluator filter)
Sets the filter to apply to the
Feature s 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
Feature s 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()
DataQuery
public void setScale(double scale)
DataQuery
public Object getQueryParameter(String name)
DataQuery
getQueryParameter
in interface DataQuery
name
- of the parameterpublic void setQueryParameter(String name, Object value)
DataQuery
setQueryParameter
in interface DataQuery
name
- of the query parametervalue
- for the query parameterpublic void setFeatureType(FeatureType featureType)
FeatureQuery
FeatureType
of the Feature
s 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 FeatureQuery
featureType
- the feature type of the data to loadpublic String[] getAttributeNames()
FeatureQuery
Feature
.getAttributeNames
in interface FeatureQuery
public void setAttributeNames(String[] attributeNames)
FeatureQuery
Feature
.setAttributeNames
in interface FeatureQuery
attributeNames
- the attribute names to loadpublic void addAttributeName(String attributeName)
FeatureQuery
Feature
.addAttributeName
in interface FeatureQuery
attributeName
- the attribute name to loadpublic boolean hasAttributeNames()
FeatureQuery
hasAttributeNames
in interface FeatureQuery
public void clearAttributeNames()
FeatureQuery
clearAttributeNames
in interface FeatureQuery
public Evaluator getFilter()
FeatureQuery
Feature
s to load.getFilter
in interface FeatureQuery
public void setFilter(Evaluator filter)
FeatureQuery
Feature
s to load.setFilter
in interface FeatureQuery
filter
- the filter to apply to the Feature
s to loadpublic void addFilter(Evaluator evaluator)
FeatureQuery
Feature
s 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 FeatureQuery
evaluator
- a filter to apply to the Feature
s to loadpublic FeatureQueryOrder getOrder()
FeatureQuery
Feature
s to load.getOrder
in interface FeatureQuery
Feature
s to loadpublic void setOrder(FeatureQueryOrder order)
FeatureQuery
Feature
s to load.setOrder
in interface FeatureQuery
order
- the order of the Feature
s to loadpublic boolean hasFilter()
FeatureQuery
hasFilter
in interface FeatureQuery
public boolean hasOrder()
FeatureQuery
hasOrder
in interface FeatureQuery
public Object clone() throws CloneNotSupportedException
Cloneable
clone
in class Object
CloneNotSupportedException
- 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 FeatureQuery
Cloneable.clone()
public String getFeatureTypeId()
FeatureQuery
FeatureType
id of the Feature
s to load.getFeatureTypeId
in interface FeatureQuery
FeatureType
id of the Feature
s to loadpublic void setFeatureTypeId(String featureTypeId)
FeatureQuery
setFeatureTypeId
in interface FeatureQuery
featureTypeId
- the FeatureType
id of the Feature
s to loadpublic void saveToState(PersistentState state) throws PersistenceException
Persistent
saveToState
in interface Persistent
PersistenceException
public void loadFromState(PersistentState state) throws PersistenceException
Persistent
loadFromState
in interface Persistent
PersistenceException
public static void registerPersistent()
public long getLimit()
FeatureQuery
NOTE: 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 FeatureQuery
public long getPageSize()
FeatureQuery
getPageSize
in interface FeatureQuery
public void setLimit(long limit)
FeatureQuery
NOTE: 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 FeatureQuery
limit
- the maximum number of elements to return with this querypublic void setPageSize(long pageSize)
FeatureQuery
setPageSize
in interface FeatureQuery
pageSize
- the load page sizepublic String[] getConstantsAttributeNames()
FeatureQuery
Feature
.
These attributes will not be charged.getConstantsAttributeNames
in interface FeatureQuery
public void setConstantsAttributeNames(String[] constantsAttributeNames)
FeatureQuery
Feature
.setConstantsAttributeNames
in interface FeatureQuery
constantsAttributeNames
- the attribute names to be constantspublic void addConstantAttributeName(String attributeName)
FeatureQuery
Feature
.addConstantAttributeName
in interface FeatureQuery
attributeName
- the attribute name to be treated as constantpublic boolean hasConstantsAttributeNames()
FeatureQuery
hasConstantsAttributeNames
in interface FeatureQuery
public void clearConstantsAttributeNames()
FeatureQuery
clearConstantsAttributeNames
in interface FeatureQuery