| Package | mx.data.mxml |
| Class | public class DataService |
| Inheritance | DataService DataService Object |
| Implements | IMXMLObject |
Note: The destination property must be set
before using a DataService object.
Hide MXML SyntaxThe <mx:DataService> tag accepts the following tag attributes:
<mx:DataService Properties autoCommit="true" autoMerge="true" autoSaveCache="false" autoSyncEnabled="true" conflictDetector="No default." dataStore="No default." destination="No default." pageSize="No default." id="No default." Events conflict="No default." fault="No default." message="No default." propertyChange="No default." result="No default." />
See also
| Property | Defined By | ||
|---|---|---|---|
| autoCommit : Boolean
Indicates if changes to the local cache are automatically committed. | DataService | ||
| autoConnect : Boolean
Indicates if this service should attempt to connect for any operations
that require a connection. | DataService | ||
| autoMerge : Boolean
If set to false, when changes are pushed from the remote
destination to the client they are not immediately applied. | DataService | ||
| autoSaveCache : Boolean
The local cache of data and changes can be stored to disk. | DataService | ||
![]() | autoSyncEnabled : Boolean
When true, fill(), createItem() and
getItem() requests return items which listen for updates
made to these items from the remote destination. | DataService | |
| cacheID : String
Provides access to the cache identifier for this service. | DataService | ||
![]() | channelSet : ChannelSet
Provides access to the ChannelSet used by the service. | DataService | |
| commitRequired : Boolean [read-only]
Indicates if there are changes that have not been committed and
the commit() method should be called. | DataService | ||
| conflictDetector : ConflictDetector
Provides access to the current implementation being used to
detect conflicts for remote operations pushed to this
DataService. | DataService | ||
| conflicts : Conflicts [read-only]
Returns the Conflicts object, an ArrayList of
Conflict instances. | DataService | ||
![]() | connected : Boolean [read-only]
Indicates if the DataService is connected to the remote destination. | DataService | |
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | |
| dataStore : DataStore
Returns an object of type mx.data.DataStore. | DataService | ||
![]() | deleteItemOnRemoveFromFill : Boolean
By default when you call the removeItemAt() method on a managed filled collection, it
issues a delete item call to the server to physically remove the item. | DataService | |
| destination : String
Indicates which remote destination this service is associated with. | DataService | ||
![]() | hierarchicalEventsDefault : Boolean
Associations optionally list for property change events on properties of
the associated instances. | DataService | |
| indexReferences : Boolean
To tune the speed of your application, set this to false if you have a small number of
fills or references to items managed by this data service from association properties
of other items. | DataService | ||
![]() | isInitialized : Boolean [read-only]
Indicates if the metadata associated with this service is initialized. | DataService | |
![]() | manualSync : ManualSyncConfiguration
The manualSync property provides access to the ManualSyncConfiguration
instance for each data service. | DataService | |
| mergeRequired : Boolean [read-only]
Indicates if there are any pending changes that must be
merged. | DataService | ||
| pageSize : int
Provides access to the current page size setting for all collections. | DataService | ||
| pagingEnabled : Boolean [read-only]
Indicates if the remote destination is configured to allow paged
requests. | DataService | ||
![]() | prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | |
| requestTimeout : int
Provides access to the request timeout in seconds for an operation. | DataService | ||
![]() | resubscribeAttempts : int
Controls the number of times a disconnected data service will attempt to
resubscribe. | DataService | |
![]() | resubscribeInterval : int
Controls the delay between resubscribe attempts. | DataService | |
![]() | subscribed : Boolean [read-only] | DataService | |
![]() | throwItemPendingErrors : Boolean
Set this to false if you want to suppress the throwing of item pending
errors when lazily fetched or unpaged data is accessed. | DataService | |
| Method | Defined By | ||
|---|---|---|---|
DataService(dest:String = null)
Constructs an instance of the DataService with the specified
destination. | DataService | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | DataService | ||
Clears any data stored to disk with a previous call to
saveCache() or when autoSaveCache was set to
true
| DataService | ||
Clears the data specified by the passed descriptor from the local store. | DataService | ||
Commits pending changes for all collections currently managed by
the DataStore associated with this data service. | DataService | ||
Forces a connection attempt by this service to the remote destination. | DataService | ||
Calls a count method on the remote destination. | DataService | ||
Requests that the specified item be created in the remote store. | DataService | ||
Requests that the specified item be deleted from the remote store. | DataService | ||
Disconnects the DataService's network connection. | DataService | ||
Fills the specified ListCollectionView based
on the associated <fill-method> elements. | DataService | ||
Returns an ArrayCollection or a single managed object (SMO) from the
the local store. | DataService | ||
This method will fill the specified ListCollectionView with
CacheDataDescriptor(s). | DataService | ||
This method will fill the specified ListCollectionView
with all cache identifiers previously used in the application. | DataService | ||
Makes an asynchronous request for an item matching the
specified identity. | DataService | ||
![]() |
Looks up the supplied item with the given identity. | DataService | |
Returns the pending operation in the message cache for the specified
item. | DataService | ||
![]() |
Indicates whether an object has a specified property defined. | Object | |
![]() |
Forces initialization of the DataStore. | DataService | |
![]() |
Returns true if the passed collection is managed by this service. | DataService | |
![]() |
Returns true if the passed collection is using paging features. | DataService | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
Returns true if the supplied range of items is all paged in. | DataService | |
Logs the user out of the destination for the DataService. | DataService | ||
Merges any pending updates into the managed set of objects. | DataService | ||
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
Refreshes all data managed by this data service. | DataService | |
![]() |
Refreshes an array collection previously filled with the fill method or managed as
a managed association. | DataService | |
Releases all managed collections and items for the DataService. | DataService | ||
releaseCollection(view:ListCollectionView, clear:Boolean = false, copyStillManagedItems:Boolean = true):void
Releases any item within the specified collection from management by
this service. | DataService | ||
releaseItem(item:IManaged, copyStillManagedItems:Boolean = true, enableStillManagedCheck:Boolean = true):IManaged
Releases the specified item from management by this service. | DataService | ||
![]() |
Releases a range of items in the collection. | DataService | |
Reverts any uncommitted changes to the specified item. | DataService | ||
This method will save the current state of the DataService cache. | DataService | ||
Sets the credentials for this DataService destination. | DataService | ||
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
Sets the credentials for the third party of this DataService destination. | DataService | ||
![]() |
Returns the string representation of the specified object. | Object | |
![]() |
Returns the primitive value of the specified object. | Object | |
| autoCommit | property |
autoCommit:Boolean [read-write] Indicates if changes to the local cache are automatically committed. Committed changes are sent to the remote service immediately.
The default value is true.
public function get autoCommit():Boolean public function set autoCommit(value:Boolean):void| autoConnect | property |
autoConnect:Boolean [read-write]
Indicates if this service should attempt to connect for any operations
that require a connection.
Operations like fill(), getItem() and count() will attempt to connect
if the service is disconnected and autoConnect is set
to true.
Use this property to control occasionally connected application behavior.
The default value is true.
public function get autoConnect():Boolean public function set autoConnect(value:Boolean):void| autoMerge | property |
autoMerge:Boolean [read-write]
If set to false, when changes are pushed from the remote
destination to the client they are not immediately applied.
Instead, the mergeRequired property is set to true.
An event handler can be registered to listen for change events on this
property to be notified of when a merge needs to be applied.
To merge changes, call the merge() method and all
changes are applied.
Uncommited changes can not be committed when there are any changes that
need to be merged.
If paging is enabled all requests for non local items are cached
until merge() is called.
Once merge() is called, the cached requests are
processed.
The default value is true.
public function get autoMerge():Boolean public function set autoMerge(value:Boolean):void| autoSaveCache | property |
autoSaveCache:Boolean [read-write]
The local cache of data and changes can be stored to disk.
When autoSaveCache is true each time a change
is made or a remote request is returned, that data will be saved to disk.
If there is a problem saving the data either because the disk is full
or write permissions have been denied a FaultEvent will be
dispatched or a Fault will be thrown.
Setting this value to false (the default) will not save any
data or changes to disk.
To force the current data and changes to be saved to disk use the
saveCache method.
The default value is false.
public function get autoSaveCache():Boolean public function set autoSaveCache(value:Boolean):void| cacheID | property |
cacheID:String [read-write]
Provides access to the cache identifier for this service.
A cache identifier must be set prior to performing any operations that
require interaction with data stored locally on disk.
If a cache identifier is not set, all cache methods and properties are
considered inconsistent and a DataServiceError is
thrown during any operation that requires data from the local disk.
This property provides a unique "session" identifier for data stored
locally.
A developer must set this property to a unique value for the
application.
A value of null or empty string is considered unset.
Requests for data by methods like fill() and
getItem() will attempt to access the local data on disk
first if the cacheID has been set.
If the cacheID is not set, no attempt to access any
local data will be made.
public function get cacheID():String public function set cacheID(value:String):void| commitRequired | property |
commitRequired:Boolean [read-only]
Indicates if there are changes that have not been committed and
the commit() method should be called.
When this property changes, an event is dispatched.
This property can be used within an application to provide visual
feedback.
This property can be used as the source for data binding.
public function get commitRequired():Boolean| conflictDetector | property |
conflictDetector:ConflictDetector [read-write] Provides access to the current implementation being used to detect conflicts for remote operations pushed to this DataService.
public function get conflictDetector():ConflictDetector public function set conflictDetector(value:ConflictDetector):void| conflicts | property |
conflicts:Conflicts [read-only]
Returns the Conflicts object, an ArrayList of
Conflict instances.
Conflicts must be resolved before commit() can be called.
Conflicts can be resolved by going through the conflicts, resolving each
conflict individually or by calling the acceptAllClient()
method or acceptAllServer() method on this property.
public function get conflicts():Conflicts| dataStore | property |
dataStore:DataStore [read-write] Returns an object of type mx.data.DataStore. The DataStore manages the set of incoming and outgoing changes for one or more DataServices, which may have references between them. When you commit on a DataStore, all of the pending changes of each DataService using that DataStore are committed. By default, a DataService shares the same DataStore with other DataServices if they have managed association properties and share the same set of channels. If you are sharing DataStores, a commit call on one DataService commits changes for all DataServices using that data store. This preserves the order of operations in case there are dependencies between the changes in your uncommitted batches.
This property can be used as the source for data binding.
public function get dataStore():DataStore public function set dataStore(value:DataStore):void| destination | property |
destination:String [read-write] Indicates which remote destination this service is associated with.
public function get destination():String public function set destination(value:String):void| document | property |
mx_internal var document:Object| id | property |
mx_internal var id:String| indexReferences | property |
indexReferences:Boolean [read-write] To tune the speed of your application, set this to false if you have a small number of fills or references to items managed by this data service from association properties of other items.
public function get indexReferences():Boolean public function set indexReferences(value:Boolean):void| mergeRequired | property |
mergeRequired:Boolean [read-only] Indicates if there are any pending changes that must be merged.
This property can be used as the source for data binding.
public function get mergeRequired():Boolean| pageSize | property |
pageSize:int [read-write] Provides access to the current page size setting for all collections.
public function get pageSize():int public function set pageSize(value:int):void| pagingEnabled | property |
pagingEnabled:Boolean [read-only] Indicates if the remote destination is configured to allow paged requests.
public function get pagingEnabled():Boolean| requestTimeout | property |
requestTimeout:int [read-write] Provides access to the request timeout in seconds for an operation. A value less than or equal to zero prevents request timeout. When a current operation times out due to the requestTimeout limit being reached a fault will be dispatched for that operation, indicating that the request was timed out. Note that when an operation times out, it is possible the server did in fact receive that operation. This can leave your client state out of sync with the server.
public function get requestTimeout():int public function set requestTimeout(value:int):void| DataService | () | Constructor |
public function DataService(dest:String = null)Constructs an instance of the DataService with the specified destination. The destination must be a reference to a destination configured in the services-config.xml file.
Parametersdest:String (default = null) — String that contains the name of the remote
destination this service will connect to.
|
| addEventListener | () | method |
override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidRegisters an event listener object with an EventDispatcher object so that the listener receives notification of an event. You can register event listeners on all nodes in the display list for a specific type of event, phase, and priority.
JavaScript code in the AIR runtime uses this method to register
event listeners for events defined by the AIR APIs. For other JavaScript events (such as the onload
event of the DOM body object), you can use standard event handling techniques, as you would
for content running in the browser.
After you successfully register an event listener, you cannot change its priority
through additional calls to addEventListener(). To change a listener's
priority, you must first call removeListener(). Then you can register the
listener again with the new priority level.
Keep in mind that after the listener is registered, subsequent calls to
addEventListener() with a different type or
useCapture value result in the creation of a separate listener registration.
For example, if you first register a listener with useCapture set to
true, it listens only during the capture phase. If you call
addEventListener() again using the same listener object, but with
useCapture set to false, you have two separate listeners: one
that listens during the capture phase and another that listens during the target and
bubbling phases.
You cannot register an event listener for only the target phase or the bubbling phase. Those phases are coupled during registration because bubbling applies only to the ancestors of the target node.
If you no longer need an event listener, remove it by calling
removeEventListener(), or memory problems could result. Objects with
registered event listeners are not automatically removed from memory because the garbage
collector does not remove objects that still have references.
Copying an EventDispatcher instance does not copy the event listeners attached to it. (If your newly created node needs an event listener, you must attach the listener after creating the node.) However, if you move an EventDispatcher instance, the event listeners attached to it move along with it.
If the event listener is being registered on a node while an event is being processed on this node, the event listener is not triggered during the current phase but can be triggered during a later phase in the event flow, such as the bubbling phase.
If an event listener is removed from a node while an event is being processed on the node, it is still triggered by the current actions. After it is removed, the event listener is never invoked again (unless registered again for future processing).
Parameters
type:String — The type of event.
| |
listener:Function — The listener function that processes the event. This function must accept
an Event object as its only parameter and must return nothing, as this example shows:
.
function(evt:Event):void The function can have any name. | |
useCapture:Boolean (default = false) — This parameter applies to display objects in the
ActionScript 3.0 display list architecture, used by SWF content.
Determines whether the listener works in the capture phase or the
target and bubbling phases. If useCapture is set to true,
the listener processes the event only during the capture phase and not in the
target or bubbling phase. If useCapture is false, the
listener processes the event only during the target or bubbling phase. To listen for
the event in all three phases, call addEventListener twice, once with
useCapture set to true, then again with
useCapture set to false.
| |
priority:int (default = 0) — The priority level of the event listener. The priority is designated by
a signed 32-bit integer. The higher the number, the higher the priority. All listeners
with priority n are processed before listeners of priority n-1. If two
or more listeners share the same priority, they are processed in the order in which they
were added. The default priority is 0.
| |
useWeakReference:Boolean (default = false) — Determines whether the reference to the listener is strong or
weak. A strong reference (the default) prevents your listener from being garbage-collected.
A weak reference does not. Class-level member functions are not subject to garbage
collection, so you can set |
| clearCache | () | method |
override public function clearCache(value:Object = null):AsyncToken
Clears any data stored to disk with a previous call to
saveCache() or when autoSaveCache was set to
true
Parameters
value:Object (default = null) — Object reference to either a managed single object or
ArrayCollection.
|
AsyncToken — AsyncToken which can be used to respond to the success or
failure of the operation.
|
| clearCacheData | () | method |
override public function clearCacheData(descriptor:CacheDataDescriptor):AsyncTokenClears the data specified by the passed descriptor from the local store.
Parameters
descriptor:CacheDataDescriptor — descriptor reference to the descriptor for
the data that should be removed from the local cache
|
AsyncToken — ASyncToken reference to the token that can be used to determine
when the result or fault has occurred for this operation.
|
| commit | () | method |
override public function commit(itemsOrCollections:Array = null, cascadeCommit:Boolean = false):AsyncTokenCommits pending changes for all collections currently managed by the DataStore associated with this data service. Calling this method is equivalent to calling dataStore.commit().
When the autoCommit property is true, transactions
are not used and you do not need to call this method.
To use transactions, set the autoCommit property to
false and call this method directly to commit a batch of changes.
You typically just call "commit()" with no arguments which will commit all pending changes. You can supply optional arguments to commit a subset of the pending changes. You must resolve all outstanding conflicts before you can commit changes to any item in the DataStore.
If the assembler is configured to have use-transactions set to true, all changes are committed atomically. If any operation fails, none of the operations in the batch are applied. If use-transactions is set to false, the operations are each committed individually until a failure occurs at which point processing stops. Any changes that occur before the error are applied, any changes which occur after the error are not applied. When an error occurs when processing a batch, the changes are put back into the uncommitted queue. You need to call revertChanges if you want to remove the changes which caused the error.
By default, the commit method will commit all pending changes for all items which have been created, modified, and deleted for this DataStore. If you want to commit a subset of these changes, you can specify a combination of managed ArrayCollection instances and/or managed items which define the subset of changes you want included in the batch. For each array collection you specify, any changes made either to the membership or order of items in that that array collection or any changes to items in that array collection are committed. You can also specify a list of individual managed items so that only changes for those items are committed. If you specify any objects in the itemsOrCollections parameter which are not managed collections or items, a DataServiceError is thrown.
If you are using the itemsOrCollections parameter and your items have association properties which refer to other items, you can use the cascadeCommit parameter to control whether or not changes made to associated items are also included in batch. For example, if you specify a Group item in the items parameter, and the Group instance has a members property which refers to a list of Person instances when cascadeCommit is true changes to any Person instance will also be included in the set of changes committed. If cascadeCommit is false, only changes to the Group would be included. Use cascadeCommit=true to ensure that any dependent changes are included in the batch.
Parameters
itemsOrCollections:Array (default = null) — This is an optional parameter which defaults to null when
you want to commit all pending changes. If you want to commit a subset of the pending
changes use this argument to specify a list of managed ListCollectionView instances
and/or managed items. ListCollectionView objects are most typically ArrayCollections
you have provided to your fill method. The items appropriate for this method are
any managed version of the item. These are any items you retrieve from getItem, createItem
or using the getItemAt method from a managed collection. Only changes for the
items defined by any of the values in this array will be committed.
| |
cascadeCommit:Boolean (default = false) — if true, also commit changes made to any associated
items supplied in this list.
|
AsyncToken — AsyncToken that is returned in call property of
either the ResultEvent.RESULT or in the
FaultEvent.FAULT.
Custom data can be attached to this object and inspected later
during the event handling phase. If no changes have been made
to the relevant items, null is returned instead of an AsyncToken.
|
| connect | () | method |
override public function connect():AsyncToken
Forces a connection attempt by this service to the remote destination.
This method may be used in conjunction with the autoConnect
property and disconnect() method to control connection
status.
AsyncToken — AsyncToken reference to the token that will identify this
operation in a result or fault event dispatched from this service.
When calling connect() the token's result handler will
always be called and the result will be the current value of this
service's connected property.
|
| count | () | method |
override public function count(... args):AsyncToken
Calls a count method on the remote destination.
The count method called is based on the associated <count-method>
tags and the parameters passed.
For example, if the following
count("firstName", "Bob") call was made and
<count-method> tags exist or are referenced in the
services-config.xml under the associated destination:
<count-method>
<name>getCount</name>
<params>java.lang.String,java.lang.String</params>
<security-run-as name="freddie" password="nightmare" />
</count-method>
<count-method>
<name>getCount</name>
<security-constraint ref="sample-users" />
</count-method>
Parameters
... args — List of arguments that should be passed to the remote
destination.
|
AsyncToken — Object 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.
|
| createItem | () | method |
override public function createItem(item:Object):ItemReference
Requests that the specified item be created in the remote store.
If an error occurs a DataConflictEvent is dispatched.
Parameters
item:Object — that should be created in the remote store.
|
ItemReference — ItemReference (which extends AsyncToken). This reference is
returned in the token property of either the
ResultEvent.RESULT or in the FaultEvent.FAULT.
Custom data can be attached to this object and inspected later during
the event handling phase.
The result property of this object is bindable and can be
used to bind the item returned. This result object is set to null if
the item is removed from another client. If you hold on to ItemReference
objects in your application, you should call the
releaseItem() method in the ItemReference when
you are finished with this reference to the item.
If you do not hold onto the ItemReferences, you can use the
releaseItem() method on the DataService, which takes the
instance of the item itself to release.
When createItem() fails, it returns a fault. However, the
item is still pending. You must call release() to remove it.
|
| deleteItem | () | method |
override public function deleteItem(item:Object):AsyncToken
Requests that the specified item be deleted from the remote store.
If an error occurs a DataConflictEvent will be dispatched.
Parameters
item:Object — that should be deleted in the remote store.
|
AsyncToken — AsyncToken that will be returned in the token
property of either the ResultEvent.RESULT or in the
FaultEvent.FAULT.
Custom data can be attached to this object and inspected later during
the event handling phase.
|
| disconnect | () | method |
override public function disconnect():voidDisconnects the DataService's network connection. This method does not wait for outstanding network operations to complete.
| fill | () | method |
override public function fill(value:ListCollectionView, ... args):AsyncTokenFills the specified ListCollectionView based on the associated <fill-method> elements. For example, if the following <fill-method> elements exist or are referenced in the services-config.xml under the associated destination:
<fill-method>
<name>loadPersons</name>
<params>java.lang.String,java.lang.String</params>
<security-run-as name="freddie" password="nightmare" />
</fill-method>
<fill-method>
<name>loadPersons</name>
<security-constraint ref="sample-users" />
</fill-method>
Then calling fill(myCollection, ["firstName", "Bob"])
invokes the first <fill-method> with the run-as security setting
since it contains two parameters, matching the <params> tag types
and count.
Likewise, calling fill(myCollection) invokes the second
<fill-method> tag as it contains no <params> tag.
Any pending changes to items in this collection are tossed. Also note
that any data in the collection is cleared when you call fill. You
can call fill using a previously filled collection as well. In this case,
if the fill parameters are the same, the collection is cleared and the fill
method on the server is called again. If the fill parameters are different
the old collection is released and the new collection is filled.
Parameters
value:ListCollectionView — to the collection that should
be filled with the specified arguments.
| |
... args — rest:Array variable list of arguments that should be passed
to the remote
destination.
|
AsyncToken — AsyncToken You can use this token to register one or more callback
functions to receive result or fault events from this fill 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.
|
| getCacheData | () | method |
override public function getCacheData(descriptor:CacheDataDescriptor):AsyncTokenReturns an ArrayCollection or a single managed object (SMO) from the the local store. Calling this method will not update the last accessed time.
Parameters
descriptor:CacheDataDescriptor — CacheDataDescriptor for the desired cache data.
|
AsyncToken — AsyncToken reference to the token that can be used to determine
when the result or fault has occurred for this operation.
The result property of the AsyncToken or on the associated event will
contain a new instance of an unmanaged ArrayCollection or ItemReference
for each call.
|
| getCacheDescriptors | () | method |
override public function getCacheDescriptors(view:ListCollectionView, options:uint = 0, item:Object = null):AsyncToken
This method will fill the specified ListCollectionView with
CacheDataDescriptor(s).
If no argument is specified then all associated
CacheDataDescriptors
for cached data under this service will be returned.
Parameters
view:ListCollectionView — ListCollectionView reference to a collection that can be
filled with the desired descriptors.
| |
options:uint (default = 0) — uint must be one of the following constants:
| |
item:Object (default = null) — Object reference to a specific ItemReference,
managed item, or ListCollectionView, when specified this
parameter overrides the options argument.
|
AsyncToken — AsyncToken reference to the token that will identify this
operation in a result or fault event dispatched from this service.
|
| getCacheIDs | () | method |
override public function getCacheIDs(view:ListCollectionView):AsyncToken
This method will fill the specified ListCollectionView
with all cache identifiers previously used in the application.
Parameters
view:ListCollectionView — ListcollectionView reference to a collection that should be
filled with all cache identifiers previously used in the application.
|
AsyncToken — AsyncToken reference to the token that will identify this
operation in a result or fault event dispatched from this service.
|
| getItem | () | method |
override public function getItem(identity:Object, defaultValue:Object = null):ItemReference
Makes an asynchronous request for an item matching the
specified identity. If you provide a defaultValue, and the
item does not exist, the item is created instead using the information
in the defaultValue.
This method returns an ItemReference.
If you receive a valid instance from the getItem() method
call, you must call the releaseItem() method to release an
instance of the item.
If you hang onto the ItemReference, you should call the
releaseItem() method on the reference to be sure you
release the proper reference (in case your client has made more than one
getItem() method call for the same item).
If you do not hold onto the ItemReference, you can call the
releaseItem() method on the DataService with the item
itself.
Parameters
identity:Object — Object that contains the identity properties for the desired object.
| |
defaultValue:Object (default = null) — An instance of the type with the
default values that should be created if it doesn't exist.
|
ItemReference — ItemReference to the item you want to get. The ItemReference extends
AsyncToken so you can use it to receive notification of when the
item has been retrieved or when this call produces a fault.
The ItemReference is returned as the token property in
either the ResultEvent.RESULT or in the
FaultEvent.FAULT if you are listening for events on
the DataService object.
Custom data can be attached to this object and inspected later
during the event handling phase. You also can use data binding
to bind to the result property of the ItemReference.
This property is set to a valid value when the item is populated
from the remote destination and is bindable so you can simply
bind your user interface controls to the properties of the
ItemReference's result property.
If the item is removed from the server or another client, this
reference is set to null.
The ItemReference also has an invalid property
which is set to true if the are errors returning
the item or if the server returns null for an item.
|
| getPendingOperation | () | method |
override public function getPendingOperation(item:IManaged):uintReturns the pending operation in the message cache for the specified item. Use this method to provide visual feedback to a user of what type of change, if any, has been made to an item.
Parameters
item:IManaged — IManaged that should be tested against.
|
uint — uint that indicates what pending operation has been performed.
The following are valid operations for an item:
|
| logout | () | method |
override public function logout():voidLogs the user out of the destination for the DataService. Logging out of a destination applies to everything connected using the same ChannelSet as specified in the server configuration. For example, if you are connected over the my-rtmp channel and you log out using one of your DataService instances, anything that was connected over the same ChannelSet is logged out.
| merge | () | method |
override public function merge():voidMerges any pending updates into the managed set of objects. The process of merging changes detect conflicts and process any pending item requests. This merges all messages for any other DataService instances that share this same data store.
| release | () | method |
override public function release(clear:Boolean = true, copyStillManagedItems:Boolean = true):voidReleases all managed collections and items for the DataService.
Parameters
clear:Boolean (default = true) — clear Boolean indicating if the all items should be removed from
the list. In addition no copies will be made of any item.
| |
copyStillManagedItems:Boolean (default = true) — if after releasing this data service references from managed
associations from another data services might hold references to some of these managed
objects. In that case, some managed collections in this data service might still be actively managed.
If you pass true for this flag, these references are either removed (clear=true) or cloned (clear=flase).
If you pass in false for this flag, those active references are left alone. Using false is the fastest
way to clear the state of the system. Using true ensures you don't have any managed
state in references to collections or items you retrieved from this data service.
|
| releaseCollection | () | method |
override public function releaseCollection(view:ListCollectionView, clear:Boolean = false, copyStillManagedItems:Boolean = true):voidReleases any item within the specified collection from management by this service. If the item exists in more than one collection, a copy of the item is made. Any uncommitted changes made to an item that exists only in this collection are released, including deletes, creates and updates.
Parameters
view:ListCollectionView — ListCollectionView reference that should no longer receive
remote updates.
| |
clear:Boolean (default = false) — clear Boolean indicating if the all items should be removed from
the list. In addition no copies will be made of any item.
| |
copyStillManagedItems:Boolean (default = true) — copyStillManagedItems Boolean if there are other managed references to items in this collection, this
parameter controls whether copies of those items are made so that after this call you are guaranteed that
there are no longer any managed items in the collection. Specifying both clear and this option as false
will result in the fastest way to release managed references.
|
| releaseItem | () | method |
override public function releaseItem(item:IManaged, copyStillManagedItems:Boolean = true, enableStillManagedCheck:Boolean = true):IManaged
Releases the specified item from management by this service. If you hold
onto ItemReferences, you should call the releaseItem() method
on the ItemReference to be sure you release the proper reference in the
case where you might have made more than one getItem call which retrieves
the same item from different parts of your client application.
This call releases any associated resources, including nested properties.
The specified item no longer receives updates from the remote
destination.
In addition if there are any uncommited changes to this item and it does
not appear in any other collection these changes will also be released.
If the specified item exists in more than one collection then the
value handed back will be a copy of the original unless the allowCopy
parameter is set to false.
Parameters
item:IManaged — IManaged reference to the item to be released.
| |
copyStillManagedItems:Boolean (default = true) — Optional parameter that defaults to true.
If true, makes a
copy of the item if it is still referenced by another managed reference.
You can set this to false but it would mean that object might still
get updates from the server if it is still managed through other references.
| |
enableStillManagedCheck:Boolean (default = true) — copyStillManagedItems Boolean indicating if we should make copies of the items which are still
managed in the graph of objects. Passing a value of false will clear the reference to these items.
|
IManaged — the released item which will be a copy if copyStillManagedItems=false and the
item is managed by another reference.
|
| revertChanges | () | method |
override public function revertChanges(item:IManaged = null):BooleanReverts any uncommitted changes to the specified item. Or if no item is supplied, it will revert all uncommitted changes. If you revert a create operation, it removes the item. If you revert a delete, it adds the item back in. Reverting an update restores the original properties of the item that were in place before you started changing it. Calling this method is equivalent to calling dataStore.revertChanges().
One situation in which you would use this method is after a fault has occurred. In that case, any failed changes are put back into the uncommitted changes list. At that point you can either modify those changes to fix the problem or revert them using this method to keep those changes from being resubmitted again.
If an item is supplied and this item doesn't have any changes this method will return false. If no item is supplied and there are no changes this method returns false. Otherwise, it returns true.
Parameters
item:IManaged (default = null) — IManaged reference to revert changes for or null to
revert all changes.
|
Boolean — Boolean indicating if any changes were reverted.
|
| saveCache | () | method |
override public function saveCache(value:Object = null):AsyncTokenThis method will save the current state of the DataService cache. The cache includes in-memory items and changes made to those items that have not been sent to the remote destination.
Parameters
value:Object (default = null) — value Object reference to either a managed ListCollectionView or
object.
|
AsyncToken — AsyncToken which can be used for notification of when the
operation completes successfully or fails.
|
| setCredentials | () | method |
override public function setCredentials(username:String, password:String):voidSets the credentials for this DataService destination. The credentials are applied to all services connected over the same ChannelSet.
Parameters
username:String — username for the destination.
| |
password:String — The password for the destination
|
| setRemoteCredentials | () | method |
override public function setRemoteCredentials(username:String, password:String):voidSets the credentials for the third party of this DataService destination.
Parameters
username:String — The username for the destination.
| |
password:String — The password for the destination.
|
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/livecycle/8.2/programLC/common/langref/mx/data/mxml/DataService.html