Class XJDFHelper

java.lang.Object
org.cip4.jdflib.extensions.BaseXJDFHelper
org.cip4.jdflib.extensions.XJDFHelper
All Implemented Interfaces:
Cloneable, INodeIdentifiable

public class XJDFHelper extends BaseXJDFHelper implements Cloneable, INodeIdentifiable
  • Field Details

  • Constructor Details

    • XJDFHelper

      public XJDFHelper(KElement xjdf)
      Parameters:
      xjdf - if null a new XJDF is generated, else the xjdf root to be manipulated
    • XJDFHelper

      public XJDFHelper(String jobID, String jobPartID, VJDFAttributeMap parts)
      Parameters:
      jobID - , if null a new jobid is generated
      jobPartID -
      parts -
    • XJDFHelper

      public XJDFHelper(JDFElement.EnumVersion version, String jobID)
      Parameters:
      jobID -
      jobPartID -
    • XJDFHelper

      public XJDFHelper(String jobID, String jobPartID)
      Parameters:
      jobID -
      jobPartID -
  • Method Details

    • getHelper

      public static XJDFHelper getHelper(XMLDoc doc)
      factory to create a helper from a doc
      Parameters:
      doc - the xmldoc to parse
      Returns:
      the helper
    • getHelper

      public static XJDFHelper getHelper(KElement root)
      factory to create a helper from an element
      Parameters:
      root - the element to parse if not an XJDF - search in ancestors of element
      Returns:
      the helper
    • isXJDF

      public static boolean isXJDF(KElement root)
      Parameters:
      root -
      Returns:
    • isXJMF

      public static boolean isXJMF(KElement root)
      Parameters:
      root -
      Returns:
    • parseFile

      public static XJDFHelper parseFile(String fileName)
      Parameters:
      fileName -
      Returns:
    • parseFile

      public static XJDFHelper parseFile(File fileName)
      Parameters:
      fileName -
      Returns:
    • getSets

      public Vector<SetHelper> getSets()
      Returns:
      the vector of parametersets and resourcesets
    • getSets

      public Vector<SetHelper> getSets(String setName, JDFResourceLink.EnumUsage usage)
      Parameters:
      setName -
      usage -
      Returns:
      the vector of parametersets and resourcesets
    • getAuditPool

      public AuditPoolHelper getAuditPool()
      Returns:
    • getCreateAuditPool

      public AuditPoolHelper getCreateAuditPool()
      Returns:
    • getSet

      public SetHelper getSet(String id)
      Parameters:
      id -
      Returns:
      the parameterset and resourceset with ID=iD
    • getNodeInfo

      public SetHelper getNodeInfo()
      Returns:
    • getCreateNodeInfo

      public SetHelper getCreateNodeInfo()
      Returns:
    • getSetForPartition

      public SetHelper getSetForPartition(String id)
      Parameters:
      id -
      Returns:
      the parameterset and resourceset with a child partiton with ID=iD
    • getPartition

      public ResourceHelper getPartition(String id)
      Parameters:
      id -
      Returns:
      the parameterset and resourceset with ID=iD
    • isSet

      @Deprecated public boolean isSet(KElement e)
      Deprecated.
      use SetHelper.isSet
      is the element a set?
      Parameters:
      e -
      Returns:
    • getJobID

      public String getJobID()
      Returns:
      the
    • getDependentJobParts

      public VString getDependentJobParts(JDFResourceLink.EnumUsage usage)
      Parameters:
      usage - if Input, get predecessors, if Output get followers, if null get any
      Returns:
      the list of dependents, null if none were found
    • getProduct

      public ProductHelper getProduct(String id)
      Parameters:
      id -
      Returns:
    • getProductByExternalID

      public ProductHelper getProductByExternalID(String id)
      Parameters:
      id -
      Returns:
    • getCreateProduct

      public ProductHelper getCreateProduct(String id)
      Parameters:
      id -
      Returns:
    • getCreateProduct

      public ProductHelper getCreateProduct(int iProduct)
      Parameters:
      id -
      Returns:
    • getCreateProduct

      public ProductHelper getCreateProduct(String id, String externalID)
      Parameters:
      id -
      externalID - TODO
      Returns:
    • getProduct

      public ProductHelper getProduct(int iProduct)
      get the Root product by index - note that this need not be the index in the product list but rather depends on the index of the ID in ProductList/@RootProducts
      Parameters:
      iProduct - the index of root products
      Returns:
      the product, null if no matching product exists
    • getRootProduct

      public ProductHelper getRootProduct(int iProduct)
      get the Root product by index - note that this need not be the index in the product list but rather depends on the index of the ID in ProductList/@RootProducts
      Parameters:
      iProduct - the index of root products
      Returns:
      the product, null if no matching product exists
    • getCreateRootProduct

      public ProductHelper getCreateRootProduct(int iProduct)
      get the Root product by index - note that this need not be the index in the product list but rather depends on the index of the ID in ProductList/@RootProducts
      Parameters:
      iProduct - the index of root products
      Returns:
      the product, null if no matching product exists
    • numProductHelpers

      public int numProductHelpers(boolean rootOnly)
      Parameters:
      rootOnly -
      Returns:
    • getRootProductHelpers

      public Vector<ProductHelper> getRootProductHelpers()
      Returns:
      the xjdf root element
    • getProductHelpers

      public Vector<ProductHelper> getProductHelpers()
      the vector of product helpers; null if no ProductList or no ProductList/Product
      Returns:
      the vector of product helpers
    • getPartition

      public ResourceHelper getPartition(String name, int iSet, int iPart)
      Parameters:
      name -
      iSet -
      iPart -
      Returns:
      PartitionHelper for the requested partition, null if it ain't there
    • getResource

      public KElement getResource(String name, int iSet, int iPart)
      Parameters:
      name -
      iSet -
      iPart -
      Returns:
      resource for the requested partition, null if it ain't there
    • getSet

      public SetHelper getSet(String name, int iSkip)
      Parameters:
      name -
      iSkip -
      Returns:
      the SetHelper for the resourceset with a given name
    • getSet

      public SetHelper getSet(String name, JDFResourceLink.EnumUsage usage, String processUsage)
      Parameters:
      name -
      usage -
      processUsage - - if uses as a type then the cpi is calculated and returned
      Returns:
      the SetHelper for the vector of resourcesets
    • getSet

      public SetHelper getSet(String name, JDFResourceLink.EnumUsage usage, String processUsage, JDFIntegerList cpi)
      Parameters:
      name -
      usage -
      processUsage -
      Returns:
      the SetHelper for the vector of resourcesets
    • getSet

      public SetHelper getSet(String name, JDFResourceLink.EnumUsage usage, String processUsage, int cpi)
      Parameters:
      name -
      usage -
      processUsage -
      Returns:
      the SetHelper
    • getCreateSet

      public SetHelper getCreateSet(String name, JDFResourceLink.EnumUsage usage, String processUsage, JDFIntegerList cpi)
      Parameters:
      name -
      usage -
      processUsage -
      Returns:
      the SetHelper
    • getSet

      public SetHelper getSet(String name, JDFResourceLink.EnumUsage usage)
      Parameters:
      name -
      usage -
      Returns:
      the SetHelper for the vector of resourcesets
    • appendSet

      public SetHelper appendSet(String family, String name, JDFResourceLink.EnumUsage usage)
      Parameters:
      family - - always RESOURCE better use appendResourceSet
      name -
      usage -
      Returns:
      a new set element
    • getCreateSet

      @Deprecated public SetHelper getCreateSet(String family, String name, JDFResourceLink.EnumUsage usage)
      Deprecated.
      - all sets are now resource sets
      Parameters:
      family -
      name -
      usage -
      Returns:
      a new set element
    • getCreateResourceSet

      @Deprecated public SetHelper getCreateResourceSet(String name, JDFResourceLink.EnumUsage usage)
      Deprecated.
      use getCreateSet
      Parameters:
      name -
      usage -
      Returns:
      a new set element
    • getCreateSet

      public SetHelper getCreateSet(String name, JDFResourceLink.EnumUsage usage)
      Parameters:
      name -
      usage -
      Returns:
      a new set element
    • getCreateResource

      public KElement getCreateResource(String name, JDFResourceLink.EnumUsage usage, String processUsage)
      Parameters:
      name -
      usage -
      Returns:
      a new set element
    • getCreateSet

      public SetHelper getCreateSet(String name, JDFResourceLink.EnumUsage usage, String processUsage)
      get or create a ResourceSet with a name, usage and processUsage
      Parameters:
      name -
      usage -
      processUsage -
      Returns:
      a new set element
    • getCreateParameterSet

      @Deprecated public SetHelper getCreateParameterSet(String name, JDFResourceLink.EnumUsage usage)
      Deprecated.
      Parameters:
      name -
      usage -
      Returns:
      a new set element
    • removeSet

      public void removeSet(String name)
      Parameters:
      name -
    • appendParameter

      @Deprecated public SetHelper appendParameter(String name, JDFResourceLink.EnumUsage usage)
      Deprecated.
      Parameters:
      name -
      usage -
      Returns:
      a new set element
    • appendProduct

      public ProductHelper appendProduct()
      Returns:
      a new producthelper
    • appendResource

      @Deprecated public SetHelper appendResource(String name, JDFResourceLink.EnumUsage usage)
      Deprecated.
      Parameters:
      name -
      usage -
      Returns:
      a new set element
    • appendResourceSet

      public SetHelper appendResourceSet(String name, JDFResourceLink.EnumUsage usage)
      Parameters:
      name -
      usage -
      Returns:
      a new set element
    • appendSet

      public SetHelper appendSet(String name, JDFResourceLink.EnumUsage usage)
      Parameters:
      name -
      usage -
      Returns:
      a new set element
    • toString

      public String toString()
      Overrides:
      toString in class BaseXJDFHelper
      Returns:
      See Also:
    • writeToFile

      public boolean writeToFile(String file)
      Parameters:
      file -
      Returns:
    • writeToDir

      public File writeToDir(String dir)
      write to a directory - potentially generating a jobPartID
      Parameters:
      dir -
      Returns:
    • writeToStream

      public void writeToStream(OutputStream os) throws IOException
      Parameters:
      os -
      Throws:
      IOException
    • setTypes

      public void setTypes(String types)
      Parameters:
      types -
    • setTypes

      public void setTypes(VString vtypes)
      Parameters:
      vtypes -
    • getTypes

      public VString getTypes()
      Returns:
      types the vector of types
    • getCategory

      public String getCategory()
      Returns:
      the category
    • getPartMapVector

      public VJDFAttributeMap getPartMapVector()
      Returns:
      the category
    • getType

      public JDFNode.EnumType getType()
      Returns:
      the implied JDF/@Type - if only one type in @Types, then we use said @Types, else ProcessGroup
    • cleanUp

      public void cleanUp()
      Description copied from class: BaseXJDFHelper
      generic cleanup routine
      Overrides:
      cleanUp in class BaseXJDFHelper
      See Also:
    • cleanUp

      public void cleanUp(boolean zappIDs)
      See Also:
    • clone

      public XJDFHelper clone()
      Overrides:
      clone in class Object
      Returns:
      a clone of this; any underlying documents or elements are also cloned
    • getJobPartID

      public String getJobPartID()
      Returns:
    • setJobPartID

      public void setJobPartID(String jobPartID)
      Parameters:
      jobPartID -
    • setJobID

      public void setJobID(String jobID)
      Parameters:
      jobID -
    • setCategory

      public void setCategory(String cat)
      Parameters:
      cat -
    • getDescriptiveName

      public String getDescriptiveName()
      Overrides:
      getDescriptiveName in class BaseXJDFHelper
      Returns:
      the productID of the product
    • removeType

      public void removeType(String typ, int iSkip)
      remove a types token
      Parameters:
      typ -
      iSkip -
    • addType

      public XJDFHelper addType(String typ)
      append a types token
      Parameters:
      typ -
    • addType

      public void addType(String typ, int i)
    • addType

      public XJDFHelper addType(JDFNode.EnumType typ)
      append a enumerated types token
      Parameters:
      typ -
    • addType

      public void addType(String typ, int iSkip, boolean insert)
      add a types token
      Parameters:
      typ -
      iSkip - <0 for append
      insert -
    • indexOfType

      public int indexOfType(String typ, int iSkip)
      Parameters:
      typ -
      iSkip -
      Returns:
      the cpi of the iSkip occurrence of typ
    • defaultVersion

      public static JDFElement.EnumVersion defaultVersion()
      Returns:
      default version - currently 2.0
    • setVersion

      public void setVersion(JDFElement.EnumVersion v)
    • setICSVersions

      public VString setICSVersions(ICSVersion... versions)
      set attribute ICSVersions
      Parameters:
      value - the value to set the attribute to
    • appendICSVersion

      public String appendICSVersion(ICSVersion v)
    • setExternalID

      public void setExternalID(String newID)
      See Also:
      • BaseXJDFHelper.setExternalID(java.lang.String)
    • setDescriptiveName

      public void setDescriptiveName(String description)
      See Also:
      • BaseXJDFHelper.setDescriptiveName(java.lang.String)
    • getIdentifier

      public NodeIdentifier getIdentifier()
      Specified by:
      getIdentifier in interface INodeIdentifiable
      Returns:
      NodeIdentifier the nodeidentifier that matches this
    • setIdentifier

      public void setIdentifier(NodeIdentifier ni)
      Specified by:
      setIdentifier in interface INodeIdentifiable
      Parameters:
      ni - the nodeidentifier that this should be set to
    • setGeneralID

      public JDFGeneralID setGeneralID(String idUsage, String idValue)
      See Also:
      • BaseXJDFHelper.setGeneralID(java.lang.String, java.lang.String)