public class

QueryTask

extends Object
java.lang.Object
   ↳ com.esri.core.tasks.query.QueryTask

Class Overview

Used to perform a 'query' and 'query related records' operation on an ArcGIS Server service's layer/table resource supporting the respective operation.

In order to perform a query operation, an instance of QueryParameters must first be created and populated with the desired parameters. These parameters are then passed to either the QueryTask instance for either synchronous execution using execute, or asynchronous execution using executeAsync.

To perform a query related records operation, and instance of RelatedQueryParameters must first be created and populated with the required parameters and any additional parameters desired. These parameters are then passed to the QueryTask instance for either synchronous execution using executeRelationshipQuery, or asynchronous execution using executeRelationshipQueryAsync.

In all cases the operation, if successful, returns a FeatureResult of results found, either directly (synchronous execution) or via a callback (asynchronous execution).

Summary

Public Constructors
QueryTask(String url)
Instantiates a new query task using the URL of the layer/table resource.
QueryTask(String url, UserCredentials credentials)
Instantiates a new query task using the URL of the layer/table resource and the user credentials used to access this resource.
Public Methods
FeatureResult execute(QueryParameters query)
Execute the query synchronously.
Future<FeatureResult> execute(QueryParameters query, CallbackListener<FeatureResult> callback)
Execute the query asynchronously.
Future<Map<Long, FeatureResult>> executeRelationshipQuery(RelatedQueryParameters query, CallbackListener<Map<Long, FeatureResult>> callback)
Executes a related records query asynchronously according to the parameters provided.
Map<Long, FeatureResult> executeRelationshipQuery(RelatedQueryParameters query)
Executes a related records query according to the parameters provided.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public QueryTask (String url)

Instantiates a new query task using the URL of the layer/table resource.

Parameters
url String: the URL

public QueryTask (String url, UserCredentials credentials)

Instantiates a new query task using the URL of the layer/table resource and the user credentials used to access this resource.

Parameters
url String: the URL of the resource to query
credentials UserCredentials: the user credentials to access the resource
Throws
EsriSecurityException if there is a problem accessing the service using the credentials provided

Public Methods

public FeatureResult execute (QueryParameters query)

Execute the query synchronously.

Parameters
query QueryParameters: the parameters for the query
Returns
FeatureResult the feature set of query results
Throws
Exception any exception that occurs during execution

public Future<FeatureResult> execute (QueryParameters query, CallbackListener<FeatureResult> callback)

Execute the query asynchronously. Use this method over the synchronous execute method if your query might take more time to execute and you want your application to remain responsive during execution. Then, obtain the query results through the callback, or if any error has occurred.

Parameters
query QueryParameters: the parameters for the query
callback CallbackListener: the call back
Returns
Future<FeatureResult> Future of FeatureResult

public Future<Map<Long, FeatureResult>> executeRelationshipQuery (RelatedQueryParameters query, CallbackListener<Map<Long, FeatureResult>> callback)

Executes a related records query asynchronously according to the parameters provided.

Parameters
query RelatedQueryParameters: the parameters for the related records query
callback CallbackListener: the callback containing the results
Returns
Future<Map<Long, FeatureResult>> Future of Map<Long,FeatureResult>

public Map<Long, FeatureResult> executeRelationshipQuery (RelatedQueryParameters query)

Executes a related records query according to the parameters provided.

Parameters
query RelatedQueryParameters: the parameters for the related records query
Returns
Map<Long, FeatureResult> the related record set
Throws
Exception any exception occurring during query execution