Skip to content

Change Object: Synchronization Keystone

Victor Rasputnis edited this page Jul 31, 2012 · 24 revisions

When you sync() a standard Ext.data.DirectStore ExtJS is POST-ing new, modified and deleted items to the server. When the request is complete the server's reply data is applied to the store, expecting that some items can be modified by the server.

In case of Clear.data.DirectStore instead of passing around items, we pass the delta, wrapped in the ChangeObject, adopted from Adobe's LiveCycle Data Services:

ChangeObject

Each instance of the ChangeObject contains:

  • The newVersion of the item, if this ChangeObject is about modified or new item. Otherwise, this property is null
  • The prevVersion of the item, if this ChangeObject is about modified or deleted item. Otherwise, this property is null
  • The array of changePropertyNames if this ChangeObject describes an update
  • Flags: isDelete(), isUpdate(), isCreate(). One and only one of them returns true
  • The array of changePropertyNames, if this ChangeObject describes an update
  • Flags: isDelete(), isUpdate(), isCreate(). One and only one of them returns true.

ChangeObject Types

Java and JavaScript implementations of the ChangeObject - clear.data.ChangeObject - are part of clear-extjs-runtime-core.jar and Clear namespace.