Packagecom.esri.bacore.client
Classpublic final class BATaskUtils
InheritanceBATaskUtils Inheritance Object

The BATaskUtils class provides a collection of static utility methods useful in task parameters classes when working with converting parameters to URL variables.



Public Methods
 MethodDefined By
  
ensureArrayOfUniqueStrings(obj:Object, name:String, values:Object):Boolean
[static] Ensures that an array contains unique string values that were not appear before.
BATaskUtils
  
ensureFeatureClassOnly(variables:URLVariables):void
[static] Ensures that the OutputType variable contains the GetFeatureClass option only.
BATaskUtils
  
ensureMutuallyExclusive(obj:Object, ... names):int
[static] Ensures that not more than one property from the input list has a nonempty value.
BATaskUtils
  
ensureReportOnly(variables:URLVariables):void
[static] Ensures that the OutputType variable contains the GetReport option only.
BATaskUtils
  
ensureReportOutput(variables:URLVariables):void
[static]
BATaskUtils
  
ensureSpecifiedIntParameter(obj:Object, name:String, missing:int = -1):void
[static] Ensures that the given property value is a valid integer.
BATaskUtils
  
ensureSpecifiedNumericParameter(obj:Object, name:String):void
[static] Ensures that the given property value is a valid number.
BATaskUtils
  
ensureSpecifiedParameter(obj:Object, name:String):void
[static] Ensures that the given property value is specified.
BATaskUtils
  
isFeatureOutput(variables:URLVariables):Boolean
[static] Tests the OutputType variable to contain GetFeatureClass option.
BATaskUtils
  
isMapImageOutput(variables:URLVariables):Boolean
[static] Tests the OutputType variable to contain GetMapImage option.
BATaskUtils
  
isReportOutput(variables:URLVariables):Boolean
[static] Tests the OutputType variable to contain GetReport option.
BATaskUtils
  
throwWrongItemError(isWrong:Boolean, name:String):void
[static] Throws an error if an item of the given array parameter is wrong.
BATaskUtils
  
validateArray(obj:Object, name:String, validate:Function = null):void
[static] Validates items of an array.
BATaskUtils
  
validateArrayOfNumber(obj:Object, name:String, isPositive:Boolean = true):void
[static] Validates that an array contains positive numbers.
BATaskUtils
  
validateArrayOfString(obj:Object, name:String, emptyIsAllowed:Boolean = false):void
[static] Validates that an array contains string values.
BATaskUtils
Method Detail
ensureArrayOfUniqueStrings()method
public static function ensureArrayOfUniqueStrings(obj:Object, name:String, values:Object):Boolean

Ensures that an array contains unique string values that were not appear before.

Parameters

obj:Object — An object to be tested.
 
name:String — A name of property containing tested array (its value can be null).
 
values:Object — A object to collect unique values in.

Returns
Boolean — true If the state of values array was changed (a value was added).

Throws
BARequestError — The array contains empty or duplicated values.
ensureFeatureClassOnly()method 
public static function ensureFeatureClassOnly(variables:URLVariables):void

Ensures that the OutputType variable contains the GetFeatureClass option only. This method does nothing, if the OutputType variable is missing or its value is empty.

Parameters

variables:URLVariables — URL variables.


Throws
BARequestError — OutputType variable contains other options.
ensureMutuallyExclusive()method 
public static function ensureMutuallyExclusive(obj:Object, ... names):int

Ensures that not more than one property from the input list has a nonempty value. The method especially tests String and Array type properties to have nonzero length.

Parameters

obj:Object — An object to be tested.
 
... names — Names of properties to be tested.

Returns
int — Zero-based index of property that is specified or -1 if all properties are null or empty.

Throws
BARequestError — More than one property is specified.
ensureReportOnly()method 
public static function ensureReportOnly(variables:URLVariables):void

Ensures that the OutputType variable contains the GetReport option only. This method does nothing, if the OutputType variable is missing or its value is empty.

Parameters

variables:URLVariables — URL variables.


Throws
BARequestError — OutputType variable contains other options.
ensureReportOutput()method 
public static function ensureReportOutput(variables:URLVariables):void

Parameters

variables:URLVariables

ensureSpecifiedIntParameter()method 
public static function ensureSpecifiedIntParameter(obj:Object, name:String, missing:int = -1):void

Ensures that the given property value is a valid integer.

Parameters

obj:Object — An object to be tested.
 
name:String — Property name.
 
missing:int (default = -1) — A value indicating the missing integer.


Throws
BARequestError — The property value is equal to missing value.
ensureSpecifiedNumericParameter()method 
public static function ensureSpecifiedNumericParameter(obj:Object, name:String):void

Ensures that the given property value is a valid number.

Parameters

obj:Object — An object to be tested.
 
name:String — Property name.


Throws
BARequestError — The property value is NaN.
ensureSpecifiedParameter()method 
public static function ensureSpecifiedParameter(obj:Object, name:String):void

Ensures that the given property value is specified.

Parameters

obj:Object — An object to be tested.
 
name:String — Property name.


Throws
BARequestError — The property value is NaN.
isFeatureOutput()method 
public static function isFeatureOutput(variables:URLVariables):Boolean

Tests the OutputType variable to contain GetFeatureClass option.

Parameters

variables:URLVariables — URL variables.

Returns
Boolean — True if this variable is specified and contains GetFeatureClass option.
isMapImageOutput()method 
public static function isMapImageOutput(variables:URLVariables):Boolean

Tests the OutputType variable to contain GetMapImage option.

Parameters

variables:URLVariables — URL variables.

Returns
Boolean — True if this variable is specified and contains GetMapImage option.
isReportOutput()method 
public static function isReportOutput(variables:URLVariables):Boolean

Tests the OutputType variable to contain GetReport option.

Parameters

variables:URLVariables — URL variables.

Returns
Boolean — True if this variable is specified and contains GetReport option.
throwWrongItemError()method 
public static function throwWrongItemError(isWrong:Boolean, name:String):void

Throws an error if an item of the given array parameter is wrong.

Parameters

isWrong:Boolean — True value means that tested item is wrong.
 
name:String — A name of property containing array whose items are tested.


Throws
BARequestError — The array contains wrong items.
validateArray()method 
public static function validateArray(obj:Object, name:String, validate:Function = null):void

Validates items of an array.

The validate function should have the following signature:

validate(item: name:String):void;

The item is an item of array to be validated and the name is a name property containing the tested array. If validation fails, this fuction should throw an error of the BARequestError type.

If the validate function is missing, the default validator is used. It tests that an item is specified (uses the CoreUtils.isSpecified method).

Parameters

obj:Object — An object to be tested.
 
name:String — A name of property containing the tested array.
 
validate:Function (default = null) — Validator function.


Throws
BARequestError — The array contains wrong items.
validateArrayOfNumber()method 
public static function validateArrayOfNumber(obj:Object, name:String, isPositive:Boolean = true):void

Validates that an array contains positive numbers.

Parameters

obj:Object — An object to be tested.
 
name:String — A name of property containing tested array (its value can be null).
 
isPositive:Boolean (default = true) — If true, the test on positiveness is applied.


Throws
BARequestError — The array contains nonpositive or nonnumeric values.
validateArrayOfString()method 
public static function validateArrayOfString(obj:Object, name:String, emptyIsAllowed:Boolean = false):void

Validates that an array contains string values.

Parameters

obj:Object — An object to be tested.
 
name:String — A name of property containing tested array (its value can be null).
 
emptyIsAllowed:Boolean (default = false) — If true, empty string values are allowed in the array.


Throws
BARequestError — The array contains wrong items.