Class QueryParameters
- java.lang.Object
-
- com.esri.arcgisruntime.data.QueryParameters
-
public final class QueryParameters extends Object
Represents the input parameters for a query.- Since:
- 100.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QueryParameters.OrderBy
Represents the field the results are sorted by, and the sort order.static class
QueryParameters.SortOrder
Represents the the order in which results of a query are sorted.static class
QueryParameters.SpatialRelationship
Defines the spatial relationship between thegeometry
set on QueryParameters and the geometry of a feature table's feature.
-
Constructor Summary
Constructors Constructor Description QueryParameters()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Geometry
getGeometry()
Gets the geometry that will be used to perform a spatial query, along with the indicatedspatial relationship
.SpatialReference
getInSpatialReference()
Gets the spatial reference of the set geometry.double
getMaxAllowableOffset()
Gets the maximum allowable offset used for generalizing geometries returned by the query operation.int
getMaxFeatures()
Gets the maximum number of features to be included in the result.List<Long>
getObjectIds()
Gets a mutable list of object IDs of the features to be queried.List<QueryParameters.OrderBy>
getOrderByFields()
Gets a mutable list of OrderBy objects, indicating the fields the results are sorted by, and the order in which they are sorted.SpatialReference
getOutSpatialReference()
Gets the spatial reference of the feature geometry in the result.int
getResultOffset()
Gets the offset of results to fetch.QueryParameters.SpatialRelationship
getSpatialRelationship()
Gets the spatial relationship.TimeExtent
getTimeExtent()
Returns the time extent of the query.String
getWhereClause()
Gets the where clause; which is a legal SQL statement.boolean
isReturnGeometry()
Gets whether geometries of features are returned in the query result.void
setGeometry(Geometry geometry)
Sets the geometry that will be used to perform a spatial query, along with the indicatedspatial relationship
.void
setMaxAllowableOffset(double maxAllowableOffset)
Sets the maximum allowable offset used for generalizing geometries returned by the query operation.void
setMaxFeatures(int maxFeatures)
Sets the maximum number of features to be included in the result.void
setOutSpatialReference(SpatialReference outSR)
Sets the spatial reference of the feature geometry in the result.void
setResultOffset(int resultOffset)
Sets the offset of results to fetch.void
setReturnGeometry(boolean returnGeometry)
Sets whether to return geometries of features in the query result.void
setSpatialRelationship(QueryParameters.SpatialRelationship spatialRelationship)
Sets the spatial relationship to compare a givengeometry
to the geometry of a feature table's feature.void
setTimeExtent(TimeExtent timeExtent)
Sets the time extent of the query.void
setWhereClause(String whereClause)
Sets the where clause.
-
-
-
Method Detail
-
getWhereClause
public String getWhereClause()
Gets the where clause; which is a legal SQL statement.The string returned by
QueryParameters.getWhereClause()
should follow standard SQL syntax similar to what is discussed in the document SQL reference for query expressions used in ArcGIS.ArcGISFeatureTable
objects expect that anyField.Type.GLOBALID
orField.Type.GUID
parameters in the string that is used as theQueryParameters.setWhereClause(String)
are formatted as so:'{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
. All uppercase characters, wrapped in curly braces and surrounded by single quotes.If the string returned by
QueryParameters.getWhereClause()
is used by theOgcFeatureCollectionTable.populateFromServiceAsync(QueryParameters, boolean, List)
method, you can put any CQL2-TEXT or CQL2-JSON string as defined in the document OGC API - Features - Part3. Note: CQL-TEXT and CQL-JSON string are not supported withArcGISFeatureTable
objects.- Returns:
- the where clause
- Since:
- 100.0.0
- See Also:
setWhereClause(String)
-
setWhereClause
public void setWhereClause(String whereClause)
Sets the where clause. Any legal SQL where clause operating on the fields in the layer/table is allowed, for example 'POP2000 > 500000'.The string that is passed to
QueryParameters.setWhereClause(String)
can follow standard SQL syntax similar to what is discussed in the document SQL reference for query expressions used in ArcGIS.ArcGISFeatureTable
objects expect that anyField.Type.GLOBALID
orField.Type.GUID
parameters in the string that is used as theQueryParameters.setWhereClause(String)
are formatted as so:'{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
. All uppercase characters, wrapped in curly braces and surrounded by single quotes.If the string passed to
QueryParameters.setWhereClause(String)
is used by theOgcFeatureCollectionTable.populateFromServiceAsync(QueryParameters, boolean, List)
method, you can put any CQL2-TEXT or CQL2-JSON string as defined in the document OGC API - Features - Part3. Note: CQL-TEXT and CQL-JSON string are not supported withArcGISFeatureTable
objects.- Parameters:
whereClause
- the where clause. May be null or empty.- Since:
- 100.0.0
- See Also:
getWhereClause()
-
getGeometry
public Geometry getGeometry()
Gets the geometry that will be used to perform a spatial query, along with the indicatedspatial relationship
.- Returns:
- the the geometry to use.
- Since:
- 100.0.0
-
setGeometry
public void setGeometry(Geometry geometry)
Sets the geometry that will be used to perform a spatial query, along with the indicatedspatial relationship
. This can be used in addition to an attribute query.FeatureTable.hasGeometry()
must be true to use this method.- Parameters:
geometry
- the geometry to use.- Since:
- 100.0.0
-
getSpatialRelationship
public QueryParameters.SpatialRelationship getSpatialRelationship()
Gets the spatial relationship.- Returns:
- the spatial relationship.
- Since:
- 100.0.0
-
setSpatialRelationship
public void setSpatialRelationship(QueryParameters.SpatialRelationship spatialRelationship)
Sets the spatial relationship to compare a givengeometry
to the geometry of a feature table's feature.- Parameters:
spatialRelationship
- the spatial relationship- Throws:
IllegalArgumentException
- if input is null- Since:
- 100.0.0
-
getOutSpatialReference
public SpatialReference getOutSpatialReference()
Gets the spatial reference of the feature geometry in the result.- Returns:
- the spatial reference of the feature geometry in the result
- Since:
- 100.0.0
-
setOutSpatialReference
public void setOutSpatialReference(SpatialReference outSR)
Sets the spatial reference of the feature geometry in the result.- Parameters:
outSR
- the spatial reference of the feature geometry in the result. If null, then the output spatial reference is same as the spatial reference of the input geometry.- Since:
- 100.0.0
-
getInSpatialReference
public SpatialReference getInSpatialReference()
Gets the spatial reference of the set geometry.- Returns:
- the spatial reference of the set geometry. If no geometry is set, then null.
- Since:
- 100.0.0
-
setReturnGeometry
public void setReturnGeometry(boolean returnGeometry)
Sets whether to return geometries of features in the query result. By default, is true. Excluding geometries may be recommended for queries to a service in order to reduce the amount of information received over a network.- Parameters:
returnGeometry
- true to return geometries in the result; otherwise false.- Since:
- 100.0.0
-
isReturnGeometry
public boolean isReturnGeometry()
Gets whether geometries of features are returned in the query result.- Returns:
- true if geometries are returned in the result; false otherwise
- Since:
- 100.0.0
-
getObjectIds
public List<Long> getObjectIds()
Gets a mutable list of object IDs of the features to be queried. By default this list is empty. Add to this list to query for an object ID.- Returns:
- the object IDs of the features to be queried
- Since:
- 100.0.0
-
getOrderByFields
public List<QueryParameters.OrderBy> getOrderByFields()
Gets a mutable list of OrderBy objects, indicating the fields the results are sorted by, and the order in which they are sorted. By default this list is empty. Add instances of OrderBy to this list to sort the query result.- Returns:
- a mutable list of OrderBy objects
- Since:
- 100.0.0
-
setMaxFeatures
public void setMaxFeatures(int maxFeatures)
Sets the maximum number of features to be included in the result. If 0, then there is no limit set on the number of features.- Parameters:
maxFeatures
- the maximum number of features to be included in the result- Throws:
IllegalArgumentException
- if input is less than 0- Since:
- 100.0.0
-
getMaxFeatures
public int getMaxFeatures()
Gets the maximum number of features to be included in the result.- Returns:
- the maximum number of features to be included in the result.
- Since:
- 100.0.0
-
setResultOffset
public void setResultOffset(int resultOffset)
Sets the offset of results to fetch.If providing a result offset to support paging of results, you must also set a maximum features value. If result offset is set, but maximum features is not, the offset will be ignored.
For consistent ordering of results, include a
QueryParameters.OrderBy
in the list provided bygetOrderByFields()
.- Parameters:
resultOffset
- the offset of results to fetch- Since:
- 100.2.1
-
getResultOffset
public int getResultOffset()
Gets the offset of results to fetch.If providing a result offset to support paging of results, you must also set a maximum features value. If result offset is set, but maximum features is not, the offset will be ignored.
- Returns:
- the offset of results to fetch
- Since:
- 100.2.1
-
setTimeExtent
public void setTimeExtent(TimeExtent timeExtent)
Sets the time extent of the query. The time extent can be null to indicate an infinite extent.- Parameters:
timeExtent
- the time extent- Since:
- 100.3.0
-
getTimeExtent
public TimeExtent getTimeExtent()
Returns the time extent of the query.- Returns:
- the time extent, or null if no time extent is set
- Since:
- 100.3.0
-
getMaxAllowableOffset
public double getMaxAllowableOffset()
Gets the maximum allowable offset used for generalizing geometries returned by the query operation. The default is 0. If 0 is specified the value is not passed to the server in the query operation. The offset is in the units of theoutSpatialReference
. If an outSpatialReference is not defined, the spatial reference of the service is used.- Returns:
- the maximum allowable offset
- Since:
- 100.4.0
-
setMaxAllowableOffset
public void setMaxAllowableOffset(double maxAllowableOffset)
Sets the maximum allowable offset used for generalizing geometries returned by the query operation. The default is 0. If 0 is specified the value is not passed to the server in the query operation. The offset is in the units of theoutSpatialReference
. If an outSpatialReference is not defined, the spatial reference of the service is used.- Parameters:
maxAllowableOffset
- the maximum allowable offset- Since:
- 100.4.0
-
-