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

java.lang.Object
  extended by org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase
Direct Known Subclasses:
ResultElementBLOBBase, ResultElementGeneric

public abstract class ResultElementBase
extends java.lang.Object

This class is the base class that must be extended by anyone wishing to implement a custom Record element class. Every class extending this one must define an accessible default constructor with an empty argument list

Author:
UoA

Constructor Summary
ResultElementBase()
           
 
Method Summary
abstract  void fromXML(java.lang.String xml)
          This method must be able to reconstruct the result elelement from a xml string as returned by toXML()
 RecordAttribute[] getRecordAttributes()
          Retrieves the Attributs of the recors
 RecordAttribute[] getRecordAttributes(java.lang.String attrName)
          Retrieveds the record Attributes with the given attribute name
static boolean isValid(java.lang.String xml)
          This operations checkes if the provided xml string is a valid serialization of a record
 void RS_fromXML(java.lang.String xml)
          This operation is used to unmarshal a result element from a serialization string only if this is a valid result serialization as returned by RS_toXML().
 java.lang.String RS_toXML()
          This operation is used to retrieve the searialization of the provided record element checking if it is a valid serialization.
 void setRecordAttributes(RecordAttribute[] attrs)
          Sets the record Attributes
abstract  java.lang.String toXML()
          This method must return a valid xml serialization of the result record payload.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultElementBase

public ResultElementBase()
Method Detail

toXML

public abstract java.lang.String toXML()
                                throws java.lang.Exception
This method must return a valid xml serialization of the result record payload.

Returns:
The xml serialization
Throws:
java.lang.Exception - The extending element can specify the Exception that is thrown

fromXML

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

Parameters:
xml - The xml serialization
Throws:
java.lang.Exception - The elelement creation could not be performed

getRecordAttributes

public RecordAttribute[] getRecordAttributes()
Retrieves the Attributs of the recors

Returns:
The attributes

getRecordAttributes

public RecordAttribute[] getRecordAttributes(java.lang.String attrName)
Retrieveds the record Attributes with the given attribute name

Parameters:
attrName - The name of the attribute
Returns:
The attributes

setRecordAttributes

public void setRecordAttributes(RecordAttribute[] attrs)
Sets the record Attributes

Parameters:
attrs - The Attributes

RS_toXML

public final java.lang.String RS_toXML()
                                throws java.lang.Exception
This operation is used to retrieve the searialization of the provided record element checking if it is a valid serialization. It fills the serialization with the available attributes

Returns:
The record serialization if it is a valid one
Throws:
java.lang.Exception - The serialization is not a valid record serialization

RS_fromXML

public final void RS_fromXML(java.lang.String xml)
                      throws java.lang.Exception
This operation is used to unmarshal a result element from a serialization string only if this is a valid result serialization as returned by RS_toXML(). It also parses the availalbe atributes

Parameters:
xml - The xml string to be unmarshaled
Throws:
java.lang.Exception - The unmarshaling could not be performed

isValid

public static final boolean isValid(java.lang.String xml)
This operations checkes if the provided xml string is a valid serialization of a record

Parameters:
xml - The serialization that must be checked
Returns:
true if it is a valid serialization, false otherwise