com.raritantechnologies.utils.tree
Class ResultPathTreeBuilder

java.lang.Object
  extended bycom.raritantechnologies.utils.tree.ResultPathTreeBuilder
All Implemented Interfaces:
IConfigurable, IResultSetProcessor, IResultSetTreeBuilder, ITreeBuilder

public class ResultPathTreeBuilder
extends java.lang.Object
implements ITreeBuilder, IResultSetProcessor, IResultSetTreeBuilder

Builds a tree from a set of Paths contained in an IResultSet.

XML Configuration Template:

  <TreeBuilder class="com.raritantechnologies.utils.tree.ResultPathTreeBuilder"
                  searchSourceName="[ name of search source - OR 'CURRENT_RESULTS' ]"
                  cachedResultsName="[ name of cached result set ]"
                  treePathField="[result path to get tree paths from]"
                  pathValueDelimiter="[ delimiter for packed multi-value result fields ]"
                  treeName="[name of root node]"
                  treeRootClass="[optional class name of root node]"
                  treeNodeClass="[optional class name of nodes]"
                  addNodeCounts="[true|false(default)]"
                  pathSeparator="[ separator of path default = '/' ]" 
                  useRootPath="[ true(default)|false - use Root path ]"
                  refreshCommand="[ command=value in request that will cause the tree to be refreshed ]"
                  requestPathField='[ request path used to add tree paths in refresh Mode ]" >

      <!-- ================================================================= -->
      <!--   Additional query fields for search (if using a SearchSource)    -->
      <!-- ================================================================= -->
      <Query> 
        <Field ID="[a search field]" value="[value to search]" />
        <Field ID="[another field]" value="[value to search]" />

        <!-- Alternatively: can build query from request parameters -->
        <Field ID="[ a search field ]" requestParam="[ name of request parameter ]" />
        <Field ID="[ a search field ]" requestParam="[ name of request parameter ]" exactMatch="true" />

        <!-- Can also use user properties -->
        <Field ID="[ a search field ]" userParam="[ name of user parameter ]" />
      </Query>

      <!-- ================================================================= -->
      <!-- Alternatively: Use an ICollectionGateway -->
      <!-- ================================================================= -->
      <CollectionGateway class="[ class of com.raritantechnologies.searchApp.dataCollection.ICollectionGateway ]" >

      </CollectionGateway>

      <!-- ================================================================= -->
      <!--           Map of result fields to tree node attributes            -->
      <!-- ================================================================= -->
      <ResultAttributeMap>
        <Field resultField="[ fieldID in result ]" attribute="[ tree node attribute ]" />
      </ResultAttributeMap>

  </TreeBuilder>

 

Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Field Summary
 
Fields inherited from interface com.raritantechnologies.utils.tree.ITreeBuilder
TEMPLATE
 
Constructor Summary
ResultPathTreeBuilder()
           
