Packagemx.data
Classpublic class DataStore
InheritanceDataStore Inheritance EventDispatcher Inheritance Object

A DataStore batches transactions for one or more DataService instances. It manages the set of pending changes destined for the server and also stores the set of conflicts received from the server. By default, if your DataService does not have managed associations, it automatically gets its own independent DataStore. Each call to the commit() method send only changes made to that DataService.

When you use managed associations, the default changes so that all DataService instances that share the same set of channels and have the same value of the use-transactions flag share the same DataStore. When you are sharing a DataStore, a single call to the commit() method applies to all changes made by all DataService instances sharing that DataStore. The default changes because with managed associations, it is possible that changes between destinations can have dependencies so it is important to preserve the order of operations on the client when sending messages to the server.

If you want to change the default, you can create your own DataStore and manually assign it to the dataStore property of one or more DataService instances. Do this when you first initialize your DataService, before you have issued any other DataService api calls such as fill or getItem. Note: All DataServices which share the same DataStore must be using the same set of channels and the same setting for useTransactions flag. Settings that are not consistent will throw an error.



Public Properties
 PropertyDefined By
  autoCommit : Boolean
If set to true, operations that modify the state managed by the DataService are committed immediately.
DataStore
  autoConnect : Boolean
Indicates if this service should attempt to connect for any operations that require a connection.
DataStore
  autoMerge : Boolean
If set to false, when changes are pushed from the server to the client they are not immediately applied.
DataStore
  autoSaveCache : Boolean
The local cache of data and changes can be stored to disk.
DataStore
  cacheID : String
Provides access to the cache identifier for this service.
DataStore
  channelSet : ChannelSet
Provides access to the ChannelSet used by the this DataStore.
DataStore
  commitQueueMode : int
Controls when a committed batch of changes is sent to the server when you call commit on a second batch while the client is still waiting for a reply from a previously committed batch.
DataStore
  commitRequired : Boolean
[read-only] Indicates if there are pending updates that must be committed.
DataStore
  conflicts : Conflicts
[read-only] Returns a list of conflicts for all managed items.
DataStore
  connected : Boolean
[read-only] Indicates whether the DataStore is connected.
DataStore
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  destination : String
[read-only] The destination for this DataStore.
DataStore
  identifier : String
The identifier of this DataStore.
DataStore
  isInitialized : Boolean
[read-only] Indicates when this DataStore is initialized and ready for use.
DataStore
  mergeRequired : Boolean
[read-only] Indicates if there are any pending changes that must be merged.
DataStore
  processingServerChanges : Boolean = false
Indicates whether or not server changes are currently being processed.
DataStore
 Inheritedprototype : 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.
DataStore
Public Methods
 MethodDefined By
  
DataStore(destination:String, useTransactions:Boolean)
Normally, a DataStore is created automatically for you but you can create your own DataStore and assign it to the dataStore property of a DataService.
DataStore
 Inherited
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.
EventDispatcher
  
commit(itemsOrCollections:Array = null, cascadeCommit:Boolean = false):AsyncToken
Commits pending changes for collections and items managed by this DataStore.
DataStore
  
Forces a connection attempt by this service to the remote destination.
DataStore
 Inherited
Dispatches an event into the event flow.
EventDispatcher
  
This method will fill the specified ListCollectionView with all cache identifiers previously used in the application.
DataStore
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
Log the user out from the current destination.
DataStore
  
Merges any pending updates into the managed set of objects.
DataStore
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
Refetch all data managed on the client.
DataStore
  
release(clear:Boolean = true, copyStillManagedItems:Boolean = true):void
Release all data managed on the client.
DataStore
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
  
Reverts all pending (uncommitted) changes for all DataServices managed by this DataStore.
DataStore
  
setCredentials(username:String, password:String):void
Set the credentials for this DataStore destination.
DataStore
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
  
Set the credentials for the 3rd party of this DataStore destination.
DataStore
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 Event Summary Defined By
 InheritedDispatched when Flash Player or an AIR application gains operating system focus and becomes active.EventDispatcher
  Dispatched when a conflict is detected between either pending changes on this client and changes submitted by another client, or when changes submitted by this client result detect a conflict error at the remote destination.DataStore
 InheritedDispatched when Flash Player or an AIR application loses operating system focus and is becoming inactive.EventDispatcher
  The FaultEvent.FAULT event is dispatched when the commit call returns an error.DataStore
  The ResultEvent.RESULT event is dispatched when the commit call successfully returns.DataStore
