Class ProcessModelXMLExport
java.lang.Object
de.aristaflow.adept2.model.processmodel.xml.ProcessModelXMLExport
The XMLExport class allows to export any template or instance data to an xml
file, an DOM document, a string or a byte array (containing XML code).
TODO Instance: export *histories elements in the histories-namespace?
- Author:
- Kevin Goeser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDocumentDataElementList(Set<DataElement> dataElements) Exports a set of data elements to a document.getDocumentForAdhocTemplateMapping(Map<UUID, UUID> mapping) Generates and returns aDocumentrepresenting the given adhoc template id mappinggetDocumentForBaseTemplateMapping(Map<UUID, UUID> mapping) Generates and returns aDocumentrepresenting the given base template id mappinggetDocumentForEmbeddedTemplateMapping(Map<UUID, UUID> mapping) Generates and returns aDocumentrepresenting the given embedded template id mappinggetDocumentForExecutableInstanceAndStatus(ExecutableInstance instance, InstanceStatus instanceStatus, boolean storeStructure) Writes the given instance including its status to the given file.getDocumentForInstance(Instance instance) Creates a DOM document from the instance.Generates and returns aDocumentfor the given instance locksgetDocumentForParameter(ProcessModelParameter parameter, boolean isInputParameter) TODO set namespace, schema location, check schema?getDocumentForParameterSet(Collection<ProcessModelParameter> parameter, boolean isInputParameter) TODO set namespace, schema location, check schema?Generates and returns aDocumentrepresenting the given ProcessTypesgetDocumentForTemplate(Template template) Creates a DOM document from the template.getDocumentForTemplateAndStatus(Template template, TemplateStatus templateStatus) Returns The corresponding document for a given template and a given template status.Generates and returns aDocumentrepresenting the given TemplateInformations.Generates and returns aDocumentfor the given template locksgetInputStreamForInstance(Instance instance) Returns The corresponding stream for a given instancegetInputStreamForInstance(Instance instance, boolean intend) Returns The corresponding stream for a given instancegetInputStreamForTemplate(Template template) Returns The corresponding stream for a given templategetInputStreamForTemplate(Template template, boolean intend) Returns The corresponding stream for a given templategetInputStreamForTemplateAndStatus(Template template, TemplateStatus templateStatus) Returns The corresponding stream for a given template and a given template status.getInputStreamForTemplateAndStatus(Template template, TemplateStatus templateStatus, boolean intend) Returns The corresponding stream for a given template and a given template status.getXMLStringForInstance(Instance instance) Returns the xml code of a given instance as string.getXMLStringForInstance(Instance instance, boolean intend) Returns the xml code of a given instance as string.getXMLStringForTemplate(Template template) Returns the xml code of a given template as string.getXMLStringForTemplate(Template template, boolean intend) Returns the xml code of a given template as string.voidwriteAdhocTemplateMappingToFile(Map<UUID, UUID> mapping, File file) Writes the given adhoc template id mapping to the specified file.voidwriteBaseTemplateMappingToFile(Map<UUID, UUID> mapping, File file) Writes the given base template id mapping to the specified file.voidwriteEmbeddedTemplateMappingToFile(Map<UUID, UUID> mapping, File file) Writes the given embedded template id mapping to the specified file.voidwriteExecutableInstanceAndStatusToFile(ExecutableInstance instance, InstanceStatus instanceStatus, File file) Writes the given instance including its status to the given file.voidwriteExecutableInstanceAndStatusToFile(ExecutableInstance instance, InstanceStatus instanceStatus, File file, boolean intend) Writes the given instance including its status to the given file.voidwriteExecutableInstanceAndStatusToFile(ExecutableInstance instance, InstanceStatus instanceStatus, File file, Template structure) Writes the given instance including its status to the given file.voidwriteExecutableInstanceAndStatusToFile(ExecutableInstance instance, InstanceStatus instanceStatus, File file, Template structure, boolean intend) Writes the given instance including its status to the given file.voidwriteInstanceAndStatusToFile(Instance instance, InstanceStatus instanceStatus, File file, boolean storeStructure) Writes the given instance including its status to the given file.voidwriteInstanceAndStatusToFile(Instance instance, InstanceStatus instanceStatus, File file, boolean storeStructure, boolean intend) Writes the given instance including its status to the given file.voidWrites the given instance locks to the specified file.voidwriteInstanceToFile(Instance instance, File file) Writes the given instance to the given file.voidwriteInstanceToFile(Instance instance, File file, boolean intend) Writes the given instance to the given file.voidWrites the given adhoc template id mapping to the specified file.voidwriteTemplateAndStatusToFile(Template template, TemplateStatus templateStatus, File file) Writes the given template including its status to the given file.voidwriteTemplateAndStatusToFile(Template template, TemplateStatus templateStatus, File file, boolean intend) Writes the given template including its status to the given file.voidwriteTemplateInformationsToFile(Map<UUID, ProcessModelXMLHelperTools.TemplateInformation> items, File file) Writes the given template informations to the specified file.voidWrites the given template locks to the specified file.voidwriteTemplateToFile(Template template, File file) Writes the given template to the given file.voidwriteTemplateToFile(Template template, File file, boolean intend) Writes the given template to the given file.
-
Constructor Details
-
ProcessModelXMLExport
public ProcessModelXMLExport()
-
-
Method Details
-
writeTemplateToFile
public void writeTemplateToFile(Template template, File file) throws IOException, XMLFormatException Writes the given template to the given file.- Parameters:
file- The target file,template- The source template,- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails
-
writeTemplateToFile
public void writeTemplateToFile(Template template, File file, boolean intend) throws IOException, XMLFormatException Writes the given template to the given file.- Parameters:
file- The target file,template- The source template,intend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails
-
writeTemplateAndStatusToFile
public void writeTemplateAndStatusToFile(Template template, TemplateStatus templateStatus, File file) throws IOException, XMLFormatException Writes the given template including its status to the given file.- Parameters:
file- The target file,template- The source template,templateStatus- The status of the template.- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails
-
writeTemplateAndStatusToFile
public void writeTemplateAndStatusToFile(Template template, TemplateStatus templateStatus, File file, boolean intend) throws IOException, XMLFormatException Writes the given template including its status to the given file.- Parameters:
file- The target file,template- The source template,templateStatus- The status of the template.intend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails
-
writeInstanceToFile
public void writeInstanceToFile(Instance instance, File file) throws IOException, XMLFormatException Writes the given instance to the given file.- Parameters:
file- The target file,instance- The source instance,- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails
-
writeInstanceToFile
public void writeInstanceToFile(Instance instance, File file, boolean intend) throws IOException, XMLFormatException Writes the given instance to the given file.- Parameters:
file- The target file,instance- The source instance,intend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails
-
writeInstanceAndStatusToFile
public void writeInstanceAndStatusToFile(Instance instance, InstanceStatus instanceStatus, File file, boolean storeStructure) throws IOException, XMLFormatException Writes the given instance including its status to the given file.- Parameters:
instance- The source instance,instanceStatus- The status object of the instancefile- The target file,storeStructure- If set to true, the structure is stored to the file, else, only an ID reference will be stored.- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails
-
writeInstanceAndStatusToFile
public void writeInstanceAndStatusToFile(Instance instance, InstanceStatus instanceStatus, File file, boolean storeStructure, boolean intend) throws IOException, XMLFormatException Writes the given instance including its status to the given file.- Parameters:
instance- The source instance,instanceStatus- The status object of the instancefile- The target file,storeStructure- If set to true, the structure is stored to the file, else, only an ID reference will be stored.intend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails
-
writeExecutableInstanceAndStatusToFile
public void writeExecutableInstanceAndStatusToFile(ExecutableInstance instance, InstanceStatus instanceStatus, File file) throws IOException, XMLFormatException Writes the given instance including its status to the given file. The template will be written in case the designated instance is modified.- Parameters:
instance- The source instance,instanceStatus- The status object of the instancefile- The target file,- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails- See Also:
-
writeExecutableInstanceAndStatusToFile
public void writeExecutableInstanceAndStatusToFile(ExecutableInstance instance, InstanceStatus instanceStatus, File file, boolean intend) throws IOException, XMLFormatException Writes the given instance including its status to the given file. The template will be written in case the designated instance is modified.- Parameters:
instance- The source instance,instanceStatus- The status object of the instancefile- The target file,intend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails- See Also:
-
writeExecutableInstanceAndStatusToFile
public void writeExecutableInstanceAndStatusToFile(ExecutableInstance instance, InstanceStatus instanceStatus, File file, Template structure) throws IOException, XMLFormatException Writes the given instance including its status to the given file.- Parameters:
instance- The source instance,instanceStatus- The status object of the instancefile- The target file,structure- If not null, the designated structure (template or instance delta layer) of the instance, will be stored inline.- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails
-
writeExecutableInstanceAndStatusToFile
public void writeExecutableInstanceAndStatusToFile(ExecutableInstance instance, InstanceStatus instanceStatus, File file, Template structure, boolean intend) throws IOException, XMLFormatException Writes the given instance including its status to the given file.- Parameters:
instance- The source instance,instanceStatus- The status object of the instancefile- The target file,structure- If not null, the designated structure (template or instance delta layer) of the instance, will be stored inline.intend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Throws:
IOException- Thrown if writing the XML to the file fails, e.g. if the provided file is read-only.XMLFormatException- Thrown if the validation of the document fails
-
getXMLStringForTemplate
Returns the xml code of a given template as string.- Parameters:
template- The template which should be transformed.- Returns:
- The xml code of the given process as string.
- Throws:
XMLFormatException- Thrown if the validation of the document failsIOException- Thrown if an unrecoverable error occurs during the course of the transformation
-
getXMLStringForTemplate
public String getXMLStringForTemplate(Template template, boolean intend) throws XMLFormatException, IOException Returns the xml code of a given template as string.- Parameters:
template- The template which should be transformed.intend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Returns:
- The xml code of the given process as string.
- Throws:
XMLFormatException- Thrown if the validation of the document failsIOException- Thrown if an unrecoverable error occurs during the course of the transformation
-
getXMLStringForInstance
Returns the xml code of a given instance as string.- Parameters:
instance- The instance which should be transformed.- Returns:
- The xml code of the given process as string.
- Throws:
XMLFormatException- Thrown if the validation of the document failsIOException- Thrown if an unrecoverable error occurs during the course of the transformation
-
getXMLStringForInstance
public String getXMLStringForInstance(Instance instance, boolean intend) throws XMLFormatException, IOException Returns the xml code of a given instance as string.- Parameters:
instance- The instance which should be transformed.intend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Returns:
- The xml code of the given process as string.
- Throws:
XMLFormatException- Thrown if the validation of the document failsIOException- Thrown if an unrecoverable error occurs during the course of the transformation
-
getInputStreamForTemplate
public InputStream getInputStreamForTemplate(Template template) throws XMLFormatException, IOException Returns The corresponding stream for a given template- Parameters:
template- The source template- Returns:
- An input stream for the given template. The caller is responsible for closing.
- Throws:
XMLFormatException- Thrown if the validation of the document failsIOException- Thrown if an unrecoverable error occurs during the course of the transformation
-
getInputStreamForTemplate
public InputStream getInputStreamForTemplate(Template template, boolean intend) throws XMLFormatException, IOException Returns The corresponding stream for a given template- Parameters:
template- The source templateintend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Returns:
- An input stream for the given template. The caller is responsible for closing.
- Throws:
XMLFormatException- Thrown if the validation of the document failsIOException- Thrown if an unrecoverable error occurs during the course of the transformation
-
getInputStreamForTemplateAndStatus
public InputStream getInputStreamForTemplateAndStatus(Template template, TemplateStatus templateStatus) throws XMLFormatException, IOException Returns The corresponding stream for a given template and a given template status.- Parameters:
template- The source templatetemplateStatus- The template status- Returns:
- An input stream for the given template. The caller is responsible for closing.
- Throws:
XMLFormatException- Thrown if the validation of the document failsIOException- Thrown if an unrecoverable error occurs during the course of the transformation
-
getInputStreamForTemplateAndStatus
public InputStream getInputStreamForTemplateAndStatus(Template template, TemplateStatus templateStatus, boolean intend) throws XMLFormatException, IOException Returns The corresponding stream for a given template and a given template status.- Parameters:
template- The source templatetemplateStatus- The template statusintend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Returns:
- An input stream for the given template. The caller is responsible for closing.
- Throws:
XMLFormatException- Thrown if the validation of the document failsIOException- Thrown if an unrecoverable error occurs during the course of the transformation
-
getDocumentForTemplateAndStatus
public Document getDocumentForTemplateAndStatus(Template template, TemplateStatus templateStatus) throws XMLFormatException Returns The corresponding document for a given template and a given template status.- Parameters:
template- The source templatetemplateStatus- The template status- Returns:
- A document for the given template
- Throws:
XMLFormatException- Thrown if the validation of the document fails
-
getInputStreamForInstance
public InputStream getInputStreamForInstance(Instance instance) throws XMLFormatException, IOException Returns The corresponding stream for a given instance- Parameters:
instance- The source instance- Returns:
- An input stream for the given instance. The caller is responsible for closing.
- Throws:
XMLFormatException- Thrown if the validation of the document failsIOException- Thrown if an unrecoverable error occurs during the course of the transformation
-
getInputStreamForInstance
public InputStream getInputStreamForInstance(Instance instance, boolean intend) throws XMLFormatException, IOException Returns The corresponding stream for a given instance- Parameters:
instance- The source instanceintend- Whether to intend child nodes and text content. Use with care! Text content may contain whitespace and linebreaks afterwards!- Returns:
- An input stream for the given instance. The caller is responsible for closing.
- Throws:
XMLFormatException- Thrown if the validation of the document failsIOException- Thrown if an unrecoverable error occurs during the course of the transformation
-
getDocumentForExecutableInstanceAndStatus
public Document getDocumentForExecutableInstanceAndStatus(ExecutableInstance instance, InstanceStatus instanceStatus, boolean storeStructure) Writes the given instance including its status to the given file.- Parameters:
instance- The source instance,instanceStatus- The status object of the instancestoreStructure- If set to true, the structure is stored to the file, else, only an ID reference will be stored.- Returns:
- The input stream
-
getDocumentForTemplate
Creates a DOM document from the template.- Parameters:
template- The source template- Returns:
- A DOM document
- Throws:
XMLFormatException- Thrown if the validation of the document fails
-
getDocumentForInstance
Creates a DOM document from the instance.- Parameters:
instance- The source instance- Returns:
- A DOM document
- Throws:
XMLFormatException- Thrown if the validation of the document fails
-
getDocumentForEBP
- Parameters:
ebp-- Returns:
- A DOM/XML document for the given executable business process.
- Throws:
XMLFormatException- Thrown if the validation of the document fails
-
getDocumentForParameter
TODO set namespace, schema location, check schema?- Parameters:
parameter- The source parameterisInputParameter- If true, an input parameter will be created, else an output parameter.- Returns:
- A DOM/XML document for the given parameter.
-
getDocumentForParameterSet
public Document getDocumentForParameterSet(Collection<ProcessModelParameter> parameter, boolean isInputParameter) TODO set namespace, schema location, check schema?- Parameters:
parameter- The source Parameterset.isInputParameter- If true, an input parameter set will be created, else an output parameter set.- Returns:
- A DOM/XML document for the set of parameters.
-
getDocumentDataElementList
Exports a set of data elements to a document.- Parameters:
dataElements- The data elements to be exported.- Returns:
- A document with a list of data element XML elements.
-
getDocumentForTemplateLocks
public Document getDocumentForTemplateLocks(Map<UUID, ProcessModelXMLHelperTools.LockDescription> locks) throws XMLFormatExceptionGenerates and returns aDocumentfor the given template locks- Parameters:
locks-- Returns:
- the generated document
- Throws:
XMLFormatException
-
writeTemplateLocksToFile
public void writeTemplateLocksToFile(Map<UUID, ProcessModelXMLHelperTools.LockDescription> locks, File file) throws IOException, XMLFormatExceptionWrites the given template locks to the specified file.- Parameters:
locks-file-- Throws:
XMLFormatExceptionIOException
-
getDocumentForInstanceLocks
public Document getDocumentForInstanceLocks(Map<UUID, ProcessModelXMLHelperTools.LockDescription> locks) throws XMLFormatExceptionGenerates and returns aDocumentfor the given instance locks- Parameters:
locks-- Returns:
- the generated document
- Throws:
XMLFormatException
-
writeInstanceLocksToFile
public void writeInstanceLocksToFile(Map<UUID, ProcessModelXMLHelperTools.LockDescription> locks, File file) throws IOException, XMLFormatExceptionWrites the given instance locks to the specified file.- Parameters:
locks-file-- Throws:
XMLFormatExceptionIOException
-
getDocumentForEmbeddedTemplateMapping
public Document getDocumentForEmbeddedTemplateMapping(Map<UUID, UUID> mapping) throws XMLFormatExceptionGenerates and returns aDocumentrepresenting the given embedded template id mapping- Parameters:
mapping- - the embedded IDs mapping to their parent IDs- Returns:
- the generated document
- Throws:
XMLFormatException
-
writeEmbeddedTemplateMappingToFile
public void writeEmbeddedTemplateMappingToFile(Map<UUID, UUID> mapping, File file) throws IOException, XMLFormatExceptionWrites the given embedded template id mapping to the specified file.- Parameters:
mapping- - the embedded IDs mapping to their parent onesfile-- Throws:
XMLFormatExceptionIOException
-
getDocumentForBaseTemplateMapping
Generates and returns aDocumentrepresenting the given base template id mapping- Parameters:
mapping- - the template IDs mapping to their base template IDs- Returns:
- the generated document
- Throws:
XMLFormatException
-
writeBaseTemplateMappingToFile
public void writeBaseTemplateMappingToFile(Map<UUID, UUID> mapping, File file) throws IOException, XMLFormatExceptionWrites the given base template id mapping to the specified file.- Parameters:
mapping- - the template IDs mapping to their base template IDsfile-- Throws:
XMLFormatExceptionIOException
-
getDocumentForAdhocTemplateMapping
public Document getDocumentForAdhocTemplateMapping(Map<UUID, UUID> mapping) throws XMLFormatExceptionGenerates and returns aDocumentrepresenting the given adhoc template id mapping- Parameters:
mapping- - the adhoc template IDs mapping to their instance IDs- Returns:
- the generated document
- Throws:
XMLFormatException
-
writeAdhocTemplateMappingToFile
public void writeAdhocTemplateMappingToFile(Map<UUID, UUID> mapping, File file) throws IOException, XMLFormatExceptionWrites the given adhoc template id mapping to the specified file.- Parameters:
mapping- - the adhoc template IDs mapping to their instance IDsfile-- Throws:
XMLFormatExceptionIOException
-
getDocumentForProcessTypes
public Document getDocumentForProcessTypes(Set<ProcessModelXMLHelperTools.SerialisableProcessType> items) throws XMLFormatException Generates and returns aDocumentrepresenting the given ProcessTypes- Parameters:
items- The process types- Returns:
- the generated document
- Throws:
XMLFormatException
-
writeProcessTypesToFile
public void writeProcessTypesToFile(Set<ProcessModelXMLHelperTools.SerialisableProcessType> items, File file) throws IOException, XMLFormatException Writes the given adhoc template id mapping to the specified file.- Parameters:
items- The process types to be storedfile-- Throws:
XMLFormatExceptionIOException
-
getDocumentForTemplateInformations
public Document getDocumentForTemplateInformations(Map<UUID, ProcessModelXMLHelperTools.TemplateInformation> items) throws XMLFormatExceptionGenerates and returns aDocumentrepresenting the given TemplateInformations.- Parameters:
items- maps from ID of template to its information- Returns:
- the generated document
- Throws:
XMLFormatException
-
writeTemplateInformationsToFile
public void writeTemplateInformationsToFile(Map<UUID, ProcessModelXMLHelperTools.TemplateInformation> items, File file) throws IOException, XMLFormatExceptionWrites the given template informations to the specified file.- Parameters:
items- maps from if of template to its template information.file-- Throws:
XMLFormatExceptionIOException
-