Package org.cip4.lib.xjdf
Class XJdfDocument
- java.lang.Object
-
- org.cip4.lib.xjdf.XJdfDocument
-
public class XJdfDocument extends java.lang.ObjectThis class provides functionality all about XJDF Documents.
-
-
Constructor Summary
Constructors Constructor Description XJdfDocument()Default constructor.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 voidaddAudits(Audit... audits)Append Audit elements to the XJDF Document.voidaddProduct(Product... products)Append Product elements to the XJDF Document.ResourceSetaddResourceSet(@NotNull SpecificResource specificResource, ResourceSet.Usage usage)Add a specific resource to the XJDF Document.ResourceSetaddResourceSet(@NotNull SpecificResource specificResource, ResourceSet.Usage usage, Part part)Add a specific resource to the XJDF Document.ResourceSetaddResourceSet(java.util.Map<Part,? extends SpecificResource> map, ResourceSet.Usage usage)Add a map of specific resources to the XJDF Document.ResourcegetResourceByPart(java.lang.Class<? extends SpecificResource> resourceType)Identifies and returns the first matching resource within the XJDF Document.ResourcegetResourceByPart(java.lang.Class<? extends SpecificResource> resourceType, Part part)Identifies and returns the first resource within the XJDF Document using partition keys.<T extends SpecificResource>
TgetSpecificResourceByPart(java.lang.Class<T> resourceType)Identifies and returns the first matching specific resource within the XJDF Document.<T extends SpecificResource>
TgetSpecificResourceByPart(java.lang.Class<T> resourceType, Part part)Identifies and returns the first matching specific resource within the XJDF Document using partition keys.XJDFgetXJdf()Returns the XJDF Documents XJDF root node.byte[]toXml()Returns the current XJDF Document as XML byte array.byte[]toXml(boolean validate)Returns the current XJDF Document as XML byte array.
-
-
-
Constructor Detail
-
XJdfDocument
public XJdfDocument() throws XJdfInitExceptionDefault constructor.
Creates an empty XJDF Document.- Throws:
XJdfInitException
-
XJdfDocument
public XJdfDocument(java.lang.String jobId, java.lang.String... types) throws XJdfInitExceptionCustom Constructor.
Accepting the required attributes of an XJDF Document for initializing.- Parameters:
jobId- The documents JobID.types- The documents types.- Throws:
XJdfInitException
-
XJdfDocument
public XJdfDocument(byte[] bytes) throws XJdfInitException, XJdfParseExceptionCustom Constructor.
Accepting an XJDF Document as byte array for initializing.- Parameters:
bytes- The XJDF Document as byte array.- Throws:
XJdfInitExceptionXJdfParseException
-
XJdfDocument
public XJdfDocument(XJDF xjdf) throws XJdfInitException
Custom Constructor.
Accepting an XJDF root node for initializing.- Parameters:
xjdf- The XJDF root node.- Throws:
XJdfInitException
-
-
Method Detail
-
getXJdf
public XJDF getXJdf()
Returns the XJDF Documents XJDF root node.- Returns:
- The XJDF root node.
-
toXml
public byte[] toXml() throws XJdfParseException, XJdfValidationExceptionReturns the current XJDF Document as XML byte array.- Returns:
- The XJDF Document as XML byte array.
- Throws:
XJdfParseExceptionXJdfValidationException
-
toXml
public byte[] toXml(boolean validate) throws XJdfParseException, XJdfValidationExceptionReturns the current XJDF Document as XML byte array.- Parameters:
validate- 'false' in case validation should be skipped.- Returns:
- The XJDF Document as XML byte array.
- Throws:
XJdfParseExceptionXJdfValidationException
-
addAudits
public void addAudits(Audit... audits)
Append Audit elements to the XJDF Document.- Parameters:
audits- The audits to be appended.
-
addProduct
public void addProduct(Product... products)
Append Product elements to the XJDF Document.- Parameters:
products- The products to be appended.
-
addResourceSet
public ResourceSet addResourceSet(@NotNull @NotNull SpecificResource specificResource, ResourceSet.Usage usage)
Add a specific resource to the XJDF Document.- Parameters:
specificResource- The specific resource to be added.usage- The resource's usage.- Returns:
- The appropriate ResourceSet element for further processing.
-
addResourceSet
public ResourceSet addResourceSet(@NotNull @NotNull SpecificResource specificResource, ResourceSet.Usage usage, Part part) throws java.io.IOException
Add a specific resource to the XJDF Document.- Parameters:
specificResource- The specific resource to be added.usage- The resource's usage.part- The partitioning of the resource.- Returns:
- The appropriate ResourceSet element for further processing.
- Throws:
java.io.IOException
-
addResourceSet
public ResourceSet addResourceSet(java.util.Map<Part,? extends SpecificResource> map, ResourceSet.Usage usage) throws java.io.IOException
Add a map of specific resources to the XJDF Document.- Parameters:
map- Partitioned specific resources as map.usage- The resource's usage.- Returns:
- The appropriate ResourceSet element for further processing.
- Throws:
java.io.IOException
-
getResourceByPart
public Resource getResourceByPart(java.lang.Class<? extends SpecificResource> resourceType, Part part) throws java.lang.IllegalAccessException
Identifies and returns the first resource within the XJDF Document using partition keys.- Parameters:
resourceType- 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.
-
getResourceByPart
public Resource getResourceByPart(java.lang.Class<? extends SpecificResource> resourceType) throws java.lang.IllegalAccessException
Identifies and returns the first matching resource within the XJDF Document.- Parameters:
resourceType- The class of the specific resource.- Returns:
- The first Resource identified.
- 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> resourceType, Part part) throws java.lang.IllegalAccessException
Identifies and returns the first matching specific resource within the XJDF Document using partition keys.- Parameters:
resourceType- The type 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.
-
getSpecificResourceByPart
public <T extends SpecificResource> T getSpecificResourceByPart(java.lang.Class<T> resourceType) throws java.lang.IllegalAccessException
Identifies and returns the first matching specific resource within the XJDF Document.- Parameters:
resourceType- The class of the specific 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.
-
-