org.gcube.common.searchservice.searchlibrary.resultset.elements
Class ResultElementBean

java.lang.Object
  extended by org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase
      extended by org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementGeneric
          extended by org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBean

public class ResultElementBean
extends ResultElementGeneric

This class acts as a generic placeholder for the records that can be inserted and extracted from the ResultSet payload parts treating the payload as a java bean object.

Author:
UoA

Field Summary
static java.lang.String RECORD_BEAN_NAME
          The name of the searialized bean
 
Fields inherited from class org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementGeneric
RECORD_COLLECTION_NAME, RECORD_ID_NAME, RECORD_RANK_NAME
 
Constructor Summary
ResultElementBean()
          Default contructor nessecary for the framework
ResultElementBean(java.lang.String id, java.lang.String collection, java.lang.Object bean)
          Constructs a new instance of this class
 
Method Summary
 void fromXML(java.lang.String xml)
          This method must be able to reconstruct the result elelement from a xml string as returned by ResultElementBase.toXML()
 java.lang.Object getBean()
          Retrieves the payload
 java.lang.String getBeanClassName()
          Retrieves the name of the bean class
 void setBean(java.lang.Object bean)
          Sets the bean to serialize
 java.lang.String toXML()
          This method must return a valid xml serialization of the result record payload.
 
Methods inherited from class org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementGeneric
extractValue, getPayload, merge
 
Methods inherited from class org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase
getRecordAttributes, getRecordAttributes, isValid, RS_fromXML, RS_toXML, setRecordAttributes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECORD_BEAN_NAME

public static java.lang.String RECORD_BEAN_NAME
The name of the searialized bean

Constructor Detail

ResultElementBean

public ResultElementBean()
Default contructor nessecary for the framework


ResultElementBean

public ResultElementBean(java.lang.String id,
                         java.lang.String collection,
                         java.lang.Object bean)
                  throws java.lang.Exception
Constructs a new instance of this class

Parameters:
id - The id of the record
collection - Teh collection this record belongs to
bean - The bean to serialize
Throws:
java.lang.Exception - An unrecoverable for the operaton error occured
Method Detail

setBean

public void setBean(java.lang.Object bean)
Sets the bean to serialize

Parameters:
bean - The bean

getBean

public java.lang.Object getBean()
Retrieves the payload

Returns:
The payload

getBeanClassName

public java.lang.String getBeanClassName()
                                  throws java.lang.Exception
Retrieves the name of the bean class

Returns:
The class name
Throws:
java.lang.Exception - An unrecoverable for the operaton error occured

toXML

public java.lang.String toXML()
                       throws java.lang.Exception
Description copied from class: ResultElementBase
This method must return a valid xml serialization of the result record payload.

Overrides:
toXML in class ResultElementGeneric
Returns:
The serialized record payload
Throws:
java.lang.Exception - An unrecoverable for the operation error occured
See Also:
ResultElementBase.toXML()

fromXML

public void fromXML(java.lang.String xml)
             throws java.lang.Exception
Description copied from class: ResultElementBase
This method must be able to reconstruct the result elelement from a xml string as returned by ResultElementBase.toXML()

Overrides:
fromXML in class ResultElementGeneric
Parameters:
xml - The serialized string to populate the insance from
Throws:
java.lang.Exception - An unrecoverable for the operation error occured
See Also:
ResultElementBase.fromXML(java.lang.String)