ResultPathTreeBuilder(java.lang.String treeRootClass, java.lang.String treeNodeClass)
           
 
Method Summary
 void addNode(TreeRoot theTree, TreeNode tNode, java.lang.String pathVal)
           
 void addNode(TreeRoot theTree, TreeNode tNode, java.lang.String pathVal, IResult res)
           
 void addNode(TreeRoot theTree, TreeNode tNode, java.lang.String pathVal, IResult res, java.util.Set countSet)
           
 void addNodes(TreeRoot theTree, java.lang.String[] treePaths)
           
 TreeRoot buildTree(RaritanPageContext pContext)
          Builds the tree from "scratch" - starting with a SearchSource and a Query, acquires all of the results from the query and builds a tree.
 TreeRoot buildTree(java.lang.String treeName, java.util.Map pathCountMap)
          builds a tree from a set of paths.
 TreeRoot buildTree(java.lang.String treeName, java.lang.String[] treePaths)
           
 TreeRoot buildTree(java.lang.String treeName, java.lang.String pathField, IResultSet results)
           
 void dataComplete()
          Data feed is complete.
 boolean getAddNodeCounts()
           
 java.lang.String getConfigurationXML()
           
 java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
           
 void getConfigurationXML(java.io.Writer writer)
           
 java.lang.String getNodeClass()
           
 java.lang.String getPathField()
           
 java.lang.String getPathSeparator()
           
 java.lang.String getSearchSourceName()
           
 java.lang.String getTreeClass()
           
 java.lang.String getTreeName()
           
 void initialize(org.w3c.dom.Element elem)
          Initialize the from XML Element.
 void initialize(java.util.Map initParams)
          Dynamic initialization.
 void processResults(TreeRoot theTree, IResultSet results)
           
 void processResults(TreeRoot theTree, IResultSet results, java.lang.String pathField)
           
 void processResults(TreeRoot theTree, IResultSet results, java.lang.String pathField, java.util.HashSet nodeSet)
           
 void processResultSet(java.lang.String sessionID, IResultSet data)
          processes the IResultSet (somehow)
 TreeRoot refreshTree(TreeRoot theTree, RaritanPageContext pContext)
          Method to enable dynamic or refreshable trees.
 void setAddNodeCounts(boolean addNodeCounts)
          determines whether leaf nodes will have counts added
 void setAddResultsToNode(boolean addResultsToNode)
           
 void setNodeClass(java.lang.String nodeClass)
           
 void setPathField(java.lang.String pathField)
           
 void setPathSeparator(java.lang.String pathSep)
           
 void setPathValueDelimiter(java.lang.String delimiter)
           
 void setResultAttributeMap(java.util.Map resultAttributeMap)
           
 void setSearchSourceName(java.lang.String searchSourceName)
           
 void setTreeClass(java.lang.String treeClass)
           
 void setTreeName(java.lang.String treeName)
           
 void setUseRootPath(boolean useRootPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultPathTreeBuilder

public ResultPathTreeBuilder()

ResultPathTreeBuilder

public ResultPathTreeBuilder(java.lang.String treeRootClass,
                             java.lang.String treeNodeClass)
Method Detail

buildTree

public TreeRoot buildTree(RaritanPageContext pContext)
Builds the tree from "scratch" - starting with a SearchSource and a Query, acquires all of the results from the query and builds a tree.

Specified by:
buildTree in interface ITreeBuilder

processResultSet

public void processResultSet(java.lang.String sessionID,
                             IResultSet data)
Description copied from interface: IResultSetProcessor
processes the IResultSet (somehow)

Specified by:
processResultSet in interface IResultSetProcessor

dataComplete

public void dataComplete()
Description copied from interface: IResultSetProcessor
Data feed is complete.

Specified by:
dataComplete in interface IResultSetProcessor

initialize

public void initialize(java.util.Map initParams)
Dynamic initialization.

Specified by:
initialize in interface IResultSetProcessor

refreshTree

public TreeRoot refreshTree(TreeRoot theTree,
                            RaritanPageContext pContext)
Description copied from interface: ITreeBuilder

Method to enable dynamic or refreshable trees. Static tree builders should implement this by returning the passed in tree object. Dynamic tree builders should implement this by returning the output of their buildTree( ) method or by pruning/growing the given tree as appropriate.

ITreeBuilders that support "lazy tree node evaluation" should use this method to determine which nodes in the tree need to be updated (TreeNode.needsUpdate( ) method returns true.

Specified by:
refreshTree in interface ITreeBuilder

buildTree

public TreeRoot buildTree(java.lang.String treeName,
                          java.lang.String pathField,
                          IResultSet results)
Specified by:
buildTree in interface IResultSetTreeBuilder

processResults

public void processResults(TreeRoot theTree,
                           IResultSet results)

processResults

public void processResults(TreeRoot theTree,
                           IResultSet results,
                           java.lang.String pathField)

processResults

public void processResults(TreeRoot theTree,
                           IResultSet results,
                           java.lang.String pathField,
                           java.util.HashSet nodeSet)

buildTree

public TreeRoot buildTree(java.lang.String treeName,
                          java.lang.String[] treePaths)

buildTree

public TreeRoot buildTree(java.lang.String treeName,
                          java.util.Map pathCountMap)
builds a tree from a set of paths.


addNodes

public void addNodes(TreeRoot theTree,
                     java.lang.String[] treePaths)

addNode

public void addNode(TreeRoot theTree,
                    TreeNode tNode,
                    java.lang.String pathVal)

addNode

public void addNode(TreeRoot theTree,
                    TreeNode tNode,
                    java.lang.String pathVal,
                    IResult res)

addNode

public void addNode(TreeRoot theTree,
                    TreeNode tNode,
                    java.lang.String pathVal,
                    IResult res,
                    java.util.Set countSet)

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IResultSetProcessor
Initialize the from XML Element.

Specified by:
initialize in interface IConfigurable

setAddNodeCounts

public void setAddNodeCounts(boolean addNodeCounts)
determines whether leaf nodes will have counts added

Specified by:
setAddNodeCounts in interface IResultSetTreeBuilder

getAddNodeCounts

public boolean getAddNodeCounts()

setSearchSourceName

public void setSearchSourceName(java.lang.String searchSourceName)

getSearchSourceName

public java.lang.String getSearchSourceName()

setPathField

public void setPathField(java.lang.String pathField)

getPathField

public java.lang.String getPathField()

setPathValueDelimiter

public void setPathValueDelimiter(java.lang.String delimiter)
Specified by:
setPathValueDelimiter in interface IResultSetTreeBuilder

setAddResultsToNode

public void setAddResultsToNode(boolean addResultsToNode)
Specified by:
setAddResultsToNode in interface IResultSetTreeBuilder

setTreeName

public void setTreeName(java.lang.String treeName)

getTreeName

public java.lang.String getTreeName()

setTreeClass

public void setTreeClass(java.lang.String treeClass)

getTreeClass

public java.lang.String getTreeClass()

setNodeClass

public void setNodeClass(java.lang.String nodeClass)

getNodeClass

public java.lang.String getNodeClass()

setPathSeparator

public void setPathSeparator(java.lang.String pathSep)

getPathSeparator

public java.lang.String getPathSeparator()

setResultAttributeMap

public void setResultAttributeMap(java.util.Map resultAttributeMap)
Specified by:
setResultAttributeMap in interface IResultSetTreeBuilder

setUseRootPath

public void setUseRootPath(boolean useRootPath)
Specified by:
setUseRootPath in interface IResultSetTreeBuilder

getConfigurationXML

public void getConfigurationXML(java.io.Writer writer)
                         throws java.io.IOException
Throws:
java.io.IOException

getConfigurationXML

public java.lang.String getConfigurationXML()

getConfigurationXML

public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)