套件 | mx.data |
類別 | public class RPCDataServiceAdapter |
繼承 | RPCDataServiceAdapter DataServiceAdapter Object |
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
The trickiest thing about how this service works is that we want to take over the existing service's invocation so that user code is minimally impacted by the addition of data management. The service call works the same way, same events and tokens are fired only the result must be managed. To make this work, the RPCDataServiceAdapter associated a ManagedOperation with a regular RPC service operation. The operation's "operationManager" property is set and during initialization time and the end-user's call is redirected to a proxy method in this class (e.g. queryProxy). This generates the corresponding data management call and returns the managed token to the end user so they get the result of the managed operation.
order is: user calls service method calls service delegates to operationManager - ManagedOpertion.xxProxy methods calls managerOperation kicks off DMS op --> DataManager.xx calls DMS op calls adapter to do the op --> DataServiceAdapter.invoke calls: RPCDataServiceAdapter invokes the service operation and sets the "raw" lastResult returns: adapter's result comes back in and is converted to DMS Result Message - RPCDataServiceResult.xxResult returns: data manager processes result - updates managed object --> DataListRequestResponder/CommitResponder returns: service is updated to lastResult from the operation returns: user's result event is called
屬性 | 定義自 | ||
---|---|---|---|
asyncRequest : AsyncRequest [覆寫] [唯讀]
An abstract method which returns an AsyncRequest that is used to handle
all DataService operations. | RPCDataServiceAdapter | ||
connected : Boolean [唯讀]
Returns true when this service adapter is connected to its source. | DataServiceAdapter | ||
constructor : Object
類別物件的參照或是特定物件實體的建構函數。 | Object | ||
dataManagerRegistry : Object [靜態]
Static map from destination name to data manager for that destination. | RPCDataServiceAdapter | ||
dataStore : DataStore
Contains an object of type mx.data.DataStore. | DataServiceAdapter | ||
destination : String
Name of destination for this data service adapter. | RPCDataServiceAdapter | ||
serializeAssociations : Boolean [覆寫] [唯讀]
This controls whether or not DMS wraps the items into a serialization
descriptor which excludes the associations. | RPCDataServiceAdapter | ||
throwUnhandledFaults : Boolean [覆寫] [唯讀]
Returns false because this data manager does not throw an error
if there is a fault with no listeners on the data manager. | RPCDataServiceAdapter |
方法 | 定義自 | ||
---|---|---|---|
This method is called by the RPCDataServiceAdapter when it needs to perform the createItem operation. | RPCDataServiceAdapter | ||
This is called by the RPCDataServiceAdapter when the management layer wants to delete an item
from the server. | RPCDataServiceAdapter | ||
executeQuery(dataManager:RPCDataManager, queryName:String, includeSpecifier:PropertySpecifier, queryArgs:Array):mx.rpc:AsyncToken
Called when the adapter needs to execute a named query. | RPCDataServiceAdapter | ||
Returns an array of property names that conflict between the client's version of an item and
the server's version. | RPCDataServiceAdapter | ||
[覆寫]
Finds the data manager for a specified destination. | RPCDataServiceAdapter | ||
Looks up an associated data service adapter. | DataServiceAdapter | ||
getItem(dataManager:RPCDataManager, identity:Object, defaultValue:Object = null, includeSpecifier:PropertySpecifier = null):mx.rpc:AsyncToken
Called to retrieve an individual item by identity from the adapter. | RPCDataServiceAdapter | ||
getItems(dataManager:RPCDataManager, ids:Array, includeSpecifier:PropertySpecifier):mx.rpc:AsyncToken
Adapter method called when a list of items for a specific destination need to be fetched. | RPCDataServiceAdapter | ||
This gets called after we've finished processing a fault of a create, update, delete, or update collection
operation. | RPCDataServiceAdapter | ||
指出物件是否有已定義的指定屬性。 | Object | ||
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | ||
pageQuery(dataManager:RPCDataManager, queryName:String, queryArgs:Array, startIndex:int, numItems:int):mx.rpc:AsyncToken
Perform a query for a single page of a client side query. | RPCDataServiceAdapter | ||
Simulate an event from the server that corresponds to an item delete. | RPCDataServiceAdapter | ||
postItemUpdate(dataManager:RPCDataManager, item:Object, origItem:Object = null, changes:Array = null):void
Simulate an event from the server that corresponds to an item update or creation. | RPCDataServiceAdapter | ||
Low-level method used by the DataManager to processes a data message. | RPCDataServiceAdapter | ||
指出指定的屬性是否存在,以及是否可列舉。 | Object | ||
為迴圈作業設定動態屬性的可用性。 | Object | ||
This gets called when we get a fault that might be a conflict from the server. | RPCDataServiceAdapter | ||
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | ||
會傳回指定之物件的字串形式。 | Object | ||
updateCollection(dataManager:RPCDataManager, mq:ManagedQuery, ucmsg:UpdateCollectionMessage):mx.rpc:AsyncToken
This is called when a collection managed by a query (not an association) has items
added to the collection or removed from the collection. | RPCDataServiceAdapter | ||
updateItem(dataManager:RPCDataManager, item:Object, origItem:Object, changes:Array):mx.rpc:AsyncToken
This method is called by the RPCDataServiceAdapter to perform a specific updateItem operation. | RPCDataServiceAdapter | ||
會傳回指定之物件的基本值。 | Object |
方法 | 定義自 | ||
---|---|---|---|
This method gets called after a fault which might determine a conflict. | RPCDataServiceAdapter | ||
internalGetItem(dataManager:RPCDataManager, identity:Object, defaultValue:Object = null, includeSpecifier:PropertySpecifier = null):mx.rpc:AsyncToken
This method actually performs the getItem operation but the result handler will not be used to update
the managed result. | RPCDataServiceAdapter | ||
Fault responder for RPCDataService operations. | RPCDataServiceAdapter | ||
Success responder for RPCDataService operations. | RPCDataServiceAdapter |
asyncRequest | 屬性 |
asyncRequest:AsyncRequest
[唯讀] [覆寫] 語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
An abstract method which returns an AsyncRequest that is used to handle all DataService operations. By overriding the AsyncRequest.invoke method you can intercept managed requests. The AsyncRequest class also exposes the various methods for determining if the service is connected or disconnected.
實作
override public function get asyncRequest():AsyncRequest
dataManagerRegistry | 屬性 |
public static var dataManagerRegistry:Object
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Static map from destination name to data manager for that destination.
destination | 屬性 |
public var destination:String
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Name of destination for this data service adapter.
serializeAssociations | 屬性 |
serializeAssociations:Boolean
[唯讀] [覆寫] 語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
This controls whether or not DMS wraps the items into a serialization descriptor which excludes the associations. The MessagingDataServiceAdapter will use this approach for sending associations - not used in the RPCDataServiceAdapter.
實作
override public function get serializeAssociations():Boolean
throwUnhandledFaults | 屬性 |
throwUnhandledFaults:Boolean
[唯讀] [覆寫] 語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Returns false because this data manager does not throw an error if there is a fault with no listeners on the data manager. For RPC servies, those errors are proxied to listeners on the service and so throwing the error is not appropriate.
實作
override public function get throwUnhandledFaults():Boolean
checkForConflict | () | 方法 |
protected function checkForConflict(resultEvent:ResultEvent, token:mx.rpc:AsyncToken):void
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
This method gets called after a fault which might determine a conflict.
In the fault handler for that fault, issue a getItem()
call to retrieve the server's current
version of the item.
One reason you might want to override this method is if you need to take action after no conflict is detected.
參數
resultEvent:ResultEvent — The event object from the getItem() call.
| |
token:mx.rpc:AsyncToken — Contains a cause property which is the original DataMessage for the change.
This method can call Conflicts.raiseConflict() when there is a conflict, or it can
do nothing if it determines there is no conflict.
|
createItem | () | 方法 |
public function createItem(dataManager:RPCDataManager, item:Object):mx.rpc:AsyncToken
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
This method is called by the RPCDataServiceAdapter when it needs to perform the createItem operation. The default implementation is to invoke the managed operation registered for the createItem operation using the item as the first parameter. If you need to invoke more than one service or change the parameter signature for this operation, you can extend the RPCDataServiceAdapter and override this createItem method.
參數
dataManager:RPCDataManager — manager in control of the create operation to be invoked.
| |
item:Object — item to be created.
|
mx.rpc:AsyncToken — You can use this token to register one or more callback functions to receive result or
fault events from this create operation. This token is also returned in the call property of
the ResultEvent.RESULT or in the FaultEvent.FAULT .
Custom data can be attached to this object and inspected later during the event handling phase.
|
deleteItem | () | 方法 |
public function deleteItem(dataManager:RPCDataManager, item:Object):mx.rpc:AsyncToken
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
This is called by the RPCDataServiceAdapter when the management layer wants to delete an item from the server. The item to be deleted is provided as an argument. The default implementation of this method looks for a ManagedOperation of type="delete". That method is called with the item to be deleted, or the id of the item to be deleted if the parameters of the ManagedOperation is set to "id".
參數
dataManager:RPCDataManager — manager in control of the delete operation to be invoked.
| |
item:Object — item to be deleted.
|
mx.rpc:AsyncToken — You can use this token to register one or more callback functions to receive result or
fault events from this delete operation. This token is also returned in the call property of
the ResultEvent.RESULT or in the FaultEvent.FAULT .
Custom data can be attached to this object and inspected later during the event handling phase.
|
executeQuery | () | 方法 |
public function executeQuery(dataManager:RPCDataManager, queryName:String, includeSpecifier:PropertySpecifier, queryArgs:Array):mx.rpc:AsyncToken
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Called when the adapter needs to execute a named query. If paging is enabled, this will fetch the first page in the collection.
參數
dataManager:RPCDataManager — manager in control of the query operation to be invoked.
| |
queryName:String — query name
| |
includeSpecifier:PropertySpecifier — set of properties to be retrieved.
| |
queryArgs:Array — arguments to the query operation invocation.
|
mx.rpc:AsyncToken — You can use this token to register one or more callback functions to receive result or
fault events from this query operation. This token is also returned in the call property of
the ResultEvent.RESULT or in the FaultEvent.FAULT .
Custom data can be attached to this object and inspected later during the event handling phase.
|
getConflictingProperties | () | 方法 |
public function getConflictingProperties(dmgr:RPCDataManager, cause:DataMessage, serverObject:Object):Array
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Returns an array of property names that conflict between the client's version of an item and the server's version. Returns null if there are no conflicts.
參數
dmgr:RPCDataManager — associated data manager.
| |
cause:DataMessage — data message whose processing may have triggered a conflict.
| |
serverObject:Object — the server's version of the item.
|
Array — an array of property names that conflict between the client's version of an item and
the server's version. Returns null if there are no conflicts.
|
getDataManager | () | 方法 |
override public function getDataManager(destination:String):DataManager
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Finds the data manager for a specified destination.
參數
destination:String — The destination.
|
DataManager — The DataManager object for the destination.
|
getItem | () | 方法 |
public function getItem(dataManager:RPCDataManager, identity:Object, defaultValue:Object = null, includeSpecifier:PropertySpecifier = null):mx.rpc:AsyncToken
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Called to retrieve an individual item by identity from the adapter. The includeSpecifier parameter specifies the set of properties requested.
參數
dataManager:RPCDataManager — associated data manager.
| |
identity:Object — identity of the item to be retrieved.
| |
defaultValue:Object (default = null ) — [optional] An instance of the type with the
default values that should be created if it doesn't exist.
| |
includeSpecifier:PropertySpecifier (default = null ) — [optional] set of properties to be retrieved.
|
mx.rpc:AsyncToken — AsyncToken bind to the result property of the AsyncToken to retrieve the
result. Otherwise, you can listen for the result property change event, add one or more
responders to the token and add additional information as dynamic properties of the
token to keep track of the results of the operation.
|
getItems | () | 方法 |
public function getItems(dataManager:RPCDataManager, ids:Array, includeSpecifier:PropertySpecifier):mx.rpc:AsyncToken
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Adapter method called when a list of items for a specific destination need to be fetched. The PropertySpecifier indicates the minimum set of properties needed. The default implementation of this method is to call the getItem method repeatedly. If your server can perform this operation more efficiently it may improve some operations to implement this method.
參數
dataManager:RPCDataManager — associated data manager.
| |
ids:Array — array of identities for the items to be retrieved.
| |
includeSpecifier:PropertySpecifier — [optional] set of properties to be retrieved.
|
mx.rpc:AsyncToken — AsyncToken bind to the result property of the AsyncToken to retrieve the
result. Otherwise, you can listen for the result property change event, add one or more
responders to the token and add additional information as dynamic properties of the
token to keep track of the results of the operation.
|
handleFault | () | 方法 |
public function handleFault(errMsg:ErrorMessage, cause:DataMessage):void
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
This gets called after we've finished processing a fault of a create, update, delete, or update collection operation. It is an adapter's chance to customize logic associated with the error handling and check for conflicts. The default implementation implements the RPCDataManager conflictMode feature. When it gets a fault for an UPDATE or DELETE operation, it compares the current server version against the original version of the updated/deleted object. If the server version is different, we raise that as a conflict. This assumes that the faulting change has already been put back into the uncommitted batch of changes.
參數
errMsg:ErrorMessage — The description of the error.
| |
cause:DataMessage — The operation that caused the error.
|
internalGetItem | () | 方法 |
protected function internalGetItem(dataManager:RPCDataManager, identity:Object, defaultValue:Object = null, includeSpecifier:PropertySpecifier = null):mx.rpc:AsyncToken
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
This method actually performs the getItem operation but the result handler will not be used to update the managed result. This method is used by the default getItem implementation to invoke the operation. When conflict detection is enabled, after a fault is received for an update or delete operation, this method is called to retrieve the current server version of the object so we can see if the fault was an indication a conflict and to get the current server version so we can resolve that conflict.
參數
dataManager:RPCDataManager — associated data manager.
| |
identity:Object — identity of the item to be retrieved.
| |
defaultValue:Object (default = null ) — [optional] An instance of the type with the
default values that should be created if it doesn't exist.
| |
includeSpecifier:PropertySpecifier (default = null ) — [optional] set of properties to be retrieved.
|
mx.rpc:AsyncToken — AsyncToken bind to the result property of the AsyncToken to retrieve the
result. Otherwise, you can listen for the result property change event, add one or more
responders to the token and add additional information as dynamic properties of the
token to keep track of the results of the operation.
|
pageQuery | () | 方法 |
public function pageQuery(dataManager:RPCDataManager, queryName:String, queryArgs:Array, startIndex:int, numItems:int):mx.rpc:AsyncToken
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Perform a query for a single page of a client side query. This method is called when pagingEnabled is set on a ManagedQuery. The client code will invoke the query as normal with just the usual query parameters. The management layer will insert the startIndex and numItems parameters before it makes the call.
參數
dataManager:RPCDataManager — manager in control of the query operation to be invoked.
| |
queryName:String — query name.
| |
queryArgs:Array — arguments to the query operation invocation.
| |
startIndex:int — start index for the page to be retrieved.
| |
numItems:int — size of page.
|
mx.rpc:AsyncToken — You can use this token to register one or more callback functions to receive result or
fault events from this query operation. This token is also returned in the call property of
the ResultEvent.RESULT or in the FaultEvent.FAULT .
Custom data can be attached to this object and inspected later during the event handling phase.
|
postItemDeletion | () | 方法 |
public function postItemDeletion(dataManager:RPCDataManager, identity:Object):void
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3.1 |
執行階段版本: | Flash Player 9, AIR 1.5 |
Simulate an event from the server that corresponds to an item delete. This is useful to notify LCDS that something has been deleted on the server.
參數
dataManager:RPCDataManager — associated data manager.
| |
identity:Object — the identity of the deleted item.
|
postItemUpdate | () | 方法 |
public function postItemUpdate(dataManager:RPCDataManager, item:Object, origItem:Object = null, changes:Array = null):void
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3.1 |
執行階段版本: | Flash Player 9, AIR 1.5 |
Simulate an event from the server that corresponds to an item update or creation. This is useful to notify LCDS that something has changed on the server.
參數
dataManager:RPCDataManager — the associated data manager.
| |
item:Object — the updated item.
| |
origItem:Object (default = null ) — the original item.
| |
changes:Array (default = null ) — names of properties that are changed.
|
processDataMessage | () | 方法 |
public function processDataMessage(msg:IMessage, responder:IResponder):void
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Low-level method used by the DataManager to processes a data message. It converts the data message into calls to the adpater interface so typically you can override one of those operations.
參數
msg:IMessage — message to be processed.
| |
responder:IResponder — responder to be called back when the message processing completes.
|
rpcAdapterFault | () | 方法 |
protected function rpcAdapterFault(ev:FaultEvent, token:mx.rpc:AsyncToken):void
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Fault responder for RPCDataService operations. Handles faults by building appropriate error message and propagating it up the token's responder chain.
參數
ev:FaultEvent — fault event received from the server.
| |
token:mx.rpc:AsyncToken — token associated with the invocation.
|
sendResultEvent | () | 方法 |
protected function sendResultEvent(token:mx.rpc:AsyncToken, msg:IMessage):void
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
Success responder for RPCDataService operations. Wraps the received message in a message event and propagates it up the token's responder chain.
參數
token:mx.rpc:AsyncToken — token associated with the invocation.
| |
msg:IMessage — result message received from the server
|
startCheckForConflict | () | 方法 |
public function startCheckForConflict(dmgr:RPCDataManager, cause:DataMessage, errMsg:ErrorMessage = null):void
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
This gets called when we get a fault that might be a conflict from the server. We'll try to get the current values for the item which is in conflict and then compare them to the original item in the change we tried to apply. If there are differences, that is a conflict which we'll raise.
參數
dmgr:RPCDataManager — the data manager associated with this adapter's destination.
| |
cause:DataMessage — original data message that may have potentially caused a conflict.
| |
errMsg:ErrorMessage (default = null ) — the error message describing the fault associated with the conflict.
|
updateCollection | () | 方法 |
public function updateCollection(dataManager:RPCDataManager, mq:ManagedQuery, ucmsg:UpdateCollectionMessage):mx.rpc:AsyncToken
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
This is called when a collection managed by a query (not an association) has items added to the collection or removed from the collection. There is a single message with a list of individual changes. Often you do not need to override this method as those changes are not needed to persist changes made on the client.
If you are implementing associations such as a many-to-many relationship using queries, it may be helpful though to add/remove a row during these operations.
The RPCDataServiceAdapter implementation maps these to individual add and remove calls.
參數
dataManager:RPCDataManager — The data manager associated with this adapter's destination.
| |
mq:ManagedQuery — the managed query for which items have been added or removed.
| |
ucmsg:UpdateCollectionMessage — update collection message detailing the items that have been added or removed
|
mx.rpc:AsyncToken — AsyncToken reference to the token that will identify this
operation in a result or fault event dispatched from this service.
|
updateItem | () | 方法 |
public function updateItem(dataManager:RPCDataManager, item:Object, origItem:Object, changes:Array):mx.rpc:AsyncToken
語言版本: | ActionScript 3.0 |
產品版本: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
執行階段版本: | Flash Player 9, AIR 1.1 |
This method is called by the RPCDataServiceAdapter to perform a specific updateItem operation. It is given the new version of the item, the original version of that item before it was modified on this client and the list of properties which are changed. The default implementation looks for a ManagedOperation of type="update" and calls that. The managed operation should at least take the new version of the item as a parameter. If it additionally declares parameters with the special names "origItem" and "changes" those parameters will be provided as well to the remote service.
參數
dataManager:RPCDataManager — The data manager.
| |
item:Object — The new version of the item.
| |
origItem:Object — The original item.
| |
changes:Array — list of properties which to change.
|
mx.rpc:AsyncToken — AsyncToken reference to the token that will identify this
operation in a result or fault event dispatched from this service.
|
Tue Jun 12 2018, 03:47 PM Z