|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.raritantechnologies.searchApp.formatters.NestedResultGenerator
Generates a nested result set from a set of parallel arrays, multi-value fields or numbered fields.
XML Configuration Template:
<FieldFormatter formatterClass="com.raritantechnologies.searchApp.formatters.NestedResultGenerator"
nestedFieldName="[name for parent tag of nested result]"
fieldList="[fields to include in the nested result separated by a comma]"
arrayPattern="[$ (default) - value to be replaced by a number of the field being processed]"
maxArraySize="[number of occurrences of the array fields]"
zeroBased="[false (default) - specifies if field array starts with 0 (true) or 1 (false)]" >
</FieldFormatter>
The following example shows how to set things up for a parallel array:
A screen has the following data entry boxes:
Names Title
Steve Accountant
Lucy Manager
Mary Programmer
Bob Analyst
Jeff Networking
The above fields are defined in the configuration xml for the application as follows:
Names_1 Title_1
Names_2 Title_2
Names_3 Title_3
Names_4 Title_4
Names_5 Title_5
By using the following configuration, the class will generate the XML below:
<FieldFormatter formatterClass="com.raritantechnologies.searchApp.formatters.NestedResultGenerator"
nestedFieldName="Personnel"
fieldList="Names,Title"
arrayPattern="$"
maxArraySize="5"
zeroBased="false" >
</FieldFormatter>
<Personnel>
<ResultSet>
<result>
<CollectionGroupName><![CDATA[Steve]]></CollectionGroupName>
<CollectionList><![CDATA[Accountant]]></CollectionList>
</result>
<result>
<CollectionGroupName><![CDATA[Lucy]]></CollectionGroupName>
<CollectionList><![CDATA[Manager]]></CollectionList>
</result>
<result>
<CollectionGroupName><![CDATA[Mary]]></CollectionGroupName>
<CollectionList><![CDATA[Programmer]]></CollectionList>
</result>
<result>
<CollectionGroupName><![CDATA[Bob]]></CollectionGroupName>
<CollectionList><![CDATA[Analyst]]></CollectionList>
</result>
<result>
<CollectionGroupName><![CDATA[Jeff]]></CollectionGroupName>
<CollectionList><![CDATA[Networking]]></CollectionList>
</result>
</ResultSet>
</Personnel>
| Field Summary |
| Fields inherited from interface com.raritantechnologies.searchApp.IFieldFormatter |
TEMPLATE |
| Constructor Summary | |
NestedResultGenerator()
|
|
| 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 |
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. |
IResultSet |
processFieldList(IResult res)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public NestedResultGenerator()
| Method Detail |
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 res)
IFieldFormatter
formatResultField in interface IFieldFormattersessionID - The session key needed to lookup any session content stored
in the session data cache.res - The result object that is to be formatted.public java.lang.String getFieldName()
IFieldFormatter
getFieldName in interface IFieldFormatterpublic java.lang.String formatField(java.lang.String fieldVal)
IFieldFormatter
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)
initialize in interface IFieldFormatterpublic java.lang.String getConfigurationXML()
getConfigurationXML in interface IFieldFormatterpublic java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
getConfigurationXML in interface IFieldFormatterpublic IResultSet processFieldList(IResult res)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||