Public Constants
 ConstantDefined By
  CQ_AUTO : int = 1
[static] Specifies to check for simple dependencies between any outstanding batches and the next batch to commit.
DataStore
  CQ_NOWAIT : int = 3
[static] Specifies to send the second batch immediately, not checking for dependencies.
DataStore
  CQ_ONE_AT_A_TIME : int = 0
[static] Specifies to wait for a previous batch to complete before committing a new batch.
DataStore
Property Detail
autoCommitproperty
autoCommit:Boolean  [read-write]

If set to true, operations that modify the state managed by the DataService are committed immediately. If set to false, you must explicitly call the commit() method to send the changes to the server.


Implementation
    public function get autoCommit():Boolean
    public function set autoCommit(value:Boolean):void
autoConnectproperty 
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.


Implementation
    public function get autoConnect():Boolean
    public function set autoConnect(value:Boolean):void
autoMergeproperty 
autoMerge:Boolean  [read-write]

If set to false, when changes are pushed from the server to the client they are not immediately applied. Instead, the mergeRequired property is set to true. You can listen for change events on this property to be notified of when a merge needs to be applied. To merge changes, you call the merge() method and all changes are applied. You are not able to commit any changes when there are any changes that must be merged.


Implementation
    public function get autoMerge():Boolean
    public function set autoMerge(value:Boolean):void
autoSaveCacheproperty 
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 locally use the saveCache method.


Implementation
    public function get autoSaveCache():Boolean
    public function set autoSaveCache(value:Boolean):void

See also

cacheIDproperty 
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 DataServiceError will be thrown during any operation that requires data from the local disk. This property is 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.


Implementation
    public function get cacheID():String
    public function set cacheID(value:String):void
channelSetproperty 
channelSet:ChannelSet  [read-write]

Provides access to the ChannelSet used by the this DataStore. The ChannelSet can be manually constructed and assigned, or it will be dynamically created to use the configured Channels for the destinations using this DataStore. The channelSet should be the same for all DataService objects using the same DataStore.


Implementation
    public function get channelSet():ChannelSet
    public function set channelSet(value:ChannelSet):void
clientIdproperty 
clientId:String  [read-only]


Implementation
    mx_internal function get clientId():String
commitQueueModeproperty 
commitQueueMode:int  [read-write]

Controls when a committed batch of changes is sent to the server when you call commit on a second batch while the client is still waiting for a reply from a previously committed batch. If the batch is immediately sent to the server, it can cause problems if changes in this batch are dependent upon changes made by the server when committing the previous batch. For example, you may be updating an item created by the server in the first batch. If the server assigned id has not yet been received by the client, the update will not include the proper id for that item. If the second batch always waits for the first batch to complete, it can increase the time it makes to perform a series of changes that are time dependent (e.g. if you are updating a cursor position over and over again).

The default mode is CQ_AUTO. This mode checks for simple dependencies between any outstanding batches and the next batch to commit. If it sees that there are none, it sends the new batch immediately. If it sees that it has an update or a delete which depend upon an outstanding create, it holds the update/delete until the create completes. This imposes some overhead on each commit to check for dependencies but is typically a good compromise between the other two modes, CQ_NOWAIT and CQ_ONE_AT_A_TIME.

CQ_NOWAIT will send the second batch immediately, not checking for dependencies. You might use this mode if you are assigning ids for new objects on the client and need to overlap batches to achieve performance goals.

CQ_ONE_AT_A_TIME will always wait for a previous batch to complete before committing a new batch. This mode simplifies error handling logic by ensuring the server will not receive a batch of changes missing changes made by the server in handling the previous batch. It also ensures that if an error occurs handling one batch that the server won't receive a second batch until the errors for the first one are resolved on the client.


Implementation
    public function get commitQueueMode():int
    public function set commitQueueMode(value:int):void
commitRequiredproperty 
commitRequired:Boolean  [read-only]

Indicates if there are pending updates that must be committed.

This property can be used as the source for data binding.


Implementation
    public function get commitRequired():Boolean
conflictsproperty 
conflicts:Conflicts  [read-only]

Returns a list of conflicts for all managed items.

This property can be used as the source for data binding.


