Class XJdfDocument

java.lang.Object
org.cip4.lib.xjdf.XJdfDocument

public class XJdfDocument extends Object
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 Details

    • XJdfDocument

      public XJdfDocument(String jobId, String[] types)
      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

      public XJdfDocument(XJDF xjdf)
      Custom Constructor. Accepting an XJDF Node for initializing
  • Method Details

    • 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 String toXml() throws javax.xml.bind.JAXBException, IOException
      Returns the current XJDF Node as String
      Returns:
      The XJDF Node as String.
      Throws:
      javax.xml.bind.JAXBException
      IOException
    • getXJdfPackage

      public byte[] getXJdfPackage() throws PackagerException
      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

      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 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.