com.raritantechnologies.searchApp
Class BasicResult

java.lang.Object
  extended bycom.raritantechnologies.searchApp.BasicResult
All Implemented Interfaces:
IResult
Direct Known Subclasses:
BeanPropertyResult, DieselpointResult, Document, MapResult, ParamResult, SwingResult, VerityResult, XMLResult

public class BasicResult
extends java.lang.Object
implements IResult

Basic implementation of IResult interface.


Developed by Raritan Technologies .

Author:
Ted Sullivan

Field Summary
protected  OrderedMap fieldValues
           
 
Constructor Summary
BasicResult()
           
 
Method Summary
 void addNestedResult(java.lang.String fieldName, IResult nestedResult)
           
 void addNestedResults(java.lang.String fieldName, IResultSet pNestedResults)
           
 void addTree(java.lang.String name, TreeRoot tree)
          Methods to add/get associated TreeRoot objects.
 void addValue(java.lang.String field, java.lang.String value)
          Adds a value for a field.
 void clearValue(java.lang.String field)
           
 org.w3c.dom.Document getDOM(ILoginInfo userInfo)
          return a DOM Document object with the field data.
 java.util.Iterator getFieldNames()
          returns an Iterator for the set of field names.
 java.lang.String[] getFullTextFormats(ILoginInfo userInfo)
          returns a list of formats available for the "full text" electronic format formats can be text, html, pdf etc.
 java.lang.String getIDField()
           
 java.util.Iterator getNestedFieldNames()
           
 IResultSet getNestedResults(java.lang.String fieldName)
           
protected  BasicResultSet getResultSet(java.lang.String fieldName)
           
 SearchSource getSearchSource()
          returns the SearchSource object that generated this IResult.
 java.lang.String getSearchSourceName()
           
 java.lang.String getTitleField()
           
 TreeRoot getTree(java.lang.String name)
           
 java.util.Iterator getTreeNames()
           
 java.lang.String getURLField()
           
 java.lang.String getValue(java.lang.String field)
          returns the value of a vield.
 java.lang.String getValue(java.lang.String field, java.lang.String defaultVal)
          returns the value of a result field OR the past defaultVal parameter if the field does not exist.
 java.lang.String[] getValues(java.lang.String field)
          Support for multiple values - returns a String[].
 java.lang.String getXML(ILoginInfo userInfo)
           
 java.lang.String getXML(ILoginInfo userInfo, java.util.Iterator resultFields, java.util.Iterator nestedFields)
           
 java.lang.String getXML(java.lang.String rootTagName)
           
 java.lang.String getXML(java.lang.String rootTagName, ILoginInfo userInfo, java.util.Iterator resultFields, java.util.Iterator nestedFields)
           
 boolean hasMultipleValues(java.lang.String field)
           
 boolean hasNestedResults()
          support for hierarchical IResult objects.
 void setIDField(java.lang.String idField)
           
 void setNestedResults(java.lang.String fieldName, IResultSet resultSet)
           
 void setSearchSourceName(java.lang.String searchSourceName)
          set/get the name of the SearchSource that this result came from.
 void setTitleField(java.lang.String titleField)
           
 void setURLField(java.lang.String URLField)
           
 void setValue(java.lang.String field, java.lang.String value)
          Sets a field value in the result, replacing any previously set value.
 void setValues(java.util.Map values)
          Sets field values from a java.util.Map
 void setWrapCData(boolean wrapCData)
           
 void writeFullText(ILoginInfo userInfo, java.lang.String formatType, java.io.OutputStream toStream)
          filters the full text document for this result to the out put stream toStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldValues

protected OrderedMap fieldValues
Constructor Detail

BasicResult

public BasicResult()
Method Detail

setSearchSourceName

public void setSearchSourceName(java.lang.String searchSourceName)
Description copied from interface: IResult
set/get the name of the SearchSource that this result came from. Note that the set method uses the search source name, not the SearchSource object itself. This is done to prevent memory leaks - the SearchSource is static configuration-bound object, IResults are transient, session-bound objects. Any links to application objects would prevent their garbage collection when the session is destroyed.

Specified by:
setSearchSourceName in interface IResult

getSearchSourceName

public java.lang.String getSearchSourceName()
Specified by:
getSearchSourceName in interface IResult

getSearchSource

public SearchSource getSearchSource()
Description copied from interface: IResult
returns the SearchSource object that generated this IResult. To prevent memory leaks, implementation must not cache the SearchSource object. rather, the method should look up the SearchSource from ConfigurationManager based on the IResult's searchSourceName variable. If IResult classes extend BasicResult, this behavior will be inheritted.

Specified by:
getSearchSource in interface IResult

setTitleField

public void setTitleField(java.lang.String titleField)
Specified by:
setTitleField in interface IResult

getTitleField

