public class ResultElementGeneric extends ResultElementBase
ResultSet
payload partsModifier and Type | Field and Description |
---|---|
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 and Description |
---|
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 |
Modifier and Type | Method and Description |
---|---|
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.
|
getRecordAttributes, getRecordAttributes, isValid, RS_fromXML, RS_toXML, setRecordAttributes
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
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 recordjava.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.0id
- 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 recordjava.lang.Exception
- The ResultElementGeneric
could not be createdpublic 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 fromjava.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 retrievedpublic 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 payloadelement1
- One of the ResultElementGeneric
that must be mergedelement2
- One of the ResultElementGeneric
that must be mergedResultElementGeneric
java.lang.Exception
- The merge operation could not be performed