com.autonomy.aci.businessobjects
Class ResultDocument

java.lang.Object
  extended bycom.autonomy.aci.businessobjects.AciBusinessObject
      extended bycom.autonomy.aci.businessobjects.Document
          extended bycom.autonomy.aci.businessobjects.ResultDocument
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
XMLResultDocument

public class ResultDocument
extends Document

A document as served up by IDOL in response to a query. The fields of a ResultDocument are populated using the information contained within the corresponding 'autn:hit' element for the document in the IDOL response.

All elements within the 'autn:hit' elements that start with 'autn:' and contain CDATA as opposed to XML are as mapped to AutnFields on the result document object. All of these fields can be read using the getAutnFieldValue methods. However, the most common ones are also available through methods such are getTitle, getSummary etc.

Content fields (available through getContentFields and getContentFieldValue) are defined as the value of the XML entities contained within the hit structure's <DOCUMENT> element (if this element is structured XML rather than in flat IDX format, the result object should be of class XMLResultDocument rather than ResultDocument).

See Also:
Serialized Form

Field Summary
static java.lang.String CONTENT_AUTN_FIELD_NAME
           
static java.lang.String DATABASE_AUTN_FIELD_NAME
           
static java.lang.String ID_AUTN_FIELD_NAME
           
static java.lang.String LINKS_AUTN_FIELD_NAME
           
static java.lang.String REFERENCE_AUTN_FIELD_NAME
           
static java.lang.String SECTION_AUTN_FIELD_NAME
           
static java.lang.String SUMMARY_AUTN_FIELD_NAME
           
static java.lang.String TITLE_AUTN_FIELD_NAME
           
static java.lang.String URL_AUTN_FIELD_NAME
           
static java.lang.String WEIGHT_AUTN_FIELD_NAME
           
 
Constructor Summary
ResultDocument()
          Create a ResultDocument with no properties set.
ResultDocument(java.lang.String sDocRef)
          Create a ResultDocument with the given document reference.
 
Method Summary
 void addAutnField(java.lang.String sFieldName, java.lang.String sFieldValue)
          Add an AutnField for this document.
 void addContentField(java.lang.String sFieldName, java.lang.String sFieldValue)
          Add a content field for this document.
 void addLink(java.lang.String sLink)
          Add a link or matching term to the ones already set for this result.
 void clearAutnFields()
          Remove all AutnFields for this document.
 void clearContentFields()
          Remove all content fields for this document.
 void clearLinks()
          Removes all links set for this result document.
 java.util.HashMap getAutnFields()
          Gives a mapping between all the document's AutnFields and their values.
 java.lang.String getAutnFieldValue(java.lang.String sFieldName)
          Read the value of a given document's AutnField.
 java.lang.String getAutnFieldValue(java.lang.String sFieldName, java.lang.String sDefaultValue)
          Read the value of a given document's AutnField.
 java.util.HashMap getContentFields()
          Gives a mapping between all the document's content fields and their values.
 java.lang.String getContentFieldValue(java.lang.String sFieldName)
          Read the value of a given document's content field.
 java.lang.String getContentFieldValue(java.lang.String sFieldName, java.lang.String sDefaultValue)
          Read the value of a given document's content field.
 java.lang.String getDatabase()
          Read database in which this document is stored (the value of its autn:database property).
 java.lang.String getDocReference()
          Read the reference for this document (the value of its autn:reference property).
 java.util.ArrayList getLinks()
          Read the weight or relevence of this document with respect to the query that generated the response containing this document.
 java.lang.String getSummary()
          Read the summary of this document as given by the 'autn:summary' element.
 java.lang.String getTitle()
          Read the title for this document (the value of its autn:title property).
 float getWeight()
          Read the weight or relevence of this document with respect to the query that generated the response containing this document.
 void removeAutnField(java.lang.String sFieldName)
          Remove an AutnField for this document.
 void removeContentField(java.lang.String sFieldName)
          Remove a content field for this document.
 void removeLink(java.lang.String sLink)
          Remove a link or matching term from the links set for this result.
 void setAutnFields(java.util.Map autnFieldsMap)
          Set all the AutnFields for this document.
 void setContentFields(java.util.Map contentFieldsMap)
          Set all the content fields for this document.
 void setDatabase(java.lang.String sDatabase)
          Set the database this document is stored in.
 void setDocReference(java.lang.String sDocRef)
          Set the unique reference for this document.
 void setLinks(java.util.ArrayList alLinks)
          Set the links or matching terms for this result.
 void setSummary(java.lang.String sSummary)
          Set the value of the summary generated at query time.
 void setTitle(java.lang.String sTitle)
          Set the title of this document.
 void setWeight(float fWeight)
          Set the value of this document's weight or relevence vis-a-vis the query that generated it.
 java.lang.String toString()
          Creates a string detailing all this document's properties.
 
Methods inherited from class com.autonomy.aci.businessobjects.Document
equals
 
Methods inherited from class com.autonomy.aci.businessobjects.AciBusinessObject
getUID, setUID
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REFERENCE_AUTN_FIELD_NAME

public static final java.lang.String REFERENCE_AUTN_FIELD_NAME
See Also:
Constant Field Values

URL_AUTN_FIELD_NAME

public static final java.lang.String URL_AUTN_FIELD_NAME
See Also:
Constant Field Values

ID_AUTN_FIELD_NAME

public static final java.lang.String ID_AUTN_FIELD_NAME
See Also:
Constant Field Values

SECTION_AUTN_FIELD_NAME

public static final java.lang.String SECTION_AUTN_FIELD_NAME
See Also:
Constant Field Values

WEIGHT_AUTN_FIELD_NAME

public static final java.lang.String WEIGHT_AUTN_FIELD_NAME
See Also:
Constant Field Values

LINKS_AUTN_FIELD_NAME

public static final java.lang.String LINKS_AUTN_FIELD_NAME
See Also:
Constant Field Values

DATABASE_AUTN_FIELD_NAME

public static final java.lang.String DATABASE_AUTN_FIELD_NAME
See Also:
Constant Field Values

TITLE_AUTN_FIELD_NAME

public static final java.lang.String TITLE_AUTN_FIELD_NAME
See Also:
Constant Field Values

SUMMARY_AUTN_FIELD_NAME

public static final java.lang.String SUMMARY_AUTN_FIELD_NAME
See Also:
Constant Field Values

CONTENT_AUTN_FIELD_NAME

public static final java.lang.String CONTENT_AUTN_FIELD_NAME
See Also:
Constant Field Values
Constructor Detail

ResultDocument

public ResultDocument()
Create a ResultDocument with no properties set.


ResultDocument

public ResultDocument(java.lang.String sDocRef)
Create a ResultDocument with the given document reference.

Parameters:
sDocRef - the reference by which the document is uniquely identified within IDOL (the value of its DREREFERENCE or autn:reference).
Method Detail

setDocReference

public void setDocReference(java.lang.String sDocRef)
Set the unique reference for this document.

Overrides:
setDocReference in class Document
Parameters:
sDocRef - the document's reference. Must not be null.

setTitle

public void setTitle(java.lang.String sTitle)
Set the title of this document.

Overrides:
setTitle in class Document
Parameters:
sTitle - the document title. Must not be null.

setDatabase

public void setDatabase(java.lang.String sDatabase)
Set the database this document is stored in.

Overrides:
setDatabase in class Document
Parameters:
sDatabase - the document's database. Must not be null.

setWeight

public void setWeight(float fWeight)
Set the value of this document's weight or relevence vis-a-vis the query that generated it.

Parameters:
fWeight - the weight of the document. This must be greater than or equal to 0.

setLinks

public void setLinks(java.util.ArrayList alLinks)
Set the links or matching terms for this result.

Parameters:
alLinks - an ArrayList of Strings giving the result document links.

addLink

public void addLink(java.lang.String sLink)
Add a link or matching term to the ones already set for this result.

Parameters:
sLink - the result document link to add.

removeLink

public void removeLink(java.lang.String sLink)
Remove a link or matching term from the links set for this result.

Parameters:
sLink - the result document link to remove.

clearLinks

public void clearLinks()
Removes all links set for this result document.


setSummary

public void setSummary(java.lang.String sSummary)
Set the value of the summary generated at query time.

Parameters:
sSummary - the query-time generated summary.

getDocReference

public java.lang.String getDocReference()
Read the reference for this document (the value of its autn:reference property).

