public class ResultElementGeneric extends ResultElementBase
ResultSet payload parts| Modifier and Type | Field and Description |
|---|---|
static String |
RECORD_COLLECTION_NAME
The name of the collection attribute holding the collection value
|
static String |
RECORD_ID_NAME
The name of the id attribute holding the identifier value
|
static 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(String id,
String collection,
String payload)
Creates a new
ResultElementGeneric. |
ResultElementGeneric(String id,
String collection,
String rank,
String payload)
Creates a new
ResultElementGeneric |
| Modifier and Type | Method and Description |
|---|---|
static String |
extractValue(ResultElementGeneric element,
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(String xml)
This method must be able to reconstruct the result elelement from a xml string as returned
by
ResultElementBase.toXML() |
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 |
String |
toXML()
This method must return a valid xml serialization of the result record payload.
|
getRecordAttributes, getRecordAttributes, isValid, RS_fromXML, RS_toXML, setRecordAttributespublic static final String RECORD_ID_NAME
public static final String RECORD_COLLECTION_NAME
public static final String RECORD_RANK_NAME
public ResultElementGeneric()
public ResultElementGeneric(String id, String collection, String rank, String payload) throws Exception
ResultElementGenericid - 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 recordException - The ResultElementGeneric could not be createdpublic ResultElementGeneric(String id, String collection, String payload) throws 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 recordException - The ResultElementGeneric could not be createdpublic String getPayload()
public String toXML() throws Exception
ResultElementBasetoXML in class ResultElementBaseException - An unrecoverable for the operation error occuredResultElementBase.toXML()public void fromXML(String xml) throws Exception
ResultElementBaseResultElementBase.toXML()fromXML in class ResultElementBasexml - The serialized string to populate the insance fromException - An unrecoverable for the operation error occuredResultElementBase.fromXML(java.lang.String)public static String extractValue(ResultElementGeneric element, 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 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 mergedResultElementGenericException - The merge operation could not be performedCopyright © 2020. All Rights Reserved.