Implementation
    public function get conflicts():Conflicts
connectedproperty 
connected:Boolean  [read-only]

Indicates whether the DataStore is connected.


Implementation
    public function get connected():Boolean
destinationproperty 
destination:String  [read-only]

The destination for this DataStore.


Implementation
    public function get destination():String
identifierproperty 
identifier:String  [read-write]

The identifier of this DataStore. This optional property is used with cache configuration to uniquely identify this DataStore. This value must be session independent, that is, you should not create this identifier at runtime using a method like UIDUtil.createUID() If this value is not assigned one is calculated based on server configuration values for the associated channels.


Implementation
    public function get identifier():String
    public function set identifier(value:String):void
isInitializedproperty 
isInitialized:Boolean  [read-only]

Indicates when this DataStore is initialized and ready for use. This property is only needed when working with a runtime configured application or one that needs access to locally cached data on disk.

This property can be used as the source for data binding.


Implementation
    public function get isInitialized():Boolean
logproperty 
log:ILogger  [read-only]


Implementation
    mx_internal function get log():ILogger
logChangesproperty 
logChanges:int  [read-only]


Implementation
    mx_internal function get logChanges():int
mergeRequiredproperty 
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.


Implementation
    public function get mergeRequired():Boolean
messageCacheproperty 
messageCache:DataMessageCache  [read-write]

Lets ConcreteDataService directly access our message cache.


Implementation
    mx_internal function get messageCache():DataMessageCache
    mx_internal function set messageCache(value:DataMessageCache):void
processingServerChangesproperty 
public var processingServerChanges:Boolean = false

Indicates whether or not server changes are currently being processed.

This property can be used as the source for data binding.

requestTimeoutproperty 
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.


Implementation
    public function get requestTimeout():int
    public function set requestTimeout(value:int):void
TOKEN_CHAINproperty 
mx_internal static var TOKEN_CHAIN:String = "__token_chain__"

useTransactionsproperty 
useTransactions:Boolean  [read-write]


Implementation
    mx_internal function get useTransactions():Boolean
    mx_internal function set useTransactions(value:Boolean):void
Constructor Detail
DataStore()Constructor
public function DataStore(destination:String, useTransactions:Boolean)

Normally, a DataStore is created automatically for you but you can create your own DataStore and assign it to the dataStore property of a DataService. To do this, you must ensure all data services that share the same data store use the same channel set and have the same value of the use-transactions configuration setting. Use this constructor to create a DataStore where the destination parameter contains the destination of one of the DataServices using this data store. This is just used to look up the channel set. You also should provide the value for the use-transactions flag for this data store.

Parameters
destination:String
 
useTransactions:Boolean
Method Detail
addDataService()method
mx_internal function addDataService(ds:ConcreteDataService):void

Adds a data service to be managed by this data store

Parameters

ds:ConcreteDataService

addUnmergedMessage()method 
mx_internal function addUnmergedMessage(ds:ConcreteDataService, msg:DataMessage):void

When autoMerge is false, incoming messages are sent to this method to be stored and processed later.

Parameters

ds:ConcreteDataService
 
msg:DataMessage

allDataReleased()method 
mx_internal function allDataReleased(cds:ConcreteDataService):void

this method is used to tickle the datastore and see if it can shut down. when a dataservice releases all of its managed data it calls this method if no other dataservice is still attached with managed data this store can shut down.

Parameters

cds:ConcreteDataService

attemptMessageCacheSave()method 
mx_internal function attemptMessageCacheSave():void

this method is called by the commit responder to save the current state of the message cache so that committed items or uncommitted items that occurred in an offline state are restored appropriately. this eliminates duplice adds, updates, deletes, etc, when a commit completes once online connectivity have been restored.

checkDataStoreConsistency()method 
mx_internal function checkDataStoreConsistency():void

clearCache()method 
mx_internal function clearCache(dispatcher:IEventDispatcher, token:AsyncToken):void

Parameters

dispatcher:IEventDispatcher
 
token:AsyncToken

clearCacheData()method 
mx_internal function clearCacheData(ds:ConcreteDataService, descriptor:CacheDataDescriptor, token:AsyncToken):void

Clears the data specified by the passed descriptor from the local store.

Parameters

ds:ConcreteDataService — descriptor reference to the descriptor for the data that should be removed from the local cache
 
