com.raritantechnologies.utils.tree.filter
Class MergeTreesFilter

java.lang.Object
  extended bycom.raritantechnologies.utils.tree.filter.MergeTreesFilter
All Implemented Interfaces:
IConfigurable, ITreeFilter

public class MergeTreesFilter
extends java.lang.Object
implements ITreeFilter

Merges trees at the tree level by adding or removing nodes from a target tree based on marked nodes in a source tree.

XML Configuration Template:
  <TreeFilter class="com.raritantechnologies.utils.tree.filter.MergeTreesFilter"
                 debug_xml="[true | false ( default ) ]" >

    <!-- Source Tree Builder - contains nodes to be added or deleted from the filtered tree -->
    <SourceTreeBuilder class="[ class of com.raritantechnologies.utils.tree.ITreeBuilder ]" >

    </SourceTreeBuilder>

    <!-- TreeNodeComparatorSet Matcher to detect added nodes in source tree -->
    <AddedNodeMatcher>
      <!-- see TreeNodeComparatorSet for Configuration details -->
    </AddedNodeMatcher>

    <!-- One or more ITreeNodeFilters to modify added node before it is added to the target tree -->
    <AddedNodeFilter class="[ class of com.raritantechnologies.utils.tree.filter.ITreeNodeFilter ]" >

    </AddedNodeFilter>

    <!-- TreeNodeComparatorSet Matcher to detect deleted nodes in source tree -->
    <DeletedNodeMatcher>

    </DeletedNodeMatcher>

    <!-- TreeNodeComparatorSet Matcher to detect deleted nodes in target tree: -->
    <!-- if matches, and deleteIfMatch is true, node will be deleted -->
    <!-- if node doesn't match and deleteIfMatch is false - node will be deleted -->
    <CheckDeletedMatcher deleteIfMatch="[true(default)|false]" >

    </CheckDeletedMatcher>

  </TreeFilter>
 


Field Summary
 
Fields inherited from interface com.raritantechnologies.utils.tree.ITreeFilter
TEMPLATE
 
Constructor Summary
MergeTreesFilter()
           
 
Method Summary
 void addNodes(TreeRoot toTree, TreeRoot fromTree, java.util.List addedNodes, RaritanPageContext rpc)
          Adds a list of TreeNodes to a target TreeRoot object.
 TreeNode filterNode(TreeNode node, TreeRoot sourceTree, RaritanPageContext rpc)
           
 TreeRoot filterTree(TreeRoot tree, RaritanPageContext rpc)
          Filter (prune, add, modify etc.) a Tree object.
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 void setSourceTree(TreeRoot sourceTree)
           
 void setSourceTreeBuilder(ITreeBuilder sourceTreeBuilder)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergeTreesFilter

public MergeTreesFilter()
Method Detail

filterTree

public TreeRoot filterTree(TreeRoot tree,
                           RaritanPageContext rpc)
Description copied from interface: ITreeFilter
Filter (prune, add, modify etc.) a Tree object.

Specified by:
filterTree in interface ITreeFilter

filterNode

public TreeNode filterNode(TreeNode node,
                           TreeRoot sourceTree,
                           RaritanPageContext rpc)
Specified by:
filterNode in interface ITreeFilter

setSourceTree

public void setSourceTree(TreeRoot sourceTree)

setSourceTreeBuilder

public void setSourceTreeBuilder(ITreeBuilder sourceTreeBuilder)

addNodes

public void addNodes(TreeRoot toTree,
                     TreeRoot fromTree,
                     java.util.List addedNodes,
                     RaritanPageContext rpc)
Adds a list of TreeNodes to a target TreeRoot object.


initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable