com.raritantechnologies.utils.tree
Class TreePathFormatter

java.lang.Object
  extended bycom.raritantechnologies.utils.tree.TreePathFormatter
All Implemented Interfaces:
IConfigurable, IFieldFormatter

public class TreePathFormatter
extends java.lang.Object
implements IFieldFormatter

Adds a tree path to an IResult given a NodeID value in the result. Uses an ITreeBuilder to create the Lookup tree.

XML Configuration Template:
   <FieldFormatter class="com.raritantechnologies.utils.tree.TreePathFormatter"
                      nodeIDField="[ result field that has tree NodeID ]"
                      pathField="[ result field that will get the tree path value ]" >

     <TreeBuilder class="[ class of com.raritantechnologies.utils.tree.ITreeBuilder ]" >
       <!-- configuration parameters for Tree Builder -->
     </TreeBuilder>

   </FieldFormatter>
 

Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Field Summary
 
Fields inherited from interface com.raritantechnologies.searchApp.IFieldFormatter
TEMPLATE
 
Constructor Summary
TreePathFormatter()
           
TreePathFormatter(java.lang.String nodeIDField, java.lang.String pathField, ITreeBuilder treeBuilder)
           
TreePathFormatter(java.lang.String nodeIDField, java.lang.String pathField, TreeRoot theTree)
           
 
Method Summary
 java.lang.String formatField(java.lang.String fieldVal)
          Reformats a field value.
 java.lang.String formatField(java.lang.String sessionID, java.lang.String fieldVal)
          Reformats a field value.
 void formatResultField(IResult result)
          Adds a tree path as a result attribute given a nodeID field in the result.
 void formatResultField(java.lang.String sessionID, IResult result)
          Formats a result field "in place", incorporating session context.
 java.lang.String getConfigurationXML()
           
 java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
           
 void getConfigurationXML(java.io.Writer writer)
           
 java.lang.String getFieldName()
          Returns the name of the result field that this formatter can reformat.
 void initialize(org.w3c.dom.Element elem)
          Initializes the formatter from configuration XML element.
 void setNodeIDField(java.lang.String nodeIDField)
           
 void setPathField(java.lang.String pathField)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreePathFormatter

public TreePathFormatter()

TreePathFormatter

public TreePathFormatter(java.lang.String nodeIDField,
                         java.lang.String pathField,
                         ITreeBuilder treeBuilder)

TreePathFormatter

public TreePathFormatter(java.lang.String nodeIDField,
                         java.lang.String pathField,
                         TreeRoot theTree)
Method Detail

formatResultField

public void formatResultField(java.lang.String sessionID,
                              IResult result)
Description copied from interface: IFieldFormatter
Formats a result field "in place", incorporating session context.

Specified by:
formatResultField in interface IFieldFormatter
Parameters:
sessionID - The session key needed to lookup any session content stored in the session data cache.
result - The result object that is to be formatted.

formatResultField

public void formatResultField(IResult result)
Adds a tree path as a result attribute given a nodeID field in the result.

Specified by:
formatResultField in interface IFieldFormatter
Parameters:
result - The result object that is to be formatted.

getFieldName

public java.lang.String getFieldName()
Description copied from interface: IFieldFormatter
Returns the name of the result field that this formatter can reformat.

Specified by:
getFieldName in interface IFieldFormatter

formatField

public java.lang.String formatField(java.lang.String sessionID,
                                    java.lang.String fieldVal)
Description copied from interface: IFieldFormatter
Reformats a field value.

Specified by:
formatField in interface IFieldFormatter
Parameters:
sessionID - The session key needed to lookup any session content stored in the session data cache.
fieldVal - The field value to be reformatted.
Returns:
The reformatted field value.

formatField

public java.lang.String formatField(java.lang.String fieldVal)
Description copied from interface: IFieldFormatter
Reformats a field value.

Specified by:
formatField in interface IFieldFormatter
Parameters:
fieldVal - The field value to be reformatted.
Returns:
The reformatted field value.

setNodeIDField

public void setNodeIDField(java.lang.String nodeIDField)

setPathField

public void setPathField(java.lang.String pathField)

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IFieldFormatter
Initializes the formatter from configuration XML element.

Specified by:
initialize in interface IFieldFormatter

getConfigurationXML

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

getConfigurationXML

public java.lang.String getConfigurationXML()
Specified by:
getConfigurationXML in interface IFieldFormatter

getConfigurationXML

public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
Specified by:
getConfigurationXML in interface IFieldFormatter