descriptor:CacheDataDescriptor
 
token:AsyncToken

clearCacheValue()method 
mx_internal function clearCacheValue(dispatcher:IEventDispatcher, value:Object, token:AsyncToken):void

Parameters

dispatcher:IEventDispatcher
 
value:Object
 
token:AsyncToken

commit()method 
public function commit(itemsOrCollections:Array = null, cascadeCommit:Boolean = false):AsyncToken

Commits pending changes for collections and items managed by this DataStore. 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.

Returns
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 
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.

Returns
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.
disableDelayedReleases()method 
mx_internal function disableDelayedReleases():void

disableLogging()method 
mx_internal function disableLogging():void

disconnect()method 
mx_internal function disconnect():void

Disconnects the internal producer used by the DataStore if all associated data services are disconnected.

doAutoCommit()method 
mx_internal function doAutoCommit(commitResponderClass:Class, createToken:Boolean = false, createItemReference:Boolean = false, token:AsyncToken = null):AsyncToken

Commits if auto commit is on, otherwise sets the commitRequired property.

Parameters

commitResponderClass:Class
 
createToken:Boolean (default = false)
 
createItemReference:Boolean (default = false)
 
token:AsyncToken (default = null)

Returns
AsyncToken
doCommit()method 
mx_internal function doCommit(commitResponderClass:Class, cds:ConcreteDataService, createItemReference:Boolean = false, token:AsyncToken = null, itemsOrCollections:Array = null, cascadeCommit:Boolean = false):AsyncToken

This method performs the guts of the commit operation. Callers can pass in a CommitResponder class to do handling of the result event.

Parameters

commitResponderClass:Class
 
cds:ConcreteDataService
 
createItemReference:Boolean (default = false)
 
token:AsyncToken (default = null)
 
itemsOrCollections:Array (default = null)
 
cascadeCommit:Boolean (default = false)

Returns
AsyncToken
doRevertChanges()method 
mx_internal function doRevertChanges(ds:ConcreteDataService = null, item:IManaged = null):Boolean

This implements the guts of the revertChanges operation. You may supply no arguments revert messages just for a particular data service or for a specific item. In that case supply both the data service and the item. True is returned if we revert any messages.

Parameters

ds:ConcreteDataService (default = null)
 
item:IManaged (default = null)

Returns
Boolean
enableDelayedReleases()method 
mx_internal function enableDelayedReleases():void

enableLogging()method 
mx_internal function enableLogging():void

getCacheData()method 
mx_internal function getCacheData(ds:ConcreteDataService, descriptor:CacheDataDescriptor, token:AsyncToken):void

Parameters

ds:ConcreteDataService
 
descriptor:CacheDataDescriptor
 
token:AsyncToken

getCacheDescriptors()method 
mx_internal function getCacheDescriptors(ds:ConcreteDataService, view:ListCollectionView, options:uint, value:Object, token:AsyncToken):void

Parameters

ds:ConcreteDataService
 
view:ListCollectionView
 
options:uint
 
value:Object
 
token:AsyncToken

getCacheIDs()method 
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.

Returns
AsyncToken — AsyncToken reference to the token that will identify this operation in a result or fault event dispatched from this service.
getDataService()method 
mx_internal function getDataService(destination:String):ConcreteDataService

Parameters

destination:String

Returns
ConcreteDataService
getDataServiceForValue()method 
mx_internal function getDataServiceForValue(value:Object):ConcreteDataService

Parameters

value:Object

Returns
ConcreteDataService
getDataStoreId()method 
mx_internal static function getDataStoreId(destination:String, useTransactions:Boolean, channelSet:ChannelSet):Object

Parameters

destination:String
 
useTransactions:Boolean
 
channelSet:ChannelSet

Returns
Object
getSharedDataStore()method 
mx_internal static function getSharedDataStore(destination:String, useTransactions:Boolean, channelSet:ChannelSet):DataStore

Two DataServices should share a DataStore when one references data in that other DataStore.

Parameters

destination:String
 
useTransactions:Boolean
 
channelSet:ChannelSet

Returns
DataStore
getStatusInfo()method 
mx_internal function getStatusInfo(dumpCache:Boolean):String

Parameters

dumpCache:Boolean

Returns
String
getUnmergedUpdateCollectionMessages()method 
mx_internal function getUnmergedUpdateCollectionMessages(destination:String, collectionId:Object):Array

