BETA ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Hide Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes

Language Reference only
Filters: AIR 32.0 and earlier, Flash Player 32.0 and earlier, Flash Lite 4
None
Hide Filters
mx.data 

DataService  - AS3 LiveCycle Data Services

Packagesx

Top Level
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.consulting.pst.vo
com.adobe.dct.event
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.impl
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.importexport
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.mosaic.core
com.adobe.mosaic.core.events
com.adobe.mosaic.core.validators
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skins.aqua
com.adobe.mosaic.skins.aqua.organizer
com.adobe.mosaic.skins.aqua.tile
com.adobe.mosaic.skins.aqua.util
com.adobe.mosaic.skins.aqua.view
com.adobe.mosaic.skins.aqua.viewManager
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.endpoint
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses

Language Elements

Global Constants
Global Functions
Operators
Statements, Keywords & Directives
Special Types

Appendixes

What's New
Compiler Errors
Compiler Warnings
Run-Time Errors
Migrating to ActionScript 3
Supported Character Sets
MXML Only Tags
Motion XML Elements
Timed Text Tags
List of deprecated elements
Accessibility Implementation Constants
How to Use ActionScript Examples
Legal notices
(Preview)
Packagemx.data
Classpublic class DataService
InheritanceDataService Inheritance DataManager Inheritance Object
Subclasses DataService

Language Version: ActionScript 3.0
Product Version: LiveCycle Data Services for Java EE 3
Runtime Versions: Flash Player 9, AIR 1.1

The DataService class provides the top-level functionality for the Data Management Service. This class provides provides synchronization, replication, conflict detection, change tracking, and occasionally connected services.

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 sigle 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 is false, you must make an explicit call to the commit() method. Use the bindable DataService.commitRequired property determine if there are uncommitted changes.
  • autoSyncEnabled - This affects any fill(), getItem() or createItem() 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 the DataService.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 SyntaxexpandedHide MXML Syntax

The <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."
 />
 

More examples

Related API Elements



Public Properties
 PropertyDefined By
  channelSet : ChannelSet
Provides access to the ChannelSet used by the service.
DataService
 Inheritedconflicts : Conflicts
[read-only] Contains a Conflicts object, which is an ArrayList of Conflict instances.
DataManager
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  destination : String
[read-only] Indicates which remote destination this service is associated with.
DataService
 InheritedencryptLocalCache : Boolean
DataManager
 InheritedfallBackToLocalFill : Boolean
This flag determines whether the application should query against the local store when it is not connected.
DataManager
 InheritedignoreCollectionUpdates : Boolean
Indicates if changes to managed collections should be ignored instead of being communicated to the server on a commit.
DataManager
Public Methods
 MethodDefined By
  
DataService(destination:String)
Constructs a DataService instance with the specified destination.
DataService
 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
  
Logs the user out of the destination for the DataService.
DataService
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Releases the value for a single-valued association.
DataManager
  
setCredentials(username:String, password:String):void
Sets the credentials for this DataService destination.
DataService
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
  
Sets the credentials for the third party of this DataService destination.
DataService
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Protected Methods
 MethodDefined By
 Inherited
Queues a fault if this data manager has not yet been initialized.
DataManager
Events
 Event Summary Defined By
  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
Property Detail
Constructor Detail
Method Detail
Event Detail

message

Event  
Event Object Type: mx.messaging.events.MessageEvent
property MessageEvent.type = mx.messaging.events.MessageEvent.MESSAGE

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 MESSAGE event type; dispatched upon receipt of a message.

The value of this constant is "message".

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