|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementBase
org.gcube.common.searchservice.searchlibrary.resultset.elements.ResultElementGeneric
public class ResultElementGeneric
This class acts as a generic placeholder for the records that can be inserted and extracted from the
ResultSet
payload parts
Field Summary | |
---|---|
static java.lang.String |
RECORD_COLLECTION_NAME
The name of the collection attribute holding the collection value |
static java.lang.String |
RECORD_ID_NAME
The name of the id attribute holding the identifier value |
static java.lang.String |
RECORD_RANK_NAME
The name of the rank attribute holding the record ranking |
Constructor Summary | |
---|---|
ResultElementGeneric()
Default contructor nessecary for the framework |
|
ResultElementGeneric(java.lang.String id,
java.lang.String collection,
java.lang.String payload)
Creates a new ResultElementGeneric . |
|
ResultElementGeneric(java.lang.String id,
java.lang.String collection,
java.lang.String rank,
java.lang.String payload)
Creates a new ResultElementGeneric |
Method Summary | |
---|---|
static java.lang.String |
extractValue(ResultElementGeneric element,
java.lang.String which)
This method receives a ResultElementGeneric and an expression in the form of
element/element/element and traverses the payload expecting to find at every
level it moves a child element with the name as provided, in the respective level, in the
which parameter. |
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.String |
getPayload()
Retrieves the payload |
static ResultElementGeneric |
merge(ResultElementGeneric element1,
ResultElementGeneric element2)
Merges the two provided ResultElementGeneric into a new one which has as the id the id of element1,
and as payload the concatenation of the two elements payload |
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.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 |
---|
public static final java.lang.String RECORD_ID_NAME
public static final java.lang.String RECORD_COLLECTION_NAME
public static final java.lang.String RECORD_RANK_NAME
Constructor Detail |
---|
public ResultElementGeneric()
public ResultElementGeneric(java.lang.String id, java.lang.String collection, java.lang.String rank, java.lang.String payload) throws java.lang.Exception
ResultElementGeneric
id
- The value of the id. This cannot be null or an empty stringcollection
- The collection this id belongs to. This cannot be null or an empty stringrank
- The rank this id got. This cannot be null or an empty stringpayload
- The payload of the record
java.lang.Exception
- The ResultElementGeneric
could not be createdpublic ResultElementGeneric(java.lang.String id, java.lang.String collection, java.lang.String payload) throws java.lang.Exception
ResultElementGeneric
. The rank attribute is set to 1.0
id
- The value of the id. This cannot be null or an empty stringcollection
- The collection this id belongs to. This cannot be null or an empty stringpayload
- The payload of the record
java.lang.Exception
- The ResultElementGeneric
could not be createdMethod Detail |
---|
public java.lang.String getPayload()
public java.lang.String toXML() throws java.lang.Exception
ResultElementBase
toXML
in class ResultElementBase
java.lang.Exception
- An unrecoverable for the operation error occuredResultElementBase.toXML()
public void fromXML(java.lang.String xml) throws java.lang.Exception
ResultElementBase
ResultElementBase.toXML()
fromXML
in class ResultElementBase
xml
- The serialized string to populate the insance from
java.lang.Exception
- An unrecoverable for the operation error occuredResultElementBase.fromXML(java.lang.String)
public static java.lang.String extractValue(ResultElementGeneric element, java.lang.String which)
ResultElementGeneric
and an expression in the form of
element/element/element
and traverses the payload expecting to find at every
level it moves a child element with the name as provided, in the respective level, in the
which
parameter. It then retrieves and returns the content of the first child element
with the name of the last element in the which
argument. If the which argument
is one of RECORD_COLLECTION_NAME
, RECORD_ID_NAME
,
RECORD_RANK_NAME
, the first value of the attribute whith the respective type is retrieved
If the expression beggins with //
the first element in the entire record document that is
named as the provided expression will be returned.
element
- The element to scan throughwhich
- a path to the element whose contents must be retrieved
public static ResultElementGeneric merge(ResultElementGeneric element1, ResultElementGeneric element2) throws java.lang.Exception
ResultElementGeneric
into a new one which has as the id the id of element1,
and as payload the concatenation of the two elements payload
element1
- One of the ResultElementGeneric
that must be mergedelement2
- One of the ResultElementGeneric
that must be merged
ResultElementGeneric
java.lang.Exception
- The merge operation could not be performed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |