org.broadleafcommerce.common.extensibility.context.merge.handlers
Interface MergeHandler

All Known Implementing Classes:
AttributePreserveInsert, BaseHandler, InsertChildrenOf, InsertItems, LiberalNodeReplaceInsert, MergeHandlerAdapter, MetadataOverrideNodeReplaceInsert, NodeReplace, NodeReplaceInsert, NodeValueMerge, NonEmptyNodeReplaceInsert

public interface MergeHandler

All handlers must implement the MergeHandler interface. It defines the key properties and actions a MergeHandler must perform. MergeHandlers perform the actual merge of data from the patch document to the source document based on the business rules of the implementation.

Author:
jfischer

Method Summary
 MergeHandler[] getChildren()
          Retrieve any child merge handlers associated with this handler.
 String getName()
          Retrieve the name associated with this merge handlers.
 int getPriority()
          Retrieve the priority for the handler.
 String getXPath()
          Retrieve the XPath query associated with this handler.
 Node[] merge(NodeList nodeList1, NodeList nodeList2, List<Node> exhaustedNodes)
          Perform the merge using the supplied list of nodes from the source and patch documents, respectively.
 void setChildren(MergeHandler[] children)
          Set the child merge handlers
 void setName(String name)
          Set the period-delimited numeric string that names this handler
 void setPriority(int priority)
          Set the priority for this handler
 void setXPath(String xpath)
          Set the xpath query
 

Method Detail

merge

Node[] merge(NodeList nodeList1,
             NodeList nodeList2,
             List<Node> exhaustedNodes)
Perform the merge using the supplied list of nodes from the source and patch documents, respectively. Also, a list of nodes that have already been merged is provided and may be used by the implementation when necessary.

Parameters:
nodeList1 - list of nodes to be merged from the source document
nodeList2 - list of nodes to be merged form the patch document
exhaustedNodes - already merged nodes
Returns:
list of merged nodes

getPriority

int getPriority()
Retrieve the priority for the handler. Priorities are used by the MergeManager to establish the order of operations for performing merges.

Returns:
the priority value

setPriority

void setPriority(int priority)
Set the priority for this handler

Parameters:
priority -

getXPath

String getXPath()
Retrieve the XPath query associated with this handler. XPath is used by the handler to define to section of the source and patch documents that will be merged.

Returns:
the xpath query

setXPath

void setXPath(String xpath)
Set the xpath query

Parameters:
xpath -

getChildren

MergeHandler[] getChildren()
Retrieve any child merge handlers associated with this handler. Child merge handlers may be added alter merge behavior for a subsection of the merge area defined by this merge handler.

Returns:
child merge handlers

setChildren

void setChildren(MergeHandler[] children)
Set the child merge handlers

Parameters:
children -

getName

String getName()
Retrieve the name associated with this merge handlers. Merge handler names are period-delimited numeric strings that define the hierarchical relationship of mergehandlers and their children. For example, "2" could be used to define the second handler in the configuration list and "2.1" would be the name describing the first child handler of "2".

Returns:
the period-delimited numeric string that names this handler

setName

void setName(String name)
Set the period-delimited numeric string that names this handler

Parameters:
name -


Copyright © 2012. All Rights Reserved.