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.voidaddFinalProduct(FinalProduct... finalProducts)Append final products to the XJDF Document.voidaddGeneralID(GeneralID generalID)Add a general id to the XJDF Document.voidaddGeneralIDs(GeneralID... generalIDs)Add multiple general ids to the XJDF Document.ResourceSetaddResourceSet(@NotNull java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage)Add resource set to the xjdf document.ResourceSetaddResourceSet(@NotNull java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage)Add resource set to the xjdf document.ResourceSetaddResourceSet(@NotNull java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, java.lang.String processName)Add resource set to the xjdf document.ResourceSetaddResourceSet(@NotNull java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, IntegerList combinedProcessIndices)Add resource set to the xjdf document.ResourceaddSpecificResource(ResourceSet resourceSet, SpecificResource specificResource)Add a specific resource to a given resource set.ResourceaddSpecificResource(ResourceSet resourceSet, SpecificResource specificResource, java.util.List<Part> parts)Add a specific resource to a given resource set.ResourceaddSpecificResource(ResourceSet resourceSet, SpecificResource specificResource, Part part)Add a specific resource to a given resource set.HeadergetAuditCreated()Returns the AuditCreated's header element of the XJDF Document.java.util.List<java.lang.String>getCombinedProcess()Returns the combined process (types) specified in the XJDF Document.intgetCombinedProcessIndex(java.lang.String processName)Returns the combined-process-index of a given process name.java.lang.StringgetDescriptiveName()Getter of the descriptive name.java.util.List<FinalProduct>getFinalProducts()Returns a list of all final products contained by the XJDF Document.GeneralIDgetGeneralID(java.lang.String idUsage)Return GeneralID object by IDUsage value.java.util.List<Part>getParts(java.lang.Class<? extends SpecificResource> resourceType)Return the list of parts for a given resource set.java.util.List<Part>getParts(java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, java.lang.String processName)Return the list of parts for a given resource set.java.util.List<Part>getParts(ResourceSet resourceSet)Return the list of parts for a given resource set.ResourcegetResource(java.lang.Class<? extends SpecificResource> resourceType)Identifies and returns the first matching resource within a resource set.ResourcegetResource(java.lang.Class<? extends SpecificResource> resourceType, Part part)Identifies and returns the first matching specific resource within a resource set using partition keys.ResourcegetResource(java.lang.String resourceId)Returns a resource found by id.ResourcegetResource(ResourceSet resourceSet)Identifies and returns the first matching resource within a resource set.ResourcegetResource(ResourceSet resourceSet, Part part)Identifies and returns the first matching specific resource within a resource set using partition keys.java.util.List<Resource>getResources(java.lang.Class<? extends SpecificResource> resourceType, java.lang.String... partKeys)Returns the generic resources of a resource set for a given specific resource by part keys.java.util.List<Resource>getResources(ResourceSet resourceSet, java.lang.String... partKeys)Returns the generic resources of a given resource set by part keys.ResourceSetgetResourceSet(java.lang.Class<? extends SpecificResource> resourceType)Returns the resource set of a specific resource.ResourceSetgetResourceSet(java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, java.lang.String processName)Returns the resource set of a specific resource.ResourceSetgetResourceSet(java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, IntegerList combinedProcessIndices)Returns the matching resource set.<T extends SpecificResource>
TgetSpecificResource(java.lang.Class<T> resourceType)Identifies and returns the first matching specific resource within the given resource set.<T extends SpecificResource>
TgetSpecificResource(java.lang.Class<T> resourceType, Part part)Identifies and returns the first matching specific resource within a resource set using partition keys.<T extends SpecificResource>
TgetSpecificResource(java.lang.String resourceId)Returns a specific resource found by id.<T extends SpecificResource>
TgetSpecificResource(ResourceSet resourceSet)Identifies and returns the first matching specific resource within the given resource set.<T extends SpecificResource>
TgetSpecificResource(ResourceSet resourceSet, Part part)Identifies and returns the first matching specific resource within a resource set using partition keys.<T extends SpecificResource>
java.util.List<T>getSpecificResources(java.lang.Class<T> resourceType, java.lang.String... partKeys)Returns the specific resources of a resource set for given partition keys<T extends SpecificResource>
java.util.List<T>getSpecificResources(ResourceSet resourceSet, java.lang.String... partKeys)Returns the specific resources of a resource set for given partition keysXJDFgetXJdf()Returns the XJDF Documents XJDF root node.booleanremoveGeneralID(java.lang.String idUsage)Remove a GeneralID object by IDUsage.booleanremoveGeneralID(GeneralID generalID)Remove a GeneralID object.booleanremoveResource(ResourceSet resourceSet, Part part)Remove resource from a given resource set by part.booleanremoveResourceSet(java.lang.Class<? extends SpecificResource> resourceType)Remove a resource set from xjdf document.booleanremoveResourceSet(java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, java.lang.String processName)Remove a resource set from xjdf document.booleanremoveResourceSet(java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, IntegerList combinedProcessIndices)Remove a resource set from xjdf document.booleanremoveResourceSet(ResourceSet resourceSet)Remove a resource set from xjdf document.voidsetDescriptiveName(java.lang.String descriptiveName)Sets the documents descriptive name.java.lang.StringtoString()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()
Default constructor.
Creates an empty XJDF Document.
-
XJdfDocument
public XJdfDocument(java.lang.String jobId, java.lang.String... types)Custom Constructor.
Accepting the required attributes of an XJDF Document for initializing.- Parameters:
jobId- The documents JobID.types- The documents types.
-
XJdfDocument
public XJdfDocument(byte[] bytes) throws XJdfParseExceptionCustom Constructor.
Accepting an XJDF Document as byte array for initializing.- Parameters:
bytes- The XJDF Document as byte array.- Throws:
XJdfParseException
-
XJdfDocument
public XJdfDocument(XJDF xjdf)
Custom Constructor.
Accepting an XJDF root node for initializing.- Parameters:
xjdf- The XJDF root node.
-
-
Method Detail
-
setDescriptiveName
public void setDescriptiveName(java.lang.String descriptiveName)
Sets the documents descriptive name.- Parameters:
descriptiveName- The human-readable job description.
-
getDescriptiveName
public java.lang.String getDescriptiveName()
Getter of the descriptive name.- Returns:
- Returns the human-readable job description.
-
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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getCombinedProcess
public java.util.List<java.lang.String> getCombinedProcess()
Returns the combined process (types) specified in the XJDF Document.- Returns:
- The combined process specified in this document.
-
getCombinedProcessIndex
public int getCombinedProcessIndex(java.lang.String processName) throws XJdfDocumentExceptionReturns the combined-process-index of a given process name.- Returns:
- The combined process index as integer.
- Throws:
XJdfDocumentException
-
addGeneralID
public void addGeneralID(GeneralID generalID)
Add a general id to the XJDF Document.- Parameters:
generalID- The GeneralID to be added.
-
addGeneralIDs
public void addGeneralIDs(GeneralID... generalIDs)
Add multiple general ids to the XJDF Document.- Parameters:
generalIDs- The GeneralIDs to be added.
-
getGeneralID
public GeneralID getGeneralID(java.lang.String idUsage)
Return GeneralID object by IDUsage value.- Parameters:
idUsage- The IDUsage value.- Returns:
- The GeneralID object.
-
removeGeneralID
public boolean removeGeneralID(java.lang.String idUsage)
Remove a GeneralID object by IDUsage.- Parameters:
idUsage- The generalId object's idUsage value.- Returns:
- true in case the document had contained such a GeneralID.
-
removeGeneralID
public boolean removeGeneralID(GeneralID generalID)
Remove a GeneralID object.- Parameters:
generalID- The generalId object to be removed.- Returns:
- true in case the document had contained such a GeneralID.
-
addAudits
public void addAudits(Audit... audits)
Append Audit elements to the XJDF Document.- Parameters:
audits- The audits to be appended.
-
getAuditCreated
public Header getAuditCreated()
Returns the AuditCreated's header element of the XJDF Document.- Returns:
- The AuditCreated header element.
-
addFinalProduct
public void addFinalProduct(FinalProduct... finalProducts)
Append final products to the XJDF Document.- Parameters:
finalProducts- The final products to be appended.
-
getFinalProducts
public java.util.List<FinalProduct> getFinalProducts()
Returns a list of all final products contained by the XJDF Document.- Returns:
- List of final products.
-
addResourceSet
public ResourceSet addResourceSet(@NotNull @NotNull java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage)
Add resource set to the xjdf document.- Parameters:
resourceType- The type of the resource set.usage- The usgae of the resource set.- Returns:
- The newly created resource set element.
-
addResourceSet
public ResourceSet addResourceSet(@NotNull @NotNull java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage)
Add resource set to the xjdf document.- Parameters:
resourceType- The type of the resource set.usage- The usgae of the resource set.processUsage- The process usage of the resource set- Returns:
- The newly created resource set element.
-
addResourceSet
public ResourceSet addResourceSet(@NotNull @NotNull java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, java.lang.String processName) throws XJdfDocumentException
Add resource set to the xjdf document.- Parameters:
resourceType- The type of the resource set.usage- The usgae of the resource set.- Returns:
- The newly created resource set element.
- Throws:
XJdfDocumentException
-
addResourceSet
public ResourceSet addResourceSet(@NotNull @NotNull java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, IntegerList combinedProcessIndices)
Add resource set to the xjdf document.- Parameters:
resourceType- The type of the resource set.usage- The usgae of the resource set.processUsage- The process usage of the resource setcombinedProcessIndices- The combined-process-index list.- Returns:
- The newly created resource set element.
-
removeResourceSet
public boolean removeResourceSet(java.lang.Class<? extends SpecificResource> resourceType) throws XJdfDocumentException
Remove a resource set from xjdf document.- Parameters:
resourceType- The resource type of the resource set- Returns:
- true if this list contained the specified element
- Throws:
XJdfDocumentException
-
removeResourceSet
public boolean removeResourceSet(java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, java.lang.String processName) throws XJdfDocumentException
Remove a resource set from xjdf document.- Parameters:
resourceType- The resource type of the resource setusage- The usage of the resource setprocessUsage- The process usage of the resource setprocessName- The process name of the resource set- Returns:
- true if this list contained the specified element
- Throws:
XJdfDocumentException
-
removeResourceSet
public boolean removeResourceSet(java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, IntegerList combinedProcessIndices) throws XJdfDocumentException
Remove a resource set from xjdf document.- Parameters:
resourceType- The resource type of the resource setusage- The usage of the resource setprocessUsage- The process usage of the resource setcombinedProcessIndices- The combined process indexes of the resource set- Returns:
- true if this list contained the specified element
- Throws:
XJdfDocumentException
-
removeResourceSet
public boolean removeResourceSet(ResourceSet resourceSet)
Remove a resource set from xjdf document.- Parameters:
resourceSet- The resource set to be removed.- Returns:
- true if this list contained the specified element
-
addSpecificResource
public Resource addSpecificResource(ResourceSet resourceSet, SpecificResource specificResource) throws XJdfDocumentException
Add a specific resource to a given resource set.- Parameters:
resourceSet- The given resource set.specificResource- The specific resource to be added.- Returns:
- The resource object.
- Throws:
XJdfDocumentException- Thrown in case of validation issues.
-
addSpecificResource
public Resource addSpecificResource(ResourceSet resourceSet, SpecificResource specificResource, Part part) throws XJdfDocumentException
Add a specific resource to a given resource set.- Parameters:
resourceSet- The given resource set.specificResource- The specific resource to be added.part- A single part tag.- Returns:
- The resource object.
- Throws:
XJdfDocumentException- Thrown in case of validation issues.
-
addSpecificResource
public Resource addSpecificResource(ResourceSet resourceSet, SpecificResource specificResource, java.util.List<Part> parts)
Add a specific resource to a given resource set.- Parameters:
resourceSet- The given resource set.specificResource- The specific resource to be added.parts- Partitioning of the specific resource.- Returns:
- The resource object.
-
getResourceSet
public ResourceSet getResourceSet(java.lang.Class<? extends SpecificResource> resourceType) throws XJdfDocumentException
Returns the resource set of a specific resource.- Parameters:
resourceType- The resource type of the specific resource- Returns:
- The first resource set matching the specific resource
- Throws:
XJdfDocumentException
-
getResourceSet
public ResourceSet getResourceSet(java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, java.lang.String processName) throws XJdfDocumentException
Returns the resource set of a specific resource.- Parameters:
resourceType- The resource type of the specific resource- Returns:
- The first resource set matching the specific resource
- Throws:
XJdfDocumentException
-
getResourceSet
public ResourceSet getResourceSet(java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, IntegerList combinedProcessIndices) throws XJdfDocumentException
Returns the matching resource set.- Parameters:
resourceType- The resource type of the resource setusage- The usage of the resource setprocessUsage- The process usage of the resource setcombinedProcessIndices- The combined process indexes of the resource set- Returns:
- The matching resource set
- Throws:
XJdfDocumentException- Thrown in case the resource set cannot be identified uniquely
-
getParts
public java.util.List<Part> getParts(java.lang.Class<? extends SpecificResource> resourceType) throws XJdfDocumentException
Return the list of parts for a given resource set.- Parameters:
resourceType- The resource type of the resource set- Returns:
- List of part elements in the resource set.
- Throws:
XJdfDocumentException
-
getParts
public java.util.List<Part> getParts(java.lang.Class<? extends SpecificResource> resourceType, ResourceSet.Usage usage, java.lang.String processUsage, java.lang.String processName) throws XJdfDocumentException
Return the list of parts for a given resource set.- Parameters:
resourceType- The resource type of the resource setusage- The usage of the resource setprocessUsage- The process usage of the resource setprocessName- The combined process indexes of the resource set- Returns:
- List of part elements in the resource set.
- Throws:
XJdfDocumentException
-
getParts
public java.util.List<Part> getParts(ResourceSet resourceSet)
Return the list of parts for a given resource set.- Parameters:
resourceSet- The resource set to be analyzed.- Returns:
- List of part elements in the resource set.
-
getResources
public java.util.List<Resource> getResources(java.lang.Class<? extends SpecificResource> resourceType, java.lang.String... partKeys) throws XJdfDocumentException
Returns the generic resources of a resource set for a given specific resource by part keys.- Parameters:
resourceType- the specific resource.partKeys- The list of partition keys.- Returns:
- List of resources of the resource set matching the part keys.
- Throws:
XJdfDocumentException
-
getResources
public java.util.List<Resource> getResources(ResourceSet resourceSet, java.lang.String... partKeys)
Returns the generic resources of a given resource set by part keys.- Parameters:
resourceSet- the given resource set.partKeys- The list of partition keys.- Returns:
- List of resources of the resource set matching the part keys.
-
getResource
public Resource getResource(java.lang.Class<? extends SpecificResource> resourceType, Part part) throws XJdfDocumentException
Identifies and returns the first matching specific resource within a resource set 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:
XJdfDocumentException
-
getResource
public Resource getResource(ResourceSet resourceSet, Part part)
Identifies and returns the first matching specific resource within a resource set using partition keys.- Parameters:
resourceSet- The given resource setpart- The given Partition Keys used to identify a particular Resource- Returns:
- The first Resource identified using partition keys within a given resource set.
-
getResource
public Resource getResource(java.lang.Class<? extends SpecificResource> resourceType) throws XJdfDocumentException
Identifies and returns the first matching resource within a resource set.- Parameters:
resourceType- The class of the specific resource.- Returns:
- The first Resource identified.
- Throws:
XJdfDocumentException
-
getResource
public Resource getResource(ResourceSet resourceSet) throws XJdfDocumentException
Identifies and returns the first matching resource within a resource set.- Parameters:
resourceSet- The resource set.- Returns:
- The first Resource identified.
- Throws:
XJdfDocumentException
-
getResource
public Resource getResource(java.lang.String resourceId)
Returns a resource found by id.- Parameters:
resourceId- The resource's unique identifier.- Returns:
- The resource object.
-
removeResource
public boolean removeResource(ResourceSet resourceSet, Part part)
Remove resource from a given resource set by part.- Parameters:
resourceSet- The resource setpart- The partitioning of the resource to be deleted.- Returns:
- true in case the resource set contained such an elements
-
getSpecificResources
public <T extends SpecificResource> java.util.List<T> getSpecificResources(java.lang.Class<T> resourceType, java.lang.String... partKeys) throws XJdfDocumentException
Returns the specific resources of a resource set for given partition keys- Parameters:
resourceType- the specific resource.partKeys- The given partition keys- Returns:
- List of resources of the resource set.
- Throws:
XJdfDocumentException
-
getSpecificResources
public <T extends SpecificResource> java.util.List<T> getSpecificResources(ResourceSet resourceSet, java.lang.String... partKeys)
Returns the specific resources of a resource set for given partition keys- Parameters:
resourceSet- the resource set.partKeys- The given partition keys- Returns:
- List of resources of the resource set.
-
getSpecificResource
public <T extends SpecificResource> T getSpecificResource(java.lang.Class<T> resourceType, Part part) throws XJdfDocumentException
Identifies and returns the first matching specific resource within a resource set 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:
XJdfDocumentException
-
getSpecificResource
public <T extends SpecificResource> T getSpecificResource(ResourceSet resourceSet, Part part) throws XJdfDocumentException
Identifies and returns the first matching specific resource within a resource set using partition keys.- Parameters:
resourceSet- The resource set.part- The given Partition Keys used to identify a particular Resource- Returns:
- The first specific resource identified using partition keys.
- Throws:
XJdfDocumentException
-
getSpecificResource
public <T extends SpecificResource> T getSpecificResource(java.lang.Class<T> resourceType) throws XJdfDocumentException
Identifies and returns the first matching specific resource within the given resource set.- Parameters:
resourceType- The class of the specific resource.- Returns:
- The first specific resource identified using partition keys.
- Throws:
XJdfDocumentException
-
getSpecificResource
public <T extends SpecificResource> T getSpecificResource(ResourceSet resourceSet) throws XJdfDocumentException
Identifies and returns the first matching specific resource within the given resource set.- Parameters:
resourceSet- The resource set.- Returns:
- The first specific resource identified using partition keys.
- Throws:
XJdfDocumentException
-
getSpecificResource
public <T extends SpecificResource> T getSpecificResource(java.lang.String resourceId)
Returns a specific resource found by id.- Parameters:
resourceId- The resource's unique identifier.- Returns:
- The specific resource object.
-
-