|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.raritantechnologies.searchApp.formatters.PatternResultFormatter
Uses a String pattern template to format a field or set of fields in an IResult.
The template can be any string pattern. Field values are inserted into the template at positions indicated by {fieldname} sections where "fieldname" is the name of some result field.
XML Configuration Template:
<Formatter formatterClass="com.raritantechnologies.searchApp.formatters.PatternResultFormatter"
outputID="[ fieldID that gets pattern result ]"
startBraceChar="[ character to start field name block - default is '{' ]"
endBraceChar="[ character to start field name block - default is '}' ]"
addValues="[ true|false(default) - if true, will add new value to output field ]" >
<!-- ========================================================= -->
<!-- String template that result field values will be inserted -->
<!-- into. If this is HTML or XML, the template block should be -->
<!-- wrapped in a <!CDATA[ ]]> section. -->
<!-- ========================================================= -->
<Template>
Display string with {fieldname} sections that will be replaced with result field values
inserted by the PatternResultFormatter.
Template can contain nested templates: e.g. {NESTED:nestedField:[ the sub template with inner {field}s ]}
Multiple field values can be handled by {MULTIPLE:multivalueField:[ the sub template with {VALUE} placeholders ]} If
the field has repeating values, the sub template will be repeated in the output. NOTE: DO NOT nest the same multi-value field
in the sub template!
</Template>
<!-- ============================================================================= -->
<!-- Templates can use IResultRenderers to fill in the template section IF -->
<!-- the section name is prepended with a "RENDERER:[name]" pattern. In this case, -->
<!-- there must be a child IResultRenderer defined with the given name -->
<!-- ============================================================================= -->
<FieldRenderers>
<FieldRenderer name="[ name of this renderer ]"
class="[ class of com.raritantechnologies.searchApp.taglibrary.IResultRenderer ]" >
</FieldRenderer>
</FieldRenderers>
</Formatter>
| Field Summary |
| Fields inherited from interface com.raritantechnologies.searchApp.IFieldFormatter |
TEMPLATE |
| Constructor Summary | |
PatternResultFormatter()
|
|
| 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 result)
Formats a result field "in place", incorporating session context. |
java.lang.String |
getConfigurationXML()
|
java.lang.String |
getConfigurationXML(java.lang.String configurationTemplate)
|
java.lang.String |
getFieldName()
Returns the name of the result field that this formatter can reformat. |
java.lang.String |
getFormattedString(java.lang.String sessionID,
IResult result)
Returns a formatted String for the metadata contained in an IResult. |
java.lang.String |
getFormattedString(java.lang.String sessionID,
IResult result,
java.lang.String resultTemplate)
|
void |
initialize(org.w3c.dom.Element elem)
Initializes the formatter from configuration XML element. |
void |
setResultTemplate(java.lang.String resultTemplate)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PatternResultFormatter()
| Method Detail |
public void setResultTemplate(java.lang.String resultTemplate)
public void formatResultField(IResult res)
IFieldFormatter
formatResultField in interface IFieldFormatterres - The result object that is to be formatted.
public void formatResultField(java.lang.String sessionID,
IResult result)
IFieldFormatter
formatResultField in interface IFieldFormattersessionID - The session key needed to lookup any session content stored
in the session data cache.result - The result object that is to be formatted.
public java.lang.String getFormattedString(java.lang.String sessionID,
IResult result)
public java.lang.String getFormattedString(java.lang.String sessionID,
IResult result,
java.lang.String resultTemplate)
public java.lang.String getFieldName()
IFieldFormatter
getFieldName in interface IFieldFormatterpublic java.lang.String formatField(java.lang.String fieldVal)
formatField in interface IFieldFormatterfieldVal - The field value to be reformatted.
public java.lang.String formatField(java.lang.String sessionID,
java.lang.String fieldVal)
IFieldFormatter
formatField in interface IFieldFormattersessionID - The session key needed to lookup any session content stored
in the session data cache.fieldVal - The field value to be reformatted.
public void initialize(org.w3c.dom.Element elem)
IFieldFormatter
initialize in interface IFieldFormatterpublic java.lang.String getConfigurationXML()
getConfigurationXML in interface IFieldFormatterpublic java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
getConfigurationXML in interface IFieldFormatter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||