com.raritantechnologies.searchApp.formatters
Class SimpleFormatter

java.lang.Object
  extended bycom.raritantechnologies.searchApp.formatters.SimpleFormatter
All Implemented Interfaces:
IConfigurable, IFieldFormatter

public class SimpleFormatter
extends java.lang.Object
implements IFieldFormatter

Sets the value of an IResult field.

XML Configuration Template:
   <Formatter 
      fieldID="[  fieldName ]" 
      value="[ Value of field ]" 
      formatterClass="com.raritantechnologies.searchApp.formatters.SimpleFormatter"
      nestedResultField="[ optional name of nested result to add value ]"
      multipleValues="[ true|false(default) - if true adds a new value to the field ]" />
 

Developed by Raritan Technologies .

Author:
Ted Sullivan

Field Summary
 
Fields inherited from interface com.raritantechnologies.searchApp.IFieldFormatter
TEMPLATE
 
Constructor Summary
SimpleFormatter()
           
 
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 res)
          Formats a result field "in place".
 void formatResultField(java.lang.String sessionID, IResult res)
          Formats a result field "in place", incorporating session context.
 java.lang.String getConfigurationXML()
           
 java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
           
 java.lang.String getFieldID()
           
 java.lang.String getFieldName()
          Returns the name of the result field that this formatter can reformat.
 java.lang.String getNestedResultField()
           
 java.lang.String getValue()
           
 void initialize(org.w3c.dom.Element elem)
          Initializes the formatter from configuration XML element.
 void setFieldID(java.lang.String fieldID)
           
 void setNestedResultField(java.lang.String nestedResultField)
           
 void setValue(java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleFormatter

public SimpleFormatter()
Method Detail

formatResultField

public void formatResultField(IResult res)
Formats a result field "in place".

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

formatResultField

public void formatResultField(java.lang.String sessionID,
                              IResult res)
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.
res - The result object that is to be formatted.

getFieldName

public java.lang.String getFieldName()
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 fieldVal)
Reformats a field value.

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

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.

initialize

public void initialize(org.w3c.dom.Element elem)
Initializes the formatter from configuration XML element.

Specified by:
initialize in interface IFieldFormatter

setFieldID

public void setFieldID(java.lang.String fieldID)

getFieldID

public java.lang.String getFieldID()

setValue

public void setValue(java.lang.String value)

getValue

public java.lang.String getValue()

setNestedResultField

public void setNestedResultField(java.lang.String nestedResultField)

getNestedResultField

public java.lang.String getNestedResultField()

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