Difference between revisions of "Differential Sync"

From ADF Docs
Jump to: navigation, search
Line 20: Line 20:
 
***newOverride.bean = "csContent_1_0"
 
***newOverride.bean = "csContent_1_0"
 
***newOverride.method = "populateContent_1_0"
 
***newOverride.method = "populateContent_1_0"
**You can override this to handle all new items with your own bean/method argument. It will get called with the parameter of "data" which is a structure of the element data
+
**You can override this to handle all new items with your own bean/method argument. It will get called with the parameter of "data" which is a structure of the element data. It will also get a paremter of elementName which is the ccapiName of the element.
 
*'''updateOverride''' - Structure
 
*'''updateOverride''' - Structure
 
**default:
 
**default:
***newOverride.bean = "csContent_1_0"
+
***updateOverride.bean = "csContent_1_0"
***newOverride.method = "populateContent_1_0"
+
***updateOverride.method = "populateContent_1_0"
**You can override this to handle all items that changed with your own bean/method argument. It will get called with the parameter of "data" which is a structure ot the element data
+
**You can override this to handle all items that changed with your own bean/method argument. It will get called with the parameter of "data" which is a structure ot the element data. It will also get a paremter of elementName which is the ccapiName of the element.
*'''deleteOverride'''
+
*'''deleteOverride''' - Structure
*'''syncSourceContent'''
+
**default:
 +
***deleteOverride.bean = "ceData_1_0"
 +
***deleteOverride.method = "deleteCE"
 +
**You can override this to handle all items that should be deleted with your own bean/method argument. It will get called with the parameter of datapageidList as a list of data page id's to be deleted. One reason why you may use this is do "deactivate" an item instead of deleting it
 +
*'''syncSourceContent''' - Array
 +
**Accepts an array of CE data
 +
**If you pass syncSourceContent it will use that data instead of pulling the data based on element name. This can be useful when you only want to sync a small set of data against another smaller set. It can also be helpful when your data may live in multiple locations and you need to combine them together prior to sync.
 
*'''elementCCAPIName'''
 
*'''elementCCAPIName'''
 +
**Default: arguments.elementName
 +
**This is the CCAPI name for the element, this is used when calling the new and update methods

Revision as of 14:29, 6 October 2011

The differentialSync function will optimally update a large set of data based on a comparison of existing data. The function takes many arguments, most notably the newOverride, updateOverride and deleteOverride; those 3 parameters can allow you to write custom code that will handle new, updates or deletions.

Parameters

  • elementName - String (Required)
    • The element name that we are going to sync.
  • newElements - Array (Required)
    • The elements that you would like to have as the result after the sync is complete
  • preformDelete - Boolean
    • default: false
    • This will call the delete function if set to true, otherwise deletions will not be processed. This can be helpful if you want old elements to remain.
  • primaryKeys - String
    • List of primary keys to use in the comparision
    • _pageID is a reserved word and will compare the elements pageID if it exists in the source data
    • Example: "links,title" or "_pageID,title"
  • ignoreFields - String
    • A list of fields to ignore in the comparison.
    • Example: "id,title"
  • newOverride - Structure
    • default:
      • newOverride.bean = "csContent_1_0"
      • newOverride.method = "populateContent_1_0"
    • You can override this to handle all new items with your own bean/method argument. It will get called with the parameter of "data" which is a structure of the element data. It will also get a paremter of elementName which is the ccapiName of the element.
  • updateOverride - Structure
    • default:
      • updateOverride.bean = "csContent_1_0"
      • updateOverride.method = "populateContent_1_0"
    • You can override this to handle all items that changed with your own bean/method argument. It will get called with the parameter of "data" which is a structure ot the element data. It will also get a paremter of elementName which is the ccapiName of the element.
  • deleteOverride - Structure
    • default:
      • deleteOverride.bean = "ceData_1_0"
      • deleteOverride.method = "deleteCE"
    • You can override this to handle all items that should be deleted with your own bean/method argument. It will get called with the parameter of datapageidList as a list of data page id's to be deleted. One reason why you may use this is do "deactivate" an item instead of deleting it
  • syncSourceContent - Array
    • Accepts an array of CE data
    • If you pass syncSourceContent it will use that data instead of pulling the data based on element name. This can be useful when you only want to sync a small set of data against another smaller set. It can also be helpful when your data may live in multiple locations and you need to combine them together prior to sync.
  • elementCCAPIName
    • Default: arguments.elementName
    • This is the CCAPI name for the element, this is used when calling the new and update methods