ColdFusion server side

The ColdFusion application uses a CFC to represent the data being exchanged and synchronized. For example, you could have an ORM employee component with a structure as follows:

<cfcomponent persistent="true" displayname="EMP"> 
    <cfproperty name="id" type="numeric" fieldtype="id" generator="native"> 
    <cfproperty name="firstName" type="string"> 
    <cfproperty name="lastName" type="string"> 
    ... 
    <cfproperty name="countryCode" type="string"> 
</cfcomponent>

You can also use a traditional non-ORM CFC. In this case, the Fetch and Sync Methods use the cfquery tag and related tags and function for database operations.

To manage interactions with the AIR application and keep the data synchronized, ColdFusion application uses a component called the SyncManager. The SyncManager implements the CFIDE.AIR.ISyncManager interface. The component has two functions:
  • A fetch function that the AIR application calls to get data from ColdFusion. This function is not part of the ISyncManager interface, but is required. The function can have any arbitrary name, but is called fetch by convention.

  • A sync function that the AIR application calls to synchronize the ColdFusion and AIR data sources when the application updates or changes data. This function takes three parameters:
    operations
    An array of operations to perform INSERT, UPDATE, or DELETE.

    clientObjects
    An array of objects, where each item in the array represents the client's current view of the data to be synchronized.

    originalObjects
    An array of objects, each item in this Array represents the corresponding original data from the server (if any), such as an existing employee record that a user is updating. For an INSERT operation, this object is null. For a DELETE operation, this object is normally the same as the current data.

Incase of Conflict during Sync process, the sync function returns to the AIR client an Array of "CFIDE.AIR.Conflict.cfc" objects. Each of this Conflict object consists of a single serverObject element. The sync function sets the element to equal the server copy of the record that is in conflict. The client application can then handle the conflict as described in Conflict management.