Parameters

destination:String
 
collectionId:Object

Returns
Array
hasUnmergedUpdateCollectionMessages()method 
mx_internal function hasUnmergedUpdateCollectionMessages(destination:String, collectionId:Object):Boolean

Parameters

destination:String
 
collectionId:Object

Returns
Boolean
initialize()method 
mx_internal function initialize(success:Function, failed:Function):void

Initializes the DataStore which involves initialization of metadata of all the attached ConcreteDataService instances.

Parameters

success:Function
 
failed:Function

internalCommit()method 
mx_internal function internalCommit(ds:ConcreteDataService, itemsOrCollections:Array, cascadeCommit:Boolean):AsyncToken

Parameters

ds:ConcreteDataService
 
itemsOrCollections:Array
 
cascadeCommit:Boolean

Returns
AsyncToken
internalConnect()method 
mx_internal function internalConnect(dispatcher:IEventDispatcher, token:AsyncToken):void

Parameters

dispatcher:IEventDispatcher
 
token:AsyncToken

internalGetCacheIDs()method 
mx_internal function internalGetCacheIDs(dispatcher:IEventDispatcher, view:ListCollectionView, token:AsyncToken):void

Parameters

dispatcher:IEventDispatcher
 
view:ListCollectionView
 
token:AsyncToken

invoke()method 
mx_internal function invoke(msg:IMessage, responder:IResponder):void

Parameters

msg:IMessage
 
responder:IResponder

logCollectionUpdate()method 
mx_internal function logCollectionUpdate(dataService:ConcreteDataService, collectionId:Object, changeType:int, position:int, identity:Object, item:Object):void

When a change is made to a collection, this method adds that change to an existing update fill or creates a new one.

Parameters

dataService:ConcreteDataService
 
collectionId:Object
 
changeType:int
 
position:int
 
identity:Object
 
item:Object

logCreate()method 
mx_internal function logCreate(dataService:ConcreteDataService, item:Object, op:uint):DataMessage

Logs a create message for the specified item. This method will perform optimization on the cache by checking any previous operations for the specified item that would result in a no-op. For example, a create for a previous remove can be reduced to nothing.

Parameters

dataService:ConcreteDataService
 
item:Object
 
op:uint

Returns
DataMessage
logout()method 
public function logout():void

Log the user out from the current destination. Calling this method will log out all associated DataService instances.

logRemove()method 
mx_internal function logRemove(dataService:ConcreteDataService, item:Object):DataMessage

Logs a delete message for the specified item. This method will perform optimization on the cache by checking any previous operations for the specified item that would result in a no-op. For example, a remove to a created item can be reduced to nothing.

Parameters

dataService:ConcreteDataService
 
item:Object

Returns
DataMessage
logStatus()method 
mx_internal function logStatus(opName:String):void

Parameters

opName:String

logUpdate()method 
mx_internal function logUpdate(dataService:ConcreteDataService, item:Object, propName:Object, oldValue:Object, newValue:Object, stopAtItem:DataMessage, leafChange:Boolean, assoc:AssociationDefinition):void

Logs a update message for the specified item. This method will perform optimization on the cache by checking any previous operations for the specified item that would result in a no-op. For example, an update to a created item can be reduced to a create with the latest values.

Parameters

dataService:ConcreteDataService
 
item:Object
 
propName:Object
 
oldValue:Object
 
newValue:Object
 
stopAtItem:DataMessage
 
leafChange:Boolean
 
assoc:AssociationDefinition

merge()method 
public function merge():void

Merges any pending updates into the managed set of objects. The process of merging changes can detect conflicts.

processPageRequest()method 
mx_internal function processPageRequest(dataList:DataList, ds:ConcreteDataService, dataMsg:IMessage, responder:IResponder, token:AsyncToken):void

Parameters

dataList:DataList
 
ds:ConcreteDataService
 
dataMsg:IMessage
 
responder:IResponder
 
token:AsyncToken

refresh()method 
public function refresh():AsyncToken

Refetch all data managed on the client.

Returns
AsyncToken
release()method 
public function release(clear:Boolean = true, copyStillManagedItems:Boolean = true):void

Release all data managed on the client. This will free up the item and query caches on the client for all data as well as unsubscribing from any auto-sync'd data on the server.

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.

