| Package | org.restfulx.controllers |
| Class | public class ChangeController |
| Inheritance | ChangeController flash.events.EventDispatcher |
source service provider must implement ISynchingServiceProvider
while target service provider can be anything that implements the standard
IServiceProvider interface.
private funtion init():void {
ApplicationController.initialize([AIRServiceProvider, AS3JSONHTTPServiceProvider, DirectCouchDBHTTPServiceProvider],
AIRServiceProvider.ID, "yourairdbname");
Rx.changes.setSyncProviders(ISyncingServiceProvider(Rx.services.getServiceProvider(AIRServiceProvider.ID)),
Rx.services.getServiceProvider(AS3JSONHTTPServiceProvider.ID));
}
<mx:Button label="Push" click="{Rx.changes.push()}" enabled="{online}"/>
<mx:Button label="Pull" click="{Rx.changes.pull()}" enabled="{online}"/>
| Property | Defined by | ||
|---|---|---|---|
| errors : RxCollection
If there were synchronization errors (e.g.
| ChangeController | ||
| pushCount : int
Number of objects still left to push
| ChangeController | ||
| Method | Defined by | ||
|---|---|---|---|
|
ChangeController(source:ISyncingServiceProvider = null, destination:IServiceProvider = null, onSuccess:Function = null, onFailure:Function = null)
| ChangeController | ||
|
notifyPushEnd():void
Used internally to finish push session.
| ChangeController | ||
|
pull(... models):void
Pulls changes from destination service provider and passes them to the source service
provider
| ChangeController | ||
|
push(... models):void
Pushes changes from source service provider to target/destination service provider
| ChangeController | ||
|
Set sync providers on existing reference.
| ChangeController | ||
| Method | Defined by | ||
|---|---|---|---|
|
onCacheUpdate(event:CacheUpdateEvent):void
| ChangeController | ||
|
onDirtyChanges(result:Object, token:Object = null):void
| ChangeController | ||
|
onDirtyFault(info:Object, token:Object = null):void
| ChangeController | ||
| Constant | Defined by | ||
|---|---|---|---|
| CREATE : String = "N" [static]
Create flag used to tag instances marked for create but not yet created/synced
| ChangeController | ||
| DELETE : String = "D" [static]
Delete flag used to tag instances marked for deletion but not yet deleted/synced
| ChangeController | ||
| UPDATE : String = "U" [static]
Update flag used to tag instances marked for update but not yet updated/synced
| ChangeController | ||
| errors | property |
public var errors:RxCollectionIf there were synchronization errors (e.g. destiation service provider couldn't sync a specific object), they are available in this collection.
| pushCount | property |
public var pushCount:intNumber of objects still left to push
| ChangeController | () | constructor |
public function ChangeController(source:ISyncingServiceProvider = null, destination:IServiceProvider = null, onSuccess:Function = null, onFailure:Function = null)Parameters
source:ISyncingServiceProvider (default = null) — ISyncingServiceProvider implementation that changes come from
|
|
destination:IServiceProvider (default = null) — IServiceProvider implemnetation that the changes should go to
|
|
onSuccess:Function (default = null) |
|
onFailure:Function (default = null) |
| notifyPushEnd | () | method |
public function notifyPushEnd():voidUsed internally to finish push session.
| onCacheUpdate | () | method |
| onDirtyChanges | () | method |
protected function onDirtyChanges(result:Object, token:Object = null):voidParameters
result:Object |
|
token:Object (default = null) |
| onDirtyFault | () | method |
protected function onDirtyFault(info:Object, token:Object = null):voidParameters
info:Object |
|
token:Object (default = null) |
| pull | () | method |
public function pull(... models):voidPulls changes from destination service provider and passes them to the source service provider
Parameters... models |
Rx.changes.pull(Model1, Model2, Model3)
Rx.changes.pull()
Rx.changes.pull({type: Type1, metadata: {page:1, limit: 500}}, {type: Type2, metadata: {page: 1, limit:500}});
| push | () | method |
public function push(... models):voidPushes changes from source service provider to target/destination service provider
Parameters... models |
| setSyncProviders | () | method |
public function setSyncProviders(source:ISyncingServiceProvider, destination:IServiceProvider):voidSet sync providers on existing reference.
Parameterssource:ISyncingServiceProvider — ISyncingServiceProvider implementation that changes come from
|
|
destination:IServiceProvider — IServiceProvider implemnetation that the changes should go to
|
| CREATE | constant |
public static const CREATE:String = "N"Create flag used to tag instances marked for create but not yet created/synced
| DELETE | constant |
public static const DELETE:String = "D"Delete flag used to tag instances marked for deletion but not yet deleted/synced
| UPDATE | constant |
public static const UPDATE:String = "U"Update flag used to tag instances marked for update but not yet updated/synced