Package org.cip4.lib.xjdf
Class XJdfDocument
- java.lang.Object
-
- org.cip4.lib.xjdf.XJdfDocument
-
public class XJdfDocument extends java.lang.ObjectXJDF Document is designed to be the main class when dealing with XJDF documents. Most of the logic covered by the XJDF library is covered by this class.
-
-
Constructor Summary
Constructors Constructor Description XJdfDocument(byte[] bytes)Custom Constructor.XJdfDocument(java.lang.String jobId, java.lang.String[] types)Custom Constructor.XJdfDocument(XJDF xjdf)Custom Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAudit(Audit audit)Append a Audit to the XJDF Document.ResourceSetaddResourceSet(@NotNull SpecificResource specificResource, ResourceSet.Usage usage)ResourceSetaddResourceSet(@NotNull SpecificResource specificResource, ResourceSet.Usage usage, Part part)ResourceSetaddResourceSet(java.util.Map<Part,? extends SpecificResource> map, ResourceSet.Usage usage)ResourcegetResourceByPart(java.lang.Class<? extends SpecificResource> resourceClazz, Part part)Identifies and returns the first resource within the XJDF Document using partition keys.<T extends SpecificResource>
TgetSpecificResourceByPart(java.lang.Class<T> resourceClazz, Part part)Identifies and returns the first specific resource within the XJDF Document using partition keys.XJDFgetXJdf()Returns the documents XJDF root node.byte[]getXJdfPackage()Returns an XJDF Zip Package containing the document and all assets.byte[]getXJdfPackage(AbstractXmlPackager.CompressionLevel compressionLevel)Returns an XJDF Zip Package containing the document and all assets.booleanisValidation()Returns true in case the XJDF Document should be validated before writing.voidsetValidation(boolean validation)Set true if the document should become validated before writing.java.lang.StringtoXml()Returns the current XJDF Node as String
-
-
-
Constructor Detail
-
XJdfDocument
public XJdfDocument(java.lang.String jobId, java.lang.String[] types)Custom Constructor. Accepting the fundamentals of an XJDF Document for initializing
-
XJdfDocument
public XJdfDocument(byte[] bytes) throws jakarta.xml.bind.JAXBExceptionCustom Constructor. Accepting an XJDF byte array for initializing- Throws:
jakarta.xml.bind.JAXBException
-
XJdfDocument
public XJdfDocument(XJDF xjdf)
Custom Constructor. Accepting an XJDF Node for initializing
-
-
Method Detail
-
getXJdf
public XJDF getXJdf()
Returns the documents XJDF root node.- Returns:
- The XJDF node.
-
isValidation
public boolean isValidation()
Returns true in case the XJDF Document should be validated before writing.- Returns:
- True in case the XJDF Document should be validated before writing
-
setValidation
public void setValidation(boolean validation)
Set true if the document should become validated before writing.- Parameters:
validation- True in case for validation, otherwise false.
-
toXml
public java.lang.String toXml() throws jakarta.xml.bind.JAXBException, java.io.IOExceptionReturns the current XJDF Node as String- Returns:
- The XJDF Node as String.
- Throws:
jakarta.xml.bind.JAXBExceptionjava.io.IOException
-
getXJdfPackage
public byte[] getXJdfPackage() throws PackagerExceptionReturns an XJDF Zip Package containing the document and all assets.- Returns:
- The XJDF Zip Pacakge.
- Throws:
PackagerException
-
getXJdfPackage
public byte[] getXJdfPackage(AbstractXmlPackager.CompressionLevel compressionLevel) throws PackagerException
Returns an XJDF Zip Package containing the document and all assets.- Parameters:
compressionLevel- The compression level of the XJDF ZIP Package.- Returns:
- The XJDF Zip Package as byte array.
- Throws:
PackagerException
-
addAudit
public void addAudit(Audit audit)
Append a Audit to the XJDF Document.- Parameters:
audit- The audit to be attended append.
-
addResourceSet
public ResourceSet addResourceSet(@NotNull @NotNull SpecificResource specificResource, ResourceSet.Usage usage)
-
addResourceSet
public ResourceSet addResourceSet(@NotNull @NotNull SpecificResource specificResource, ResourceSet.Usage usage, Part part) throws java.io.IOException
- Throws:
java.io.IOException
-
addResourceSet
public ResourceSet addResourceSet(java.util.Map<Part,? extends SpecificResource> map, ResourceSet.Usage usage) throws java.io.IOException
- Throws:
java.io.IOException
-
getResourceByPart
public Resource getResourceByPart(java.lang.Class<? extends SpecificResource> resourceClazz, Part part) throws java.lang.IllegalAccessException
Identifies and returns the first resource within the XJDF Document using partition keys.- Parameters:
resourceClazz- The class of the specific resource.part- The given Partition Keys used to identify a particular Resource- Returns:
- The first Resource identified using partition keys.
- Throws:
java.lang.IllegalAccessException- Is thrown in case the partition isn't accessible in Part class.
-
getSpecificResourceByPart
public <T extends SpecificResource> T getSpecificResourceByPart(java.lang.Class<T> resourceClazz, Part part) throws java.lang.IllegalAccessException
Identifies and returns the first specific resource within the XJDF Document using partition keys.- Parameters:
resourceClazz- The class of the specific resource.part- The given Partition Keys used to identify a particular Resource- Returns:
- The first specific resource identified using partition keys.
- Throws:
java.lang.IllegalAccessException- Is thrown in case the partition isn't accessible in Part class.
-
-