removeConflicts()method 
mx_internal function removeConflicts(ds:ConcreteDataService, item:IManaged = null):void

Parameters

ds:ConcreteDataService
 
item:IManaged (default = null)

removeDataService()method 
mx_internal function removeDataService(ds:ConcreteDataService):void

Removes a data service managed by this data store

Parameters

ds:ConcreteDataService

revertChanges()method 
public function revertChanges():Boolean

Reverts all pending (uncommitted) changes for all DataServices managed by this DataStore.

Returns
Boolean — true if any changes were reverted.
saveCache()method 
mx_internal function saveCache(dispatcher:IEventDispatcher, faultsOnly:Boolean = false, force:Boolean = true, value:Object = null, token:AsyncToken = null):void

This method will save the current state of the associated data services and internal message cache. To avoid event "confusion" we want to make sure that only the originator of the request gets an event dispatched to it, additionaly when we are in the autoSave mode we only want to dispatch fault events. It dispatch events in the following manner: 1) If the originator is non null then only the originator will have the event dispatched to it. a) If autoSave is enabled then the faultsOnly argument should be true and here only a fault will be dispatched 2) If the originator is null then no events should be dispatched

Parameters

dispatcher:IEventDispatcher
 
faultsOnly:Boolean (default = false)
 
force:Boolean (default = true)
 
value:Object (default = null)
 
token:AsyncToken (default = null)

sendUnsentCommits()method 
mx_internal function sendUnsentCommits(messagesIndex:Object):void

Parameters

messagesIndex:Object

setAutoConnect()method 
mx_internal function setAutoConnect(value:Boolean):void

Parameters

value:Boolean

setCredentials()method 
public function setCredentials(username:String, password:String):void

Set the credentials for this DataStore destination.

Parameters

username:String — The username for the destination
 
password:String — The password for the destination

setRemoteCredentials()method 
public function setRemoteCredentials(username:String, password:String):void

Set the credentials for the 3rd party of this DataStore destination.

Parameters

username:String — The username for the destination
 
password:String — The password for the destination

Event Detail
conflict Event
Event Object Type: mx.data.events.DataConflictEvent
DataConflictEvent.type property = mx.data.events.DataConflictEvent.CONFLICT

Dispatched when a conflict is detected between either pending changes on this client and changes submitted by another client, or when changes submitted by this client result detect a conflict error at the remote destination. The DataStore dispatches conflict events for all destinations which share the DataStore, or you can listen for conflict events for a specific type on a DataService. Use the DataStore when you have an object with associations as in that case, you may need to resolve conflicts in a specific order to maintain integrity of those associations.

The CONFLICT constant defines the value of the type property of the event object for a conflict event,

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
conflict The Conflict object that holds the conflict that occurred.
message The Message associated with this event.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
fault Event  
Event Object Type: mx.rpc.events.FaultEvent
FaultEvent.type property = mx.rpc.events.FaultEvent.FAULT

The FaultEvent.FAULT event is dispatched when the commit call returns an error.

The FAULT event type.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelabletrue, calling preventDefault() from the associated token's responder.fault method will prevent the service or operation from dispatching this event
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
faultThe Fault object that contains the details of what caused this event.
messageThe Message associated with this event.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
tokenThe token that represents the call to the method. Used in the asynchronous completion token pattern.
result Event  
Event Object Type: mx.rpc.events.ResultEvent
ResultEvent.type property = mx.rpc.events.ResultEvent.RESULT

The ResultEvent.RESULT event is dispatched when the commit call successfully returns.

The RESULT event type.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelabletrue, preventDefault() from the associated token's responder.result method will prevent the service or operation from dispatching this event
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
message The Message associated with this event.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
resultResult that the RPC call returns.
tokenThe token that represents the indiviudal call to the method. Used in the asynchronous completion token pattern.
Constant Detail
CQ_AUTOConstant
public static const CQ_AUTO:int = 1

Specifies to check for simple dependencies between any outstanding batches and the next batch to commit.

CQ_NOWAITConstant 
public static const CQ_NOWAIT:int = 3

Specifies to send the second batch immediately, not checking for dependencies.

CQ_ONE_AT_A_TIMEConstant 
public static const CQ_ONE_AT_A_TIME:int = 0

Specifies to wait for a previous batch to complete before committing a new batch.





 

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/DataStore.html