Package | com.esri.bacore.client |
Class | public class BATask |
Inheritance | BATask AbstractTask flash.events.EventDispatcher |
Implements | IBATask |
Subclasses | BAOnlineTask, BAServerTask |
A Community Analyst Task can be constructed in two ways — as a standalone task using its own instance of the BAClient class or as a task sharing BAClient with other tasks.
Public properties specified in this class are proxies to the properties of an underlying BAClient class. In other words, modification of a property value in an instance of BATask class leads to modification of the corresponding property value in an associated instance of the BAClient class and in all tasks sharing this BAClient instance.
See also
Property | Defined By | ||
---|---|---|---|
concurrency : String
Value that indicates how to handle multiple calls to the same task. | AbstractTask | ||
disableClientCaching : Boolean
If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from
being loaded from the browser's cache. | AbstractTask | ||
proxyURL : String
The URL to proxy the request through. | AbstractTask | ||
requestTimeout : Number
The request timeout in seconds. | AbstractTask | ||
showBusyCursor : Boolean
If true, a busy cursor is displayed while a service is executing. | AbstractTask | ||
token : String
Token for accessing a secure task. | AbstractTask | ||
tokenProvider : ITokenProvider
Provider responsible for updating the security token if the last one expires. | BATask | ||
url : String
URL of the task. | AbstractTask |
Method | Defined By | ||
---|---|---|---|
BATask()
Creates a new instance of the BATask class. | BATask |
Method | Defined By | ||
---|---|---|---|
resultHandler(asyncToken:AsyncToken):void
Processes the result of task execution. | BATask | ||
send(parameters:IBATaskParameters, responder:IResponder):AsyncToken
Sends a request to Community Analyst HTTP Service associated with this task. | BATask |
Event | Summary | Defined By | ||
---|---|---|---|---|
The fault event is dispatched when an asynchronous execution of a Community Analyst Task fails. | BATask | |||
The taskCompleted event is dispatched when an asynchronous execution of a Community Analyst Task successfully completes. | BATask |
tokenProvider | property |
tokenProvider:ITokenProvider
Provider responsible for updating the security token if the last one expires.
public function get tokenProvider():ITokenProvider
public function set tokenProvider(value:ITokenProvider):void
BATask | () | Constructor |
public function BATask()
Creates a new instance of the BATask class.
resultHandler | () | method |
protected function resultHandler(asyncToken:AsyncToken):void
Processes the result of task execution.
This function processes a value of the asyncToken.resultObject
property.
It additionally can use the asyncToken.taskName
property to get
the name of the completed Community Analyst Task and the asyncToken.resultType
to get a BAResultType instance identifying the type that must be received.
The input instance of the result object is either an object decoded from JSON
or an object already processed by a result processor registered for the given result type.
If the result type is BAResultType.SPECIAL
, the JSON-decoded object is received.
Otherwise, an object of the required result type is received as the value of
asyncToken.resultObject
property.
The result handler can do additional processing of the result, but we recommend
to do post-processing of the result by implementing the IBAResultProcessor
interface for the class of input parameters. In this case, parameters of
such a task can be executed with generic and batch tasks.
If the result handler modifies the result object, it should update it in the
asyncToken.resultObject
property instance in order to allow
the listeners of the BATaskCompletedEvent
event to get the last result
processed.
To get the result object from async token properties or to set the updated object
to async token properties, use the GPResultProcessors.getProcessedResult
and GPResultProcessors.setProcessedResult
methods, respectively.
This method is "abstract" (its base implementation throws an error). It should be overriden in subclasses.
Parameters
asyncToken:AsyncToken — Asynch token associated with the response.
|
See also
send | () | method |
protected function send(parameters:IBATaskParameters, responder:IResponder):AsyncToken
Sends a request to Community Analyst HTTP Service associated with this task.
The responder.fault
function is invoked with an instance
of the FaultEvent
type and the responder.result
function
is invoked with an instance of the BATaskCompletedEvent
type.
The resultHandler
function should be overriden in subclasses.
Parameters
parameters:IBATaskParameters — Community Analyst Task parameters.
| |
responder:IResponder — A responder processing events.
|
AsyncToken — Asynch token associated with the response.
|
See also
fault | Event |
mx.rpc.events.FaultEvent
mx.rpc.events.FaultEvent.FAULT
The fault event is dispatched when an asynchronous execution of a Community Analyst Task fails.
taskCompleted | Event |
com.esri.bacore.BATaskCompletedEvent
com.esri.bacore.BATaskCompletedEvent.COMPLETE
The taskCompleted event is dispatched when an asynchronous execution of a Community Analyst Task successfully completes.
The BATaskCompletedEvent.COMPLETE constant defines the value of thetype
property of the event object for a taskCompleted
event.
The properties of the event object have the following values:
Property | Value |
---|---|
babbles | false |
cancelable | false |
currentTarget | The Object that defines the event listener that handles the event. |
target | The BATask object that dispatched the event. This is an instance of a Community Analyst Task that was executed. |
taskName | Name of a Community Analyst Task that was executed. |
result | Task execution result object. |
messages | Optional array of TaskMessage objects received. |
The currentTarget
and target
properties are
specified after the event was dispatched. A responder object passed in parameters of
a Community Analyst Task execute
method receives the event before it is dispatched.