Pakket | mx.data |
Klasse | public class DataService |
Overerving | DataService DataManager Object |
Subklassen | DataService |
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
A DataService instance is constructed specifying the desired destination. Destinations are generally configured from the services-config.xml file, but can also be configured dynamically with runtime configuration, as in the case of model-driven development.
There are two different sets of methods that retrieve data from the specified remote destination. The first are for collection managed objects. The second are for single managed objects.
For collection managed objects, you use the DataService.fill()
method.
This method populates an ArrayCollection with objects that this service
manages.
To get single manged objects, use the DataService.getItem()
and
DataService.createItem()
methods.
When a previously filled ArrayCollection is no longer needed
or the items within that collection should no longer receive or create
updates, call the DataService.releaseCollection()
method.
When an item previously retrieved using DataService.getItem()
or DataService.createItem()
is no longer needed or should not
receive or create updates, call the DataService.releaseItem()
method
The DataService.createItem()
and
DataService.getItem()
methods return an
ItemReference instance that you can use to release a specific instance of a single managed
object.
Unlike the DataService.releaseItem()
method, calling the
ItemReference.releaseItem()
method releases a specific instance of
a single managed object.
The DataService.releaseItem()
method releases the first single managed object that it
finds with an identity that matches a specified identity.
This is fine as long as the number of calls to the
DataService.getItem()
and DataService.createItem()
methods matches the number of calls to the DataService.releaseItem()
method.
A connection to the remote destination is created automatically the first
time you call any methods that require a connection.
For example, when you call the DataService.fill()
method or
the DataService.commit()
method when there are uncommitted
updates, the DataService instance attempts to establish a connection to the remote destination.
To force a DataService instance to disconnect, call the
DataService.disconnect()
method.
You can use the DataService.disconnect()
method to clean up remote destination resources
that are no longer needed.
Because other services may be using the same physical connection, calling the
DataService.disconnect()
method may terminate the connection.
The bindable connected
property indicates the current state
of the associated DataService connection.
If a remote destination has declared any security constraints for an
operation, you must provide credentials by calling the DataService.setCredentials()
method.
A call to the DataService.setCredentials()
method turns into a login command at the remote destination.
To change credentials or invalidate the current session, call
the DataService.logout()
method, which releases all
local managed data.
Calling the DataService.logout()
method is equivalent to calling the
DataService.release()
method.
Each DataService instance has a dataStore
property that
returns an object of type mx.data.DataStore
.
This object stores the uncommitted changes for one or more
DataService instances.
By default, a DataService instance shares the same
DataStore instance with other DataService instances if they have managed
association properties and share the same set of channels.
When sharing a DataStore instance, a call to the commit()
method
on one DataService instance commits changes for all
DataService instances using the shared DataStore instance.
This preserves the order of operations in the event that there are dependencies
between the changes in the associated DataService instances.
DataService and DataStore instances dispatch result and fault events for all operations that require a remote call.
Note: if you create two DataService instances that point to the same destination, both instances share the same collection of managed objects and dispatch the same set of events. For example, if you add an event listener to one DataService instance for a destination and you use a different instance to initiate an operation, the first DataService instance still receives those events. Each operation you initiate on a DataService instance returns an AsyncToken instance. You can add an event responder to that AsyncToken instance to receive a result event specific to that operation. This approach often produces cleaner code than adding a result or fault event handler globally for a given destination.
You can use data binding on properties of any managed object for a
DataService instance.
A DataService instance also dispatches a "message" event when a remote
operation occurs for any managed object.
For example, when a remote process updates a locally managed item, a
message is pushed to all DataService instances that are
still managing that item.
This message is dispatched as a MessageEvent.MESSAGE
event.
A conflict event is dispatched when a conflict is detected either at the remote destination in response to
a change the DataService instance commits or due to a pushed
change that conflicts with a local uncommitted change.
You can handle conflict events by listening for
DataConflictEvent.CONFLICT
.
Use data binding to update user interface controls by binding to the
DataService.conflicts.resolved
property.
The DataService class supports the following data synchronization configuration modes:
-
autoCommit
- when true each change is immediately sent to the remote destination when detected. When this isfalse
, you must make an explicit call to thecommit()
method. Use the bindableDataService.commitRequired
property determine if there are uncommitted changes. -
autoSyncEnabled
- This affects anyfill()
,getItem()
orcreateItem()
method calls and determines whether managed instances listen for changes made to these objects by other clients or by the DataServiceTransaction server push API at the remote destination. -
autoMerge
- Controls whether changes received from a remote destination are applied immediately or queued up until a call to theDataService.merge()
method is made.
Use the DataService.revertChanges()
method to revert
changes for a specific item or for all items.
When an error occurs for a remote destination operation, the committed
changes are put back into the uncommitted queue so the data stays in sync
with the data at the remote destination.
If the changes are in error, you typically make a call to the
DataService.revertChanges()
method to undo the changes as part
of a fault handler.
The mx.data.mxml.DataService class is an MXML-specific subclass of the mx.data.DataService class that allows binding to the properties of a DataService instance.
MXML-syntaxisMXML-syntaxis verbergenThe <mx:DataService> element accepts the following 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." />
Verwante API-elementen
mx.data.Conflicts
mx.data.Conflict
mx.data.ItemReference
mx.data.IManaged
mx.data.utils.Managed
mx.data.IChangeObject
Eigenschap | Gedefinieerd door | ||
---|---|---|---|
adapter : DataServiceAdapter = null
An instance of a class that controls interaction with the server. | DataManager | ||
autoCommit : Boolean
Indicates whether changes to the local cache are automatically committed. | DataManager | ||
autoConnect : Boolean
Indicates if this service should attempt to connect for any operations
that require a connection. | DataManager | ||
autoMerge : Boolean
If set to false, when changes are pushed from the remote
destination to the client they are not immediately applied. | DataManager | ||
autoSaveCache : Boolean
You can store the local cache of data and changes to disk. | DataManager | ||
autoSyncEnabled : Boolean
When true, fill(), createItem() and
getItem() requests return items that listen for updates
made to these items from the remote destination. | DataManager | ||
cacheID : String
Provides access to the cache identifier for this service. | DataManager | ||
channelSet : ChannelSet
Provides access to the ChannelSet used by the service. | DataService | ||
commitRequired : Boolean [alleen-lezen]
Indicates if there are changes that have not been committed and
the commit() method should be called. | DataManager | ||
conflictDetector : ConflictDetector
Provides access to the current implementation being used to
detect conflicts for remote operations pushed to this
DataManager instance. | DataManager | ||
conflicts : Conflicts [alleen-lezen]
Contains a Conflicts object, which is an ArrayList of
Conflict instances. | DataManager | ||
connected : Boolean [alleen-lezen]
Indicates if the DataService is connected to the remote destination. | DataManager | ||
constructor : Object
Verwijzing naar het klasseobject of de constructorfunctie van een bepaalde objectinstantie. | Object | ||
dataStore : DataStore
Contains an object of type mx.data.DataStore. | DataManager | ||
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. | DataManager | ||
destination : String [alleen-lezen]
Indicates which remote destination this service is associated with. | DataService | ||
encryptLocalCache : Boolean
Indicates if offline storage should be encrypted For AIR
clients that use a SQL offline adapter. | DataManager | ||
fallBackToLocalFill : Boolean
This flag determines whether the application should query against the
local store when it is not connected. | DataManager | ||
hierarchicalEventsDefault : Boolean
Associations optionally list property change events on properties of
the associated instances. | DataManager | ||
ignoreCollectionUpdates : Boolean
Indicates if changes to managed collections should be ignored instead of
being communicated to the server on a commit. | DataManager | ||
indexReferences : Boolean
To tune the speed of your application, set this property to false
if you have a small number of fills or references to items managed by this
DataManager from association properties of other items. | DataManager | ||
isInitialized : Boolean [alleen-lezen]
Indicates whether the metadata associated with this DataManager instance
is initialized. | DataManager | ||
manualSync : ManualSyncConfiguration
Provides access to the ManualSyncConfiguration
instance for each DataManager instance. | DataManager | ||
maxFrequency : uint
Determines the maximum number of messages per second the DataManager instance
can receive. | DataManager | ||
mergeRequired : Boolean [alleen-lezen]
Indicates whether there are any pending changes that must be
merged. | DataManager | ||
offlineAdapter : DataServiceOfflineAdapter
Returns an object of type mx.data.DataServiceOfflineAdapter. | DataManager | ||
pageSize : int
Provides access to the current page size setting for all collections. | DataManager | ||
pagingEnabled : Boolean [alleen-lezen]
Indicates whether the remote destination is configured to allow paged
requests. | DataManager | ||
priority : int
The default message priority for the messages the DataManager instance sends. | DataManager | ||
requestTimeout : int
Provides access to the request timeout in seconds for an operation. | DataManager | ||
resetCollectionOnFill : Boolean
When the property is true, after the fill operation completes, a RESET event is
sent. | DataManager | ||
resubscribeAttempts : int
Controls the number of times a disconnected DataManager instance attempts to
resubscribe to its destination. | DataManager | ||
resubscribeInterval : int
Controls the delay, in milliseconds, between resubscribe attempts. | DataManager | ||
saveCacheRequired : Boolean [alleen-lezen]
Indicates if there are changes that have not been saved to the
local cache and the saveCache() method should be called. | DataManager | ||
subscribed : Boolean [alleen-lezen]
Indicates if the DataManager instance is subscribed to the remote destination. | DataManager | ||
throwItemPendingErrors : Boolean
Set this property to false if you want to suppress item pending
errors when lazily fetched or unpaged data is accessed. | DataManager |
Methode | Gedefinieerd door | ||
---|---|---|---|
DataService(destination:String)
Constructs a DataService instance with the specified
destination. | DataService | ||
Clears any data stored to disk with a previous call to the
saveCache() method or when the autoSaveCache method was set to
true
| DataManager | ||
Clears the data specified by the passed descriptor from the local store. | DataManager | ||
Commits pending changes for all collections currently managed by
the DataStore instance associated with this DataManager instance. | DataManager | ||
Indicates if there are pending changes for this particular object. | DataManager | ||
Forces a connection attempt by this service to the remote destination. | DataManager | ||
Calls a count method on the remote destination. | DataManager | ||
Requests that the specified item be created in the remote store. | DataManager | ||
Requests that the specified item be deleted from the remote store. | DataManager | ||
Disconnects the DataManager instance's network connection. | DataManager | ||
Executes a query with the provided name and arguments. | DataManager | ||
Fills the specified ListCollectionView (collection) instance based
on the associated fill method of the destination. | DataManager | ||
Fills the specified ListCollectionView (collection) instance based
on the associated fill method of the destination. | DataManager | ||
Executes a query that returns a single item. | DataManager | ||
Returns an ArrayCollection or a single managed object from the
the local store. | DataManager | ||
getCacheDescriptors(view:ListCollectionView, options:uint = 0, item:Object = null):mx.rpc:AsyncToken
Fills the specified ListCollectionView (collection) instance with
CacheDataDescriptor instances. | DataManager | ||
Fills the specified ListCollectionView (collection) instance
with all cache identifiers previously used in the application. | DataManager | ||
Makes an asynchronous request for an item matching the
specified identity. | DataManager | ||
Looks up the supplied item with the given identity. | DataManager | ||
Returns page information for the specified collection. | DataManager | ||
Returns the pending operation in the message cache for the specified
item. | DataManager | ||
Geeft aan of voor een object een opgegeven eigenschap is gedefinieerd. | Object | ||
Forces initialization of the DataStore. | DataManager | ||
Returns true if the passed collection is managed by this service. | DataManager | ||
Returns true if the passed collection is using paging features. | DataManager | ||
Geeft aan of een instantie van de klasse Object zich in de prototypeketen van het object bevindt dat als parameter is opgegeven. | Object | ||
Returns true if the supplied range of items is all paged in. | DataManager | ||
Fills the specified ListCollectionView based
on the associated <fill-method> elements based on the data from the
local store. | DataManager | ||
Logs the user out of the destination for the DataService. | DataService | ||
Merges any pending updates into the managed set of objects. | DataManager | ||
Geeft aan of de opgegeven eigenschap bestaat en kan worden opgesomd. | Object | ||
Refreshes all data managed by this DataManager instance. | DataManager | ||
Refreshes a collection previously filled with the fill method or managed as
a managed association. | DataManager | ||
Releases all managed collections and items for the DataManager instance. | DataManager | ||
releaseCollection(view:ListCollectionView, clear:Boolean = false, copyStillManagedItems:Boolean = true):void
Releases any item within the specified collection from management by
this DataManager instance. | DataManager | ||
releaseItem(item:IManaged, copyStillManagedItems:Boolean = true, enableStillManagedCheck:Boolean = true):IManaged
Releases the specified item from management by this DataManager instance. | DataManager | ||
Releases a range of items in the collection. | DataManager | ||
Releases the value for a single-valued association. | DataManager | ||
Reverts any uncommitted changes to the specified item. | DataManager | ||
Reverts the changes for any item contained in the specified collection which should
be managed by this DataManager instance. | DataManager | ||
This method saves the current state of the DataManager instance's cache. | DataManager | ||
Indicates if there are pending changes for this particular object
that are not saved to the local cache. | DataManager | ||
Sets the credentials for this DataService destination. | DataService | ||
Stelt de beschikbaarheid van een dynamische eigenschap voor lusbewerkingen in. | Object | ||
Sets the credentials for the third party of this DataService destination. | DataService | ||
Obtains the changed items for all previously executed fills on this data service
(data manager). | DataManager | ||
[statisch]
A convenience method to allow the synchronization of all local data: a
synchronizeAllFills() is invoked on each data service (data manager) specified such
that the final result token is completed only when all the individual
synchronizeAllFills() calls are completed. | DataManager | ||
Obtains the changed items that have changed on the server since the
previous time a fill or synchronizeFill was invoked. | DataManager | ||
Geeft de tekenreeksweergave van dit object weer, geformatteerd volgens de locatiespecifieke conventies. | Object | ||
Retourneert een tekenreeksrepresentatie van het opgegeven object. | Object | ||
Triggers an update for the specified item. | DataManager | ||
Retourneert de primitieve waarde van het opgegeven object. | Object |
Gebeurtenis | Overzicht | Gedefinieerd door | ||
---|---|---|---|---|
The DataConflictEvent.CONFLICT event is dispatched when a conflict is detected between pending local changes and changes submitted by another client, or when changes submitted by this client conflict with those in the remote destination. | DataService | |||
The DataServiceFaultEvent.FAULT event is dispatched when a service call fails due to an error. | DataService | |||
The MessageEvent.MESSAGE event is dispatched when the remote destination pushes a notification of a data operation. | DataService | |||
The PropertyChangeEvent.PROPERTY_CHANGE event is dispatched when a property of this service changes. | DataService | |||
The ResultEvent.RESULT event is dispatched when a service call successfully returns. | DataService |
channelSet | eigenschap |
channelSet:ChannelSet
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
Provides access to the ChannelSet used by the service.
The ChannelSet can be manually constructed and assigned, or it will be
dynamically created to use the configured Channels for the
destination
for this service.
Implementatie
public function get channelSet():ChannelSet
public function set channelSet(value:ChannelSet):void
destination | eigenschap |
destination:String
[alleen-lezen] Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
Indicates which remote destination this service is associated with.
Implementatie
public function get destination():String
DataService | () | Constructor |
public function DataService(destination:String)
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
Constructs a DataService instance with the specified destination. The destination name must be a reference to a destination configured in a LiveCycle Data Service configuration file or with runtime configuration.
Parametersdestination:String — that contains the name of the desired destination.
|
logout | () | methode |
public function logout():void
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
Logs 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.
Note: Adobe recommends that you use the mx.messaging.ChannelSet.logout() method rather than this method.
Verwante API-elementen
setCredentials | () | methode |
public function setCredentials(username:String, password:String):void
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
Sets the credentials for this DataService destination. The credentials are applied to all services connected over the same ChannelSet.
Parameters
username:String — The username for the destination.
| |
password:String — The password for the destination
|
setRemoteCredentials | () | methode |
public function setRemoteCredentials(username:String, password:String):void
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
Sets 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.
|
conflict | Gebeurtenis |
mx.data.events.DataConflictEvent
eigenschap DataConflictEvent.type =
mx.data.events.DataConflictEvent.CONFLICT
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
The DataConflictEvent.CONFLICT
event is dispatched when a
conflict is detected between pending local changes and changes
submitted by another client, or when changes submitted by this
client conflict with those in the remote destination.
Each DataService instance sends conflict events only for items of this
particular destination.
Use the conflict event on the DataService if you need to handle conflicts for a set of related destinations at the same time.
TheCONFLICT
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:
Property | Value |
---|---|
bubbles | false |
cancelable | false |
currentTarget | The 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. |
target | The 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 | Gebeurtenis |
mx.data.events.DataServiceFaultEvent
eigenschap DataServiceFaultEvent.type =
mx.data.events.DataServiceFaultEvent.FAULT
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
The DataServiceFaultEvent.FAULT
event is dispatched when a
service call fails due to an error.
For example, a call to the fill()
method dispatches this event
if the call fails.
You also get this event for each item that generates an error as part of
a commit result.
In that case, the DataServiceFaultEvent contains
the token returned by the commit, but the item and error message strings in
the fault are specific to the item that caused the error.
FAULT
constant defines the value of the type
property
of the event object for a fault
event.
The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
cancelable | true, calling preventDefault() from the associated token's responder.fault method will prevent the service or operation from dispatching this event |
currentTarget | The 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 . |
fault | The Fault object that holds the conflict that occurred. |
item | The item that generated the fault. |
identity | The identity of of the item that generated the fault. |
message | The Message associated with this event. |
token | The token that represents the call to the method. Used in the asynchronous completion token pattern. |
target | The 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. |
message | Gebeurtenis |
mx.messaging.events.MessageEvent
eigenschap MessageEvent.type =
mx.messaging.events.MessageEvent.MESSAGE
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
The MessageEvent.MESSAGE
event is dispatched when the remote
destination pushes a notification of a data operation.
For example, when data is updated in the remote destination an update
operation is sent to all clients listening, this operation is converted to
a message event on this DataService instance.
The value of this constant is "message"
.
The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
cancelable | false |
currentTarget | The 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. |
target | The 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. |
propertyChange | Gebeurtenis |
mx.events.PropertyChangeEvent
eigenschap PropertyChangeEvent.type =
mx.events.PropertyChangeEvent.PROPERTY_CHANGE
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
The PropertyChangeEvent.PROPERTY_CHANGE
event is dispatched
when a property of this service changes.
This happens for the following properties:
commitRequired
mergeRequired
connected
PropertyChangeEvent.PROPERTY_CHANGE
constant defines the value of the
type
property of the event object for a PropertyChange
event.
The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | Determined by the constructor; defaults to false. |
cancelable | Determined by the constructor; defaults to false. |
kind | The kind of change; PropertyChangeEventKind.UPDATE or PropertyChangeEventKind.DELETE. |
oldValue | The original property value. |
newValue | The new property value, if any. |
property | The property that changed. |
source | The object that contains the property that changed. |
currentTarget | The 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 . |
target | The 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. |
result | Gebeurtenis |
mx.rpc.events.ResultEvent
eigenschap ResultEvent.type =
mx.rpc.events.ResultEvent.RESULT
Taalversie: | ActionScript 3.0 |
Productversie: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtimeversies: | Flash Player 9, AIR 1.1 |
The ResultEvent.RESULT
event is dispatched when a service call
successfully returns.
For example a call to the fill()
method dispatches this event if the
call is successful.
The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
cancelable | true, preventDefault() from the associated token's responder.result method will prevent the service or operation from dispatching this event |
currentTarget | The 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. |
target | The 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. |
result | Result that the RPC call returns. |
token | The token that represents the indiviudal call to the method. Used in the asynchronous completion token pattern. |
Wed Jun 13 2018, 11:42 AM Z