Interface FeatureQuery
- All Superinterfaces:
Cloneable,org.gvsig.tools.lang.Cloneable,DataQuery,org.gvsig.tools.persistence.Persistent,org.gvsig.json.SupportFromJson,org.gvsig.json.SupportJson,org.gvsig.json.SupportToJson
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.
- Author:
- 2009- César Ordiñana - gvSIG team
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAggregate(String funcName, String columnName) voidaddAttributeName(String attributeName) Adds the attribute to the list of attributes that the query resultFeaturemust have.voidaddConstantAttributeName(String attributeName) Add an attribute name that will be treated as constant for eachFeature.voidaddExtraColumn(String name, int datatype, org.gvsig.expressionevaluator.Expression expression) Adds the expression to the list of attributes that the query resultFeaturemust have.voidvoidaddFilter(org.gvsig.expressionevaluator.Expression filter) voidaddFilter(org.gvsig.tools.evaluator.Evaluator filter) Adds a filter to apply to theFeatures to load.voidvoidRemove all the attribute names specifieds.voidRemove all the names specified as constants attributes.voidvoidvoidcopyFrom(FeatureQuery query) getAggregate(String name) Deprecated.getAggregate(String tableName, String name) getAggregateFunction(String name) Return the aggregate functions useds for every attribute of the feature.String[]Returns the names of the attributes to load from eachFeature.String[]Returns the names of the attributes that are constants in eachFeature.getCopy()org.gvsig.expressionevaluator.ExpressionReturn the Expression associated to the filter.Extra local columns to the query.Returns theFeatureTypeid of theFeatures to load.org.gvsig.tools.evaluator.EvaluatorReturns the filter to apply to theFeatures to load.Return the names of attributes for group the features.longgetLimit()Returns the maximum number of elements to return with this query.getOrder()Returns the order of theFeatures to load.longReturns the load page size, as the number of elements to be retrieved in block by the data source.org.gvsig.expressionevaluator.MutableSymbolTablebooleanbooleanhasAttributeName(String pkname) booleanReturn true if has set attribute namesbooleanReturn true if has set constants attribute namesbooleanReturns if a filter has been defined for the query.booleanbooleanhasLimit()booleanhasOrder()Returns if an order has been set for the elements returned by the query.booleanisAggregate(String name) booleanisAGroupByColumn(String name) booleanReturns true if a subquery should be used.voidremoveAggregateFunction(String colname) voidremoveGroupByColumn(String colname) voidvoidsetAttributeNames(String[] attributeNames) Sets the names of the attributes to load from eachFeature.voidsetConstantsAttributeNames(String[] attributeNames) Set of attribute names to be treated as constants for eachFeature.voidsetFeatureType(FeatureType featureType) Sets theFeatureTypeof theFeatures to load.voidsetFeatureTypeId(String featureTypeId) Sets theFeatureTypeid of theFeatures to load.voidvoidsetFilter(org.gvsig.expressionevaluator.Expression filter) voidsetFilter(org.gvsig.tools.evaluator.Evaluator filter) Sets the filter to apply to theFeatures to load.voidsetLimit(long limit) Sets the maximum number of elements to return with this query.voidsetOrder(FeatureQueryOrder order) Sets the order of theFeatures to load.voidsetPageSize(long pageSize) Sets the load page size, as the number of elements to be retrieved in block by the data source.voidsetSymbolTable(org.gvsig.expressionevaluator.MutableSymbolTable symbolTable) voidsetUseSubquery(boolean useSubquery) Indicates whether to use a subquery or not in case the connection has an sql indicated.voidSet a variable in the symbol table associated to this searchPanel.Methods inherited from interface org.gvsig.tools.lang.Cloneable
cloneMethods inherited from interface org.gvsig.fmap.dal.DataQuery
getQueryParameter, getScale, setQueryParameter, setScaleMethods inherited from interface org.gvsig.tools.persistence.Persistent
loadFromState, saveToStateMethods inherited from interface org.gvsig.json.SupportFromJson
fromJsonMethods inherited from interface org.gvsig.json.SupportToJson
toJson, toJson, toJsonBuilder, toJsonBuilder
-
Field Details
-
NO_LIMIT
static final int NO_LIMIT- See Also:
-
-
Method Details
-
getAttributeNames
String[] getAttributeNames()Returns the names of the attributes to load from eachFeature.- Returns:
- the attribute names to load
-
setAttributeNames
Sets the names of the attributes to load from eachFeature.- Parameters:
attributeNames- the attribute names to load
-
retrievesAllAttributes
void retrievesAllAttributes() -
addAttributeName
Adds the attribute to the list of attributes that the query resultFeaturemust have.- Parameters:
attributeName- the attribute name to load
-
addPrimaryKeyAttributeNames
-
addEssentialAttributeNames
-
hasAttributeNames
boolean hasAttributeNames()Return true if has set attribute names- Returns:
- true if has attribute names, otherwise false
-
clearAttributeNames
void clearAttributeNames()Remove all the attribute names specifieds. -
getConstantsAttributeNames
String[] getConstantsAttributeNames()Returns the names of the attributes that are constants in eachFeature. These attributes will not be charged.- Returns:
- the attribute names that are constant
-
setConstantsAttributeNames
Set of attribute names to be treated as constants for eachFeature.- Parameters:
attributeNames- the attribute names to be constants
-
addConstantAttributeName
Add an attribute name that will be treated as constant for eachFeature.- Parameters:
attributeName- the attribute name to be treated as constant
-
hasConstantsAttributeNames
boolean hasConstantsAttributeNames()Return true if has set constants attribute names- Returns:
- true if has constants attribute names, otherwise false
-
clearConstantsAttributeNames
void clearConstantsAttributeNames()Remove all the names specified as constants attributes. -
setFeatureType
Sets theFeatureTypeof theFeatures 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.- Parameters:
featureType- the feature type of the data to load
-
getFeatureTypeId
String getFeatureTypeId()Returns theFeatureTypeid of theFeatures to load.- Returns:
- the
FeatureTypeid of theFeatures to load
-
setFeatureTypeId
- Parameters:
featureTypeId- theFeatureTypeid of theFeatures to load
-
getFilter
org.gvsig.tools.evaluator.Evaluator getFilter()Returns the filter to apply to theFeatures to load.- Returns:
- the filter
-
getExpressionFilter
org.gvsig.expressionevaluator.Expression getExpressionFilter()Return the Expression associated to the filter. If the current filter is not an Expression, return null.- Returns:
- the expression of the filter.
-
setFilter
void setFilter(org.gvsig.tools.evaluator.Evaluator filter) Sets the filter to apply to theFeatures to load.- Parameters:
filter- the filter to apply to theFeatures to load
-
setFilter
void setFilter(org.gvsig.expressionevaluator.Expression filter) -
setFilter
-
addFilter
void addFilter(org.gvsig.tools.evaluator.Evaluator filter) Adds a filter to apply to theFeatures 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.- Parameters:
filter- a filter to apply to theFeatures to load
-
addFilter
void addFilter(org.gvsig.expressionevaluator.Expression filter) -
addFilter
-
clearFilter
void clearFilter() -
hasFilter
boolean hasFilter()Returns if a filter has been defined for the query.- Returns:
- if a filter has been defined for the query
-
getOrder
FeatureQueryOrder getOrder()Returns the order of theFeatures to load.- Returns:
- the order of the
Features to load
-
setOrder
Sets the order of theFeatures to load.- Parameters:
order- the order of theFeatures to load
-
hasOrder
boolean hasOrder()Returns if an order has been set for the elements returned by the query.- Returns:
- if an order has been set for the elements returned by the query
-
getCopy
FeatureQuery getCopy()- Returns:
- @Deprecated to be removed in gvSIG 2.0
- See Also:
-
getLimit
long getLimit()Returns the maximum number of elements to return with this query.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.
- Returns:
- the maximum number of elements to return with this query
-
setLimit
void setLimit(long limit) Sets the maximum number of elements to return with this query.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.
- Parameters:
limit- the maximum number of elements to return with this query
-
clearLimit
void clearLimit() -
getPageSize
long getPageSize()Returns the load page size, as the number of elements to be retrieved in block by the data source. This value is only used as a hint to the underlying data source, as a way to tell how many Features may be read in a block.- Returns:
- the load page size
-
setPageSize
void setPageSize(long pageSize) Sets the load page size, as the number of elements to be retrieved in block by the data source. This value is only used as a hint to the underlying data source, as a way to tell how many Features may be read in a block.- Parameters:
pageSize- the load page size
-
isUseSubquery
boolean isUseSubquery()Returns true if a subquery should be used. It will only take effect when the sql perameter of the connection has a value.- Returns:
-
setUseSubquery
void setUseSubquery(boolean useSubquery) Indicates whether to use a subquery or not in case the connection has an sql indicated. This flag will have no effect if the "sql" parameter in the connection has not been specified. By default it will be true and whenever an sql has been indicated in the connection, a subquery will be used to access the data. If false is assigned, the sql should return, in the same order, the rows required by the FeatureType of the store.- Parameters:
useSubquery-
-
getGroupByColumns
Return the names of attributes for group the features.- Returns:
- the list of names to group features.
-
removeGroupByColumn
-
isAGroupByColumn
-
hasGroupByColumns
boolean hasGroupByColumns() -
getAggregateFunctions
Return the aggregate functions useds for every attribute of the feature. The map is indexed by the name of the attribute and contains the aggregate functions used by each attribute.- Returns:
- a Map with the aggregate function by attribute
-
removeAggregateFunction
-
getAggregateFunction
-
addAggregate
-
getAggregate
Deprecated. -
getAggregate
-
isAggregate
-
hasAggregateFunctions
boolean hasAggregateFunctions() -
copyFrom
-
getExtraColumn
FeatureExtraColumns getExtraColumn() -
getExtraColumns
FeatureExtraColumns getExtraColumns()Extra local columns to the query. It will never be null.- Returns:
-
getSymbolTable
org.gvsig.expressionevaluator.MutableSymbolTable getSymbolTable() -
setSymbolTable
void setSymbolTable(org.gvsig.expressionevaluator.MutableSymbolTable symbolTable) -
setVar
Set a variable in the symbol table associated to this searchPanel.- Parameters:
name-value-
-
hasLimit
boolean hasLimit() -
addExtraColumn
EditableFeatureAttributeDescriptor addExtraColumn(String name, int datatype, org.gvsig.expressionevaluator.Expression expression) Adds the expression to the list of attributes that the query resultFeaturemust have.- Parameters:
name- , the name of the new attributedatatype- , the type of the new attributeexpression- , the expression of the new attribute- Returns:
- the
EditableFeatureAttributeDescriptorof the new extra-column added
-
hasAttributeName
-