See the diagrams below to gain a better understanding of the Business Analyst Server API for Flex.
Download the [PDF] of these diagrams for better printing and viewing.
The diagram below shows a logical grouping of classes and packages in the Esri Business Analyst Server API for Flex.
The diagram below explains the internal structure of a Business Analyst Server task class.
A concrete task contains an instance of the BAServerClient class responsible for executing a request to HTTP service and for processing the result returned in JSON format to the required data type from Business Analyst Server API for Flex. An optional token provider instance can be associated with the BAServerClient class instance to automatically update the user authentication token when the last one has expired.
The diagram below explains execution of a Business Analyst Server task.
This diagram shows the workflow in the case when a token provider is associated with the BAServerClient class instance and the authentication token is expired, wrong, or missing. As can be seen from the diagram, the token update operation is executed inside the BAServerClient class instance.
When a result is received, it goes through a number of steps for parsing and processing. In the first step, it can be converted to a Business Analyst Server API for Flex data type with a function registered to wait for the result type. After, it can be processed with the processResult method of the task parameters instance if this instance implements the IBAResultParser interface. Finally, the result is handled with the sender Business Analyst Server task class instance which usually updates its lastResult property with the new value.
After, an instance of the BATaskCompletedEvent class encapsulating the result is passed to an optional responder which was specified in the parameters of the execute method. The event is dispatched on the sender Business Analyst Server task class instance.
The diagram below explains how an instance of the TokenProvider class updates the authentication token.
The token update operation consists of two steps.
In the first step, the token provider executes an asynchronous request on the IAuthentication instance associated with it. It passes a userInfo object containing the Business Analyst Server token service URL. The IAuthentication instance returns a temporary userCredentials object containing updated URL and user credentials.
In the second step, the token provider executes an asynchronous request on an authentication task instance associated with it. It passes the user credentials to this task and returns the updated token to the responder of this operation in the response.