public class Outcome extends Object implements C2KLocalObject
| Constructor and Description |
|---|
Outcome(int id,
Document dom,
Schema schema)
Very basic constructor to set all members
|
Outcome(int id,
String xml,
Schema schema)
Use this constructor to manipulate, validate and store this outcome
|
Outcome(int id,
String xml,
String schemaName,
Integer schemaVersion) |
Outcome(String xml)
Use this constructor for XML manipulation only.
|
Outcome(String path,
Document data)
The constructor derives all the meta data (ID and Schema) from the path
|
Outcome(String xml,
Schema schema)
Use this constructor for XML manipulation and validation.
|
Outcome(String path,
String xml)
The constructor derives all the meta data (ID and Schema) from the path
|
| Modifier and Type | Method and Description |
|---|---|
Node |
appendXmlFragment(String xpath,
String xmlFragment)
Append the new Node created from xmlFragment as a child of the Node selected by the XPath
|
Object |
evaluateXpath(String xpathExpr,
QName returnType)
Evaluates the given XPath expression thread-safely and efficiently
|
List<Map<String,String>> |
getAllRecords(String xpath)
Reads all Attributes and child Elements of the list of Node selected by the xpath
|
List<List<String>> |
getAllRecords(String xpath,
List<String> names)
Reads list of list of values of the Attributes and child Elements of the list of Elements selected by the xpath.
|
String |
getAttribute(Element element,
String name)
Retrieves an Attribute value by name of the given Element.
|
String |
getAttribute(String name)
Retrieves an Attribute value by name of the root Element.
|
String |
getAttributeOfField(String field,
String attribute)
Retrieves an Attribute value by name from the named Element.
|
String |
getClusterPath()
Each C2KLocalObject is stored with a path identifier starting with the ClusterType:
Properties: /Property/Name
Workflow: /LifeCycle/workflow
Collections: /Collection/Name/Version (default Name='last')
Outcomes: /Outcome/SchemaName/SchemaVersion/EventID
Viewpoints: /ViewPoint/SchemaName/Name (default Name='last')
Events: /AuditTrail/EventID
Jobs: /Job/JobID
|
ClusterType |
getClusterType()
Returns
ClusterType.OUTCOME |
String |
getData()
Returns the serialised DOM as a string
|
String |
getField(Element element,
String name)
Retrieves the textNode value of the named Element of the given Element.
|
String |
getField(String name)
Retrieves the textNode value of the named Element of the root Element.
|
String |
getFieldByXPath(String xpath)
Retrieves the text, CDATA or attribute value of the Node selected by the XPath
|
String |
getName()
Gets the name of the C2KLocalObject
|
Node |
getNodeByXPath(String xpathExpr)
Gets a List selected by the xpath
|
NodeList |
getNodesByXPath(String xpathExpr)
Gets a NodeList selected by the xpath
|
String |
getNodeValue(Node node)
Gets the value of the given TEXT, CDATA, ATTRIBUTE or ELEMENT Node
|
Map<String,String> |
getRecord()
Reads the all Attributes and child Elements of the root Element
|
List<String> |
getRecord(List<String> names)
Reads list of values of the Attributes and child Elements of the root Element.
|
Map<String,String> |
getRecord(String xpath)
Reads the all Attributes and child Elements of the Node selected by the xpath
|
List<String> |
getRecord(String xpath,
List<String> names)
Reads list of values of the Attributes and child Elements of the Element selected by the xpath.
|
List<String> |
getRecordOfElement(Element element,
List<String> names)
Reads list of values of the Attributes and child Elements of the given Element.
|
Map<String,String> |
getRecordOfNode(Node node)
Reads the all Attributes and child Elements of the given Node
|
Schema |
getSchema()
Gets the Schema object associated with the Outcome
|
Schema |
getSchema(TransactionKey transactionKey)
Gets the Schema object associated with the Outcome
|
String |
getSchemaName()
Gets the name or UUID of the Schema item associated with the Outcome
|
String |
getSchemaType()
Deprecated.
use
getSchemaName() instead |
int |
getSchemaVersion()
Gets the version of the Schema item associated with the Outcome
|
boolean |
hasField(Element element,
String name) |
boolean |
hasField(String name) |
static boolean |
isIdentical(Document origDocument,
Document otherDOM)
Utility method to comare 2 XML Documents
|
boolean |
isIdentical(Outcome other)
Checks if the Outcome is identical with the given input
|
static Document |
newDocument() |
static Document |
parse(InputSource xml)
Parses the input source into a DOM tree.
|
static Document |
parse(String xml)
Parses the xml string into a DOM tree
|
Node |
removeNodeByXPath(String xpathExpr)
Removes the node selected by the xpath
|
static String |
serialize(Node node,
boolean prettyPrint)
Serialize the Given Document
|
void |
setAttribute(Element element,
String name,
String data)
Sets an Attribute value by name of the given Element.
|
void |
setAttribute(Element element,
String name,
String data,
boolean remove)
Sets an Attribute value by name of the given Element.
|
void |
setAttribute(String name,
String data)
Sets an Attribute value by name of the root Element.
|
void |
setAttribute(String name,
String data,
boolean remove)
Sets the value of an attribute in the root Element.
|
void |
setAttributeOfField(String field,
String name,
String data)
Sets the value of an attribute in a given Field, i.e.
|
void |
setAttributeOfField(String field,
String name,
String data,
boolean remove)
Sets the value of an attribute in a given Field, i.e.
|
void |
setData(String xml) |
void |
setField(Element element,
String name,
String data)
Sets the textNode value of the named Element of the given Element.
|
void |
setField(Element element,
String name,
String data,
boolean remove)
Sets the textNode value of the named Element of the given Element.
|
void |
setField(String name,
String data)
Sets the textNode value of the named Element of the root Element.
|
void |
setField(String name,
String data,
boolean remove)
Sets the textNode value of the named Element of the root Element.
|
void |
setFieldByXPath(String xpath,
String data)
Sets the text, CDATA or attribute value of the Node selected by the XPath.
|
void |
setFieldByXPath(String xpath,
String data,
boolean remove)
Sets the text, CDATA or attribute value of the Node selected by the XPath.
|
protected void |
setMetaDataFromPath(String path)
Retrieves the SchemaName, Version, EevetnId triplet from the path.
|
void |
setName(String name)
Sets the name of the C2KLocalObject
|
void |
setNodeValue(Node node,
String value)
Sets the value of the given TEXT, CDATA, ATTRIBUTE or ELEMENT Node
|
void |
setNodeValue(Node node,
String value,
boolean useCdata)
Sets the value of the given TEXT, CDATA, ATTRIBUTE or ELEMENT Node
|
void |
setRecord(Element element,
Map<String,String> record)
Sets the values of Attributes and child Element of given Element.
|
void |
setRecord(Map<String,String> record)
Sets the values of Attributes and child Element of the root Element.
|
void |
setRecord(String xpath,
Map<String,String> record)
Sets the values of Attributes and child Element of the Element selected by xpath.
|
String |
validate()
Validates the actual XML Document against the provided Schema
|
void |
validateAndCheck()
Validates the actual XML Document against the provided Schema
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitenforceValidNamepublic Outcome(String xml) throws InvalidDataException
xml - the XML string to be manipulatedInvalidDataException - there was an error parsing the XMLpublic Outcome(String xml, Schema schema) throws InvalidDataException
xml - the XML string to be manipulatedschema - the Schema of the XMLInvalidDataException - there was an error parsing the XMLpublic Outcome(int id,
String xml,
String schemaName,
Integer schemaVersion)
throws InvalidDataException
InvalidDataExceptionpublic Outcome(int id,
String xml,
Schema schema)
throws InvalidDataException
id - eventIDxml - the XML string to be manipulatedschema - the Schema of the XMLInvalidDataException - there was an error parsing the XMLpublic Outcome(int id,
Document dom,
Schema schema)
id - eventIDdom - parsed XML Documentschema - the Schema instancepublic Outcome(String path, String xml) throws PersistencyException, InvalidDataException
path - the actuals path used by the ClusterStoragexml - the XML string to parsePersistencyException - there was DB errorInvalidDataException - Version or EventID was an invalid numberpublic Outcome(String path, Document data) throws PersistencyException, InvalidDataException
path - the actuals path used by the ClusterStoragedata - the parsed xml DocumentPersistencyException - there was DB errorInvalidDataException - Version or EventID was an invalid numberpublic Schema getSchema()
public Schema getSchema(TransactionKey transactionKey)
transactionKey - the key of the transactionprotected void setMetaDataFromPath(String path) throws PersistencyException, InvalidDataException
path - the ClusterPath to work withPersistencyException - path was incorrectInvalidDataException - Schema was not found or the Path has incorrect datapublic Object evaluateXpath(String xpathExpr, QName returnType) throws XPathExpressionException
xpathExpr - the XPath exporessionXPathExpressionException - If expression cannot be compiled.public String validate() throws InvalidDataException
InvalidDataException - Schema was nullpublic void validateAndCheck()
throws InvalidDataException
InvalidDataException - XML document is not valid instance of the Schemapublic void setName(String name)
C2KLocalObjectsetName in interface C2KLocalObjectname - Name of the C2KLocalObjectpublic String getName()
C2KLocalObjectgetName in interface C2KLocalObjectpublic void setData(String xml) throws SAXException, IOException
SAXExceptionIOExceptionpublic String getNodeValue(Node node) throws InvalidDataException
node - the Node to work onInvalidDataException - the Node is not a proper typepublic void setNodeValue(Node node, String value) throws InvalidDataException
node - the Node to work onvalue - the value to setInvalidDataException - the Node is not a proper typepublic void setNodeValue(Node node, String value, boolean useCdata) throws InvalidDataException
node - the Node to work onvalue - the value to setuseCdata - force to use CDATAInvalidDataException - the Node is not a proper typepublic String getFieldByXPath(String xpath) throws XPathExpressionException, InvalidDataException
xpath - The path to access the selected NodeXPathExpressionException - xpath was not valid (e.g. there is no such node)InvalidDataException - xpath result is not text, CDATA or attributepublic void setAttribute(Element element, String name, String data, boolean remove) throws InvalidDataException
element - the Element to searchname - the name of the Attributedata - the value to setremove - flag to remove existing node when data is nullInvalidDataException - the attribute was not foundpublic void setAttribute(Element element, String name, String data) throws InvalidDataException
element - the Element to searchname - the name of the Attributedata - the value to setInvalidDataException - the Attribute was not foundpublic void setAttribute(String name, String data, boolean remove) throws InvalidDataException
name - the name of the Attributedata - the value to be setremove - flag to remove the element if the data is nullInvalidDataException - attribute was not foundpublic void setAttribute(String name, String data) throws InvalidDataException
name - the name of the Attributedata - the value to setInvalidDataException - the name was not foundpublic void setAttributeOfField(String field, String name, String data, boolean remove) throws InvalidDataException
field - the named Element in the root Elementname - the name of the Attributedata - the value to be setremove - flag to remove the element if the data is nullInvalidDataException - Element or attribute was not foundpublic void setAttributeOfField(String field, String name, String data) throws InvalidDataException
field - the named Element in the root Elementname - the name of the Attributedata - the value to be setInvalidDataException - Element or attribute was not foundpublic void setField(Element element, String name, String data, boolean remove) throws InvalidDataException
element - Element to usename - the name of the Elementdata - the data to be setremove - flag to remove the element if the data is nullInvalidDataException - the name was not found or there were more Elements with the given namepublic void setField(Element element, String name, String data) throws InvalidDataException
element - Element to usename - the name of the Elementdata - the data to be setInvalidDataException - the name was not found or there were more Elements with the given namepublic void setField(String name, String data, boolean remove) throws InvalidDataException
name - the name of the Elementdata - the data to be setremove - flag to remove the element if the data is nullInvalidDataException - the name was not found or there were more Elements with the given namepublic void setField(String name, String data) throws InvalidDataException
name - the name of the Elementdata - the data to be setInvalidDataException - the name was not found or there were more Elements with the given namepublic void setFieldByXPath(String xpath, String data) throws XPathExpressionException, InvalidDataException
xpath - the selected Node to be updateddata - string containing the dataXPathExpressionException - xpath is invalidInvalidDataException - xpath result is not text, CDATA or attributepublic void setFieldByXPath(String xpath, String data, boolean remove) throws XPathExpressionException, InvalidDataException
xpath - the selected Node to be updateddata - string containing the data, it can be nullremove - flag to remove existing node when data is nullXPathExpressionException - xpath is invalidInvalidDataException - xpath result is not text, CDATA or attributepublic Node appendXmlFragment(String xpath, String xmlFragment) throws InvalidDataException
xpath - the selected parent nodexmlFragment - string containing the xml fragmentInvalidDataExceptionpublic String getData()
public String getSchemaName()
public String getSchemaType()
getSchemaName() insteadpublic int getSchemaVersion()
public ClusterType getClusterType()
ClusterType.OUTCOMEgetClusterType in interface C2KLocalObjectpublic String getClusterPath()
C2KLocalObjectgetClusterPath in interface C2KLocalObjectpublic static Document newDocument() throws SAXException, IOException
SAXExceptionIOExceptionpublic static Document parse(String xml) throws SAXException, IOException
xml - string to be parsed, can be null. When xml is null it creates empty Document.SAXException - error parsing documentIOException - any IO errors occurpublic static Document parse(InputSource xml) throws SAXException, IOException
xml - string to be parsed, can be null.SAXException - error parsing documentIOException - any IO errors occurpublic String getAttribute(Element element, String name)
element - the Element to queryname - The name of the attribute to retrieve.public String getAttribute(String name)
name - The name of the attribute to retrieve.public String getAttributeOfField(String field, String attribute)
field - The name of the field.attribute - The name of the attribute to retrieve.public String getField(Element element, String name)
element - the Element to queryname - The name of the Elementpublic String getField(String name)
name - The name of the Elementpublic NodeList getNodesByXPath(String xpathExpr) throws XPathExpressionException
xpathExpr - the xpath to select the list of NodesXPathExpressionException - invalid xpathpublic Node getNodeByXPath(String xpathExpr) throws XPathExpressionException
xpathExpr - the xpath to select the list of NodesXPathExpressionException - invalid xpathpublic Node removeNodeByXPath(String xpathExpr) throws XPathExpressionException, InvalidDataException
xpathExpr - xpath to select the NodeXPathExpressionException - invalid xpathInvalidDataException - invalid xpathpublic static String serialize(Node node, boolean prettyPrint) throws InvalidDataException
doc - document to be serializedprettyPrint - if the xml is pretty printed or notInvalidDataException - Transformer Exceptionpublic Map<String,String> getRecordOfNode(Node node)
node - the node to work withpublic Map<String,String> getRecord()
public Map<String,String> getRecord(String xpath) throws XPathExpressionException
xpath - the xpath pointing to the NodeXPathExpressionException - xpath is invalidpublic List<Map<String,String>> getAllRecords(String xpath) throws XPathExpressionException
xpath - selecting the list of NodesXPathExpressionException - xpath is invalidpublic List<String> getRecordOfElement(Element element, List<String> names)
element - the Element to usenames - the the Attributes and Element names to retrievepublic List<String> getRecord(List<String> names)
names - the the Attributes and Element names to retrievepublic List<String> getRecord(String xpath, List<String> names) throws XPathExpressionException
xpath - to select the Elementnames - the the Attributes and Element names to retrieveXPathExpressionException - invalid xpathpublic List<List<String>> getAllRecords(String xpath, List<String> names) throws XPathExpressionException
xpath - to select the list of Elementnames - the the Attributes and Element names to retrieveXPathExpressionException - invalid xpathpublic void setRecord(Map<String,String> record) throws InvalidDataException
record - Map with a key/value pairs to find the fields or attributes to updateInvalidDataException - the name in the map was invalidpublic void setRecord(String xpath, Map<String,String> record) throws InvalidDataException, XPathExpressionException
xpath - apth to the Element to be updatedrecord - Map with a key/value pairs to find the fields or attributes to updateInvalidDataException - the name in the map was invalidXPathExpressionException - the xpath was invalidpublic void setRecord(Element element, Map<String,String> record) throws InvalidDataException
element - the element to be updatedrecord - Map with a key/value pairs to find the fields or attributes to updateInvalidDataException - the name in the map was invalidpublic boolean isIdentical(Outcome other)
other - the other Outcome to be compare withpublic static boolean isIdentical(Document origDocument, Document otherDOM)
origDocument - XML documentotherDOM - the other XMLpublic boolean hasField(String name)
Copyright © 1997–2022 CRISTAL-iSE. All rights reserved.