public class

ClosestFacilityTask

extends Object
java.lang.Object
   ↳ com.esri.core.tasks.na.ClosestFacilityTask

Class Overview

Class used to perform a 'solve closest facility' operation on a network layer resource of type closest facility. The layer resource is defined by its URL and can be a secure resource requiring user credentials for access.

To solve a closest facility problem, and thus find the closest facility to an incident or set of incidents, an instance of ClosestFacilityParameters must first be obtained via getDefaultParameters(), then populated with any desired parameters. These parameters are then passed to the ClosestFacilityTask instance and the task can be solved synchronously using (solve(ClosestFacilityParameters).

This operation, if successful, generates a ClosestFacilityResult from which the relevant information (in particular the result routes) can be obtained.

Summary

Public Constructors
ClosestFacilityTask(String url)
Instantiates a new closest facility task from a service URL.
ClosestFacilityTask(String url, UserCredentials credentials)
Instantiates a new secure closest facility task from a service URL and user credentials for the service.
Public Methods
ClosestFacilityParameters getDefaultParameters()
Retrieves the default parameters as defined by the service layer.
Future<ClosestFacilityResult> solve(ClosestFacilityParameters cfp, CallbackListener<ClosestFacilityResult> callback)
Solve a closest facility problem asynchronously passing in a ClosestFacilityParameters} object.
ClosestFacilityResult solve(ClosestFacilityParameters cfp)
Executes the ClosestFacilityParameters defined for this ClosestFacilityTask and returns a ClosestFacilityResult containing the results.
Protected Methods
void finalize()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ClosestFacilityTask (String url)

Instantiates a new closest facility task from a service URL.

Parameters
url String: the URL

public ClosestFacilityTask (String url, UserCredentials credentials)

Instantiates a new secure closest facility task from a service URL and user credentials for the service.

Parameters
url String: the URL
credentials UserCredentials: the user credentials

Public Methods

public ClosestFacilityParameters getDefaultParameters ()

Retrieves the default parameters as defined by the service layer.

Returns
ClosestFacilityParameters ClosestFacilityParameters the server-default parameters
Throws
Exception any exception during parameter retrieval

public Future<ClosestFacilityResult> solve (ClosestFacilityParameters cfp, CallbackListener<ClosestFacilityResult> callback)

Solve a closest facility problem asynchronously passing in a ClosestFacilityParameters object. If the solve has not already started execution, it can be cancelled using the cancel method on the Future returned.

Parameters
cfp ClosestFacilityParameters: The ClosestFacilityParameters object that contains the settings for the solve and the inputs
callback CallbackListener: A callback that will be used when the solve completes. Override onCallback(Object) to handle a successful solve and onError(Throwable) to handle a solve that fails.
Returns
Future<ClosestFacilityResult> A Future object that can be used to poll for or cancel the solve operation.

public ClosestFacilityResult solve (ClosestFacilityParameters cfp)

Executes the ClosestFacilityParameters defined for this ClosestFacilityTask and returns a ClosestFacilityResult containing the results.

Parameters
cfp ClosestFacilityParameters: the parameters
Returns
ClosestFacilityResult the ClosestFacilityResult containing the results
Throws
Exception any exception during execution

Protected Methods

protected void finalize ()

Throws
Throwable