Package org.cip4.lib.xjdf
Class XJdfDocument
java.lang.Object
org.cip4.lib.xjdf.XJdfDocument
XJDF 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
ConstructorsConstructorDescriptionXJdfDocument(byte[] bytes) Custom Constructor.XJdfDocument(String jobId, String[] types) Custom Constructor.XJdfDocument(XJDF xjdf) Custom Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidAppend a Audit to the XJDF Document.addResourceSet(@NotNull SpecificResource specificResource, ResourceSet.Usage usage) addResourceSet(@NotNull SpecificResource specificResource, ResourceSet.Usage usage, Part part) addResourceSet(Map<Part, ? extends SpecificResource> map, ResourceSet.Usage usage) getResourceByPart(Class<? extends SpecificResource> resourceClazz, Part part) Identifies and returns the first resource within the XJDF Document using partition keys.<T extends SpecificResource>
TgetSpecificResourceByPart(Class<T> resourceClazz, Part part) Identifies and returns the first specific resource within the XJDF Document using partition keys.getXJdf()Returns the documents XJDF root node.byte[]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.booleanReturns true in case the XJDF Document should be validated before writing.voidsetValidation(boolean validation) Set true if the document should become validated before writing.toXml()Returns the current XJDF Node as String
-
Constructor Details
-
XJdfDocument
Custom Constructor. Accepting the fundamentals of an XJDF Document for initializing -
XJdfDocument
public XJdfDocument(byte[] bytes) throws javax.xml.bind.JAXBException Custom Constructor. Accepting an XJDF byte array for initializing- Throws:
javax.xml.bind.JAXBException
-
XJdfDocument
Custom Constructor. Accepting an XJDF Node for initializing
-
-
Method Details
-
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
Returns the current XJDF Node as String- Returns:
- The XJDF Node as String.
- Throws:
javax.xml.bind.JAXBExceptionIOException
-
getXJdfPackage
Returns 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
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 IOException - Throws:
IOException
-
addResourceSet
public ResourceSet addResourceSet(Map<Part, ? extends SpecificResource> map, ResourceSet.Usage usage) throws IOException- Throws:
IOException
-
getResourceByPart
public Resource getResourceByPart(Class<? extends SpecificResource> resourceClazz, Part part) throws 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:
IllegalAccessException- Is thrown in case the partition isn't accessible in Part class.
-
getSpecificResourceByPart
public <T extends SpecificResource> T getSpecificResourceByPart(Class<T> resourceClazz, Part part) throws 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:
IllegalAccessException- Is thrown in case the partition isn't accessible in Part class.
-