MainJavadocSource
IResult

com.raritantechnologies.searchApp
Interface IResult

All Known Subinterfaces:
IDocument
All Known Implementing Classes:
BasicResult, Document, FederatedResult, VerityResult, Z3950Result

public interface IResult

Interface for result objects. IResult objects represent a set of metadata returned by a search on a SearchSource.

IResult implementation can be XML based - getValue( ) methods work from the XML
- OR
implementation can be Name=Value based - getXML() or getDOM() build XML string or DOM object from the name=value pairs with the root element called "Result".


Developed by Raritan Technologies .

Author:
Ted Sullivan, Glenn Robitaille

Method Summary
 voidaddNestedResult(java.lang.String fieldName, IResult nestedResult)
           
 voidaddNestedResults(java.lang.String fieldName, IResultSet nestedResults)
           
 voidaddTree(java.lang.String name, TreeRoot tree)
          Methods to add/get associated TreeRoot objects.
 voidaddValue(java.lang.String field, java.lang.String value)
          Adds a value to a field.
 voidclearValue(java.lang.String field)
           
 org.w3c.dom.DocumentgetDOM(ILoginInfo userInfo)
          return a DOM Document object with the field data.
 java.util.IteratorgetFieldNames()
          returns an iterator of the 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.StringgetIDField()
           
 java.util.IteratorgetNestedFieldNames()
           
 IResultSetgetNestedResults(java.lang.String fieldName)
           
 SearchSourcegetSearchSource()
          returns the SearchSource object that generated this IResult.
 java.lang.StringgetSearchSourceName()
           
 java.lang.StringgetTitleField()
           
 TreeRootgetTree(java.lang.String name)
           
 java.util.IteratorgetTreeNames()
           
 java.lang.StringgetURLField()
           
 java.lang.StringgetValue(java.lang.String field)
          returns the value of a vield.
 java.lang.StringgetValue(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.StringgetXML(ILoginInfo userInfo)
           
 java.lang.StringgetXML(ILoginInfo userInfo, java.util.Iterator resultFields, java.util.Iterator nestedFields)
           
 booleanhasMultipleValues(java.lang.String field)
           
 booleanhasNestedResults()
          support for hierarchical IResult objects.
 voidsetIDField(java.lang.String IDField)
           
 voidsetNestedResults(java.lang.String fieldName, IResultSet nestedResults)
           
 voidsetSearchSourceName(java.lang.String searchSourceName)
          set/get the name of the SearchSource that this result came from.
 voidsetTitleField(java.lang.String titleField)
           
 voidsetURLField(java.lang.String URLField)
           
 voidsetValue(java.lang.String field, java.lang.String value)
          Sets a new result field.
 voidsetValues(java.util.Map values)
          Sets field values from a java.util.Map
 voidwriteFullText(ILoginInfo userInfo, java.lang.String formatType, java.io.OutputStream toStream)
          filters the full text document for this result to the out put stream toStream.
 

Method Detail

setSearchSourceName

public void setSearchSourceName(java.lang.String searchSourceName)
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.


getSearchSourceName

public java.lang.String getSearchSourceName()

getSearchSource

public SearchSource getSearchSource()
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.


setTitleField

public void setTitleField(java.lang.String titleField)

getTitleField

public java.lang.String getTitleField()

setIDField

public void setIDField(java.lang.String IDField)

getIDField

public java.lang.String getIDField()

setURLField

public void setURLField(java.lang.String URLField)

getURLField

public java.lang.String getURLField()

setValue

public void setValue(java.lang.String field,
                     java.lang.String value)
Sets a new result field. Used for fields that have only one value. Use addValue( ) for fields that can have more than one value.


addValue

public void addValue(java.lang.String field,
                     java.lang.String value)
Adds a value to a field. used for fields with more than one value. Use setValue( ) for fields that can only have one value.


setValues

public void setValues(java.util.Map values)
Sets field values from a java.util.Map


getFieldNames

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


getValue

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


getValue

public 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.


getValues

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


hasMultipleValues

public boolean hasMultipleValues(java.lang.String field)

clearValue

public void clearValue(java.lang.String field)

hasNestedResults

public boolean hasNestedResults()
support for hierarchical IResult objects.


getNestedFieldNames

public java.util.Iterator getNestedFieldNames()

getNestedResults

public IResultSet getNestedResults(java.lang.String fieldName)

addNestedResults

public void addNestedResults(java.lang.String fieldName,
                             IResultSet nestedResults)

addNestedResult

public void addNestedResult(java.lang.String fieldName,
                            IResult nestedResult)

setNestedResults

public void setNestedResults(java.lang.String fieldName,
                             IResultSet nestedResults)

getDOM

public org.w3c.dom.Document getDOM(ILoginInfo userInfo)
return a DOM Document object with the field data.


getXML

public java.lang.String getXML(ILoginInfo userInfo)

getXML

public java.lang.String getXML(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.


writeFullText

public 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. If access is restricted, userInfo is used to login.


addTree

public void addTree(java.lang.String name,
                    TreeRoot tree)
Methods to add/get associated TreeRoot objects.


getTreeNames

public java.util.Iterator getTreeNames()

getTree

public TreeRoot getTree(java.lang.String name)