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(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
|
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
|
String |
getClusterType()
Each object belongs to a specific type defined in
ClusterStorage |
String |
getData() |
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) |
NodeList |
getNodesByXPath(String xpathExpr) |
String |
getSchemaType()
Deprecated.
|
int |
getSchemaVersion()
Deprecated.
|
static Document |
parse(String xml)
Parses the outcome into a DOM tree
|
Node |
removeNodeByXPath(String xpathExpr) |
static String |
serialize(Document doc,
boolean prettyPrint) |
void |
setData(String xml) |
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) |
void |
setName(String name)
Sets the name of the C2KLocalObject
|
String |
validate()
Validates the actual XML Document against the provided Schema
|
void |
validateAndCheck()
Validates the actual XML Document against the provided Schema
|
public 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,
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 numberprotected void setMetaDataFromPath(String path) throws PersistencyException, InvalidDataException
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 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 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()
@Deprecated public String getSchemaType()
@Deprecated public int getSchemaVersion()
public String getClusterType()
C2KLocalObjectClusterStoragegetClusterType in interface C2KLocalObjectpublic String getClusterPath()
C2KLocalObjectgetClusterPath in interface C2KLocalObjectpublic static Document parse(String xml) throws SAXException, IOException
xml - string to be parsedSAXException - error parsing documentIOException - any IO errors occurpublic 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(String name)
name - The name of the Elementpublic NodeList getNodesByXPath(String xpathExpr) throws XPathExpressionException
XPathExpressionExceptionpublic Node getNodeByXPath(String xpathExpr) throws XPathExpressionException
XPathExpressionExceptionpublic Node removeNodeByXPath(String xpathExpr) throws XPathExpressionException, InvalidDataException
public static String serialize(Document doc, boolean prettyPrint) throws InvalidDataException
InvalidDataExceptionCopyright © 1997–2017 CRISTAL-iSE. All rights reserved.