Packagecom.vmware.data.query.events
Classpublic class DataByConstraintRequest
InheritanceDataByConstraintRequest Inheritance DataRequest Inheritance Request Inheritance flash.events.Event

Requests data by a given data model for server objects satisfying the given constraint. The result is an ArrayCollection of instances of the provided model class.

View the examples



Public Properties
 PropertyDefined By
  constraint : Constraint
Constraint to use to match returned server objects.
DataByConstraintRequest
 Inheritedcontext : Object
Optional context that might be required to handle the response.
Request
  maxResultCount : Number = -1
The maximum number of results to retrieve.
DataByConstraintRequest
  model : Class
Data model class defining properties to retrieve.
DataByConstraintRequest
  offset : Number = 0
The offset into the result set, 1-based.
DataByConstraintRequest
  order : OrderingCriteria
The criteria specifying how the results should be ordered.
DataByConstraintRequest
  parameters : Object
Parameters to pass to Data Service when retrieving certain properties.
DataByConstraintRequest
 InheritedrequestId : String
DataRequest
 InheritedrequestInfo : DataRequestInfo
Getting the data request options
DataRequest
Public Methods
 MethodDefined By
  
Constructor.
DataByConstraintRequest
  
addPropertyParameter(property:String, parameter:Object):void
Adds a parameter to be passed to Data Service when retrieving a property defined in the model.
DataByConstraintRequest
 Inherited
clone():Event
[override] Creates a clone of this event.
Request
  
newInstance(constraint:Constraint, model:Class, requestInfo:DataRequestInfo = null):DataByConstraintRequest
[static] Returns a new instance.
DataByConstraintRequest
Public Constants
 ConstantDefined By
  REQUEST_ID : String = dataByConstraintRequest
[static]
DataByConstraintRequest
  RESPONSE_ID : String = dataByConstraintResponse
[static]
DataByConstraintRequest
Property Detail
constraintproperty
public var constraint:Constraint

Constraint to use to match returned server objects.

maxResultCountproperty 
public var maxResultCount:Number = -1

The maximum number of results to retrieve.

modelproperty 
public var model:Class

Data model class defining properties to retrieve.

offsetproperty 
public var offset:Number = 0

The offset into the result set, 1-based.

orderproperty 
public var order:OrderingCriteria

The criteria specifying how the results should be ordered.

parametersproperty 
public var parameters:Object

Parameters to pass to Data Service when retrieving certain properties.

Contains property-parameter values, where the property is in form of relationship.relationship.property, and the parameter is any Object.

See also

addPropertyParameter
Constructor Detail
DataByConstraintRequest()Constructor
public function DataByConstraintRequest(type:String)

Constructor.

Parameters
type:String (default = NaN)
Method Detail
addPropertyParameter()method
public function addPropertyParameter(property:String, parameter:Object):void

Adds a parameter to be passed to Data Service when retrieving a property defined in the model.

The parameter can be retrieved on the Java side in the PropertySpec associated with the query.

Parameters

property:String — The property name as defined in the model.
 
parameter:Object — The parameter value to passed, it can be any Object but only one parameter per property is allowed.

newInstance()method 
public static function newInstance(constraint:Constraint, model:Class, requestInfo:DataRequestInfo = null):DataByConstraintRequest

Returns a new instance.

Parameters

constraint:Constraint — Constraint to use to match returned server objects.
 
model:Class — Data model class defining properties to retrieve.
 
requestInfo:DataRequestInfo (default = null) — The data request options

Returns
DataByConstraintRequest
Constant Detail
REQUEST_IDConstant
public static const REQUEST_ID:String = dataByConstraintRequest

RESPONSE_IDConstant 
public static const RESPONSE_ID:String = dataByConstraintResponse

Examples
The following example shows how to use this request:
 [Event(name="dataByConstraintRequest", type=...)]
 public class SomeDataViewMediator extends EventDispatcher {
    private function onDataRequestFromView(event:Event):void {
       var constraint:Constraint =
             QuerySpecUtil.createConstraintForRelationship(hostRef, "vm");
       var request:DataByConstraintRequest=
             new DataByConstraintRequest.newInstance(
                   constraint,
                   model);
       dispatchEvent(request);
    }
 
    // Option 1 - use EventHandler for the response
    [EventHandler(name="dataByConstraintResponse")]
    private function onDataRetrieved(response:MultiObjectDataResponse):void {
       // response.result contains VmListItemData objects
       _view.vmList.dataProvider = response.result;
    }
 
    // Option 2 - use ResponseHandler for the response
    [ResponseHandler(name="dataByConstraintResponse")]
    public function onDataRetrieved(request:DataByConstraintRequest,
                                     result:ArrayCollection,
                                     error:Error):void {
       // result contains VmListItemData objects
       _view.vmList.dataProvider = result;
    }
 }