public java.lang.String getTitleField()
Specified by:
getTitleField in interface IResult

setIDField

public void setIDField(java.lang.String idField)
Specified by:
setIDField in interface IResult

getIDField

public java.lang.String getIDField()
Specified by:
getIDField in interface IResult

setURLField

public void setURLField(java.lang.String URLField)
Specified by:
setURLField in interface IResult

getURLField

public java.lang.String getURLField()
Specified by:
getURLField in interface IResult

setValue

public void setValue(java.lang.String field,
                     java.lang.String value)
Sets a field value in the result, replacing any previously set value.

Specified by:
setValue in interface IResult

addValue

public void addValue(java.lang.String field,
                     java.lang.String value)
Adds a value for a field. If this method is called more than once, the field will contain multiple values.

Specified by:
addValue in interface IResult

clearValue

public void clearValue(java.lang.String field)
Specified by:
clearValue in interface IResult

getFieldNames

public java.util.Iterator getFieldNames()
returns an Iterator for the set of field names.

Specified by:
getFieldNames in interface IResult

setValues

public void setValues(java.util.Map values)
Description copied from interface: IResult
Sets field values from a java.util.Map

Specified by:
setValues in interface IResult

getValue

public java.lang.String getValue(java.lang.String field)
Description copied from interface: IResult
returns the value of a vield. For multiple value fields, implementation should return a delimited string.

Specified by:
getValue in interface IResult

getValue

public java.lang.String getValue(java.lang.String field,
                                 java.lang.String defaultVal)
Description copied from interface: IResult
returns the value of a result field OR the past defaultVal parameter if the field does not exist.

Specified by:
getValue in interface IResult

getValues

public java.lang.String[] getValues(java.lang.String field)
Description copied from interface: IResult
Support for multiple values - returns a String[]. if there is only one value String array is of length 1.

Specified by:
getValues in interface IResult

hasMultipleValues

public boolean hasMultipleValues(java.lang.String field)
Specified by:
hasMultipleValues in interface IResult

hasNestedResults

public boolean hasNestedResults()
Description copied from interface: IResult
support for hierarchical IResult objects.

Specified by:
hasNestedResults in interface IResult

getNestedResults

public IResultSet getNestedResults(java.lang.String fieldName)
Specified by:
getNestedResults in interface IResult

setNestedResults

public void setNestedResults(java.lang.String fieldName,
                             IResultSet resultSet)
Specified by:
setNestedResults in interface IResult

addNestedResults

public void addNestedResults(java.lang.String fieldName,
                             IResultSet pNestedResults)
Specified by:
addNestedResults in interface IResult

addNestedResult

public void addNestedResult(java.lang.String fieldName,
                            IResult nestedResult)
Specified by:
addNestedResult in interface IResult

getResultSet

protected BasicResultSet getResultSet(java.lang.String fieldName)

getNestedFieldNames

public java.util.Iterator getNestedFieldNames()
Specified by:
getNestedFieldNames in interface IResult

getDOM

public org.w3c.dom.Document getDOM(ILoginInfo userInfo)
Description copied from interface: IResult
return a DOM Document object with the field data.

Specified by:
getDOM in interface IResult

getXML

public java.lang.String getXML(ILoginInfo userInfo)
Specified by:
getXML in interface IResult

getXML

public java.lang.String getXML(java.lang.String rootTagName)

getXML

public java.lang.String getXML(ILoginInfo userInfo,
                               java.util.Iterator resultFields,
                               java.util.Iterator nestedFields)
Specified by:
getXML in interface IResult

getXML

public java.lang.String getXML(java.lang.String rootTagName,
                               ILoginInfo userInfo,
                               java.util.Iterator resultFields,
                               java.util.Iterator nestedFields)

getFullTextFormats

public java.lang.String[] getFullTextFormats(ILoginInfo userInfo)
returns a list of formats available for the "full text" electronic format formats can be text, html, pdf etc. IResult must determine which formats the SearchSource supports, and which formats are available to the user.

Specified by:
getFullTextFormats in interface IResult

writeFullText

public void writeFullText(ILoginInfo userInfo,
                          java.lang.String formatType,
                          java.io.OutputStream toStream)
Description copied from interface: IResult
filters the full text document for this result to the out put stream toStream. If access is restricted, userInfo is used to login.

Specified by:
writeFullText in interface IResult

setWrapCData

public void setWrapCData(boolean wrapCData)

addTree

public void addTree(java.lang.String name,
                    TreeRoot tree)
Description copied from interface: IResult
Methods to add/get associated TreeRoot objects.

Specified by:
addTree in interface IResult

getTreeNames

public java.util.Iterator getTreeNames()
Specified by:
getTreeNames in interface IResult

getTree

public TreeRoot getTree(java.lang.String name)
Specified by:
getTree in interface IResult