Overrides:
getDocReference in class Document

getTitle

public java.lang.String getTitle()
Read the title for this document (the value of its autn:title property).

Overrides:
getTitle in class Document

getDatabase

public java.lang.String getDatabase()
Read database in which this document is stored (the value of its autn:database property).

Overrides:
getDatabase in class Document

setContentFields

public void setContentFields(java.util.Map contentFieldsMap)
Set all the content fields for this document. Content fields are those contained within the autn:content element of the document hit.

Parameters:
contentFieldsMap - a mapping between all the documents content fields and their values.

addContentField

public void addContentField(java.lang.String sFieldName,
                            java.lang.String sFieldValue)
Add a content field for this document. Content fields are those contained within the autn:content element of the document hit.

Parameters:
sFieldName - the name of this content field.
sFieldValue - the name of this content field.

removeContentField

public void removeContentField(java.lang.String sFieldName)
Remove a content field for this document. Content fields are those contained within the autn:content element of the document hit.

Parameters:
sFieldName - the name of the content field to remove.

clearContentFields

public void clearContentFields()
Remove all content fields for this document. Content fields are those contained within the autn:content element of the document hit.


setAutnFields

public void setAutnFields(java.util.Map autnFieldsMap)
Set all the AutnFields for this document. AutnFields are all those elements contained within the autn:hit element of the document that contain CDATA.

Parameters:
autnFieldsMap - a mapping between all the documents AutnFields and their values.

addAutnField

public void addAutnField(java.lang.String sFieldName,
                         java.lang.String sFieldValue)
Add an AutnField for this document. AutnField are all those elements contained within the autn:hit element of the document that contain CDATA.

Parameters:
sFieldName - the name of this AutnField.
sFieldValue - the name of this AutnField.

removeAutnField

public void removeAutnField(java.lang.String sFieldName)
Remove an AutnField for this document. AutnField are all those elements contained within the autn:hit element of the document that contain CDATA.

Parameters:
sFieldName - the name of the content field to remove.

clearAutnFields

public void clearAutnFields()
Remove all AutnFields for this document. AutnField are all those elements contained within the autn:hit element of the document that contain CDATA.


getWeight

public float getWeight()
Read the weight or relevence of this document with respect to the query that generated the response containing this document.

Returns:
the weight of the document.

getLinks

public java.util.ArrayList getLinks()
Read the weight or relevence of this document with respect to the query that generated the response containing this document.


getSummary

public java.lang.String getSummary()
Read the summary of this document as given by the 'autn:summary' element.

Returns:
the summary of the document.

getContentFields

public java.util.HashMap getContentFields()
Gives a mapping between all the document's content fields and their values.

Returns:
a map containing all the document's content fields and their values as Strings.

getContentFieldValue

public java.lang.String getContentFieldValue(java.lang.String sFieldName,
                                             java.lang.String sDefaultValue)
Read the value of a given document's content field.

Parameters:
sFieldName - the name of the content field.
sDefaultValue - the value to return if the field does not exist for this document or has no value set.
Returns:
the value of the given field or the default value if the field does not exist or is empty.

getContentFieldValue

public java.lang.String getContentFieldValue(java.lang.String sFieldName)
Read the value of a given document's content field.

Parameters:
sFieldName - the name of the content field.
Returns:
the value of the given field or null if the field does not exist or is empty.

getAutnFields

public java.util.HashMap getAutnFields()
Gives a mapping between all the document's AutnFields and their values.

Returns:
a map containing all the document's AutnFields and their values as Strings.

getAutnFieldValue

public java.lang.String getAutnFieldValue(java.lang.String sFieldName,
                                          java.lang.String sDefaultValue)
Read the value of a given document's AutnField.

Parameters:
sFieldName - the name of the AutnField.
sDefaultValue - the value to return if the field does not exist for this document or has no value set.
Returns:
the value of the given field or the default value if the field does not exist or is empty.

getAutnFieldValue

public java.lang.String getAutnFieldValue(java.lang.String sFieldName)
Read the value of a given document's AutnField.

Parameters:
sFieldName - the name of the AutnField.
Returns:
the value of the given field or null if the field does not exist or is empty.

toString

public java.lang.String toString()
Creates a string detailing all this document's properties.

Overrides:
toString in class Document