Class JDFResourceLink

java.lang.Object
org.apache.xerces.dom.NodeImpl
org.apache.xerces.dom.ChildNode
org.apache.xerces.dom.ParentNode
org.apache.xerces.dom.ElementImpl
org.apache.xerces.dom.ElementNSImpl
All Implemented Interfaces:
Serializable, Cloneable, IAmountPoolContainer, IStreamWriter, Element, ElementTraversal, EventTarget, Node, NodeList, TypeInfo
Direct Known Subclasses:
JDFPartAmount

public class JDFResourceLink extends JDFAutoResourceLink implements IAmountPoolContainer
See Also:
  • Constructor Details

    • JDFResourceLink

      public JDFResourceLink(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, String qualifiedName)
      Constructor for JDFResourceLink
      Parameters:
      myOwnerDocument - owner document
      qualifiedName - qualified name
    • JDFResourceLink

      public JDFResourceLink(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, String myNamespaceURI, String qualifiedName)
      Constructor for JDFResourceLink
      Parameters:
      myOwnerDocument - owner documen
      myNamespaceURI - namespace URI
      qualifiedName - qualified name
    • JDFResourceLink

      public JDFResourceLink(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, String myNamespaceURI, String qualifiedName, String myLocalName)
      Constructor for JDFResourceLink
      Parameters:
      myOwnerDocument - owner documen
      myNamespaceURI - namespace URI
      qualifiedName - qualified name
      myLocalName - local name
  • Method Details

    • getTheElementInfo

      protected ElementInfo getTheElementInfo()
      Overrides:
      getTheElementInfo in class JDFAutoResourceLink
      Returns:
      the elementinfo
    • isResourceLink

      public static boolean isResourceLink(KElement e)
      check whether e is a "real" resourceLink and NOT a partamount
      Parameters:
      e -
    • getInvalidAttributes

      public VString getInvalidAttributes(JDFElement.EnumValidationLevel level, boolean bIgnorePrivate, int nMax)
      Description copied from class: JDFElement
      get invalid attributes
      Overrides:
      getInvalidAttributes in class JDFElement
      Parameters:
      level - validation level
      bIgnorePrivate - if true, do not worry about attributes in other namespaces
      nMax - maximum size of the returned vector
      Returns:
      VString - a vector of invalid attribute names
      See Also:
    • generateCombinedProcessIndex

      public void generateCombinedProcessIndex()
    • validCombinedProcessIndex

      public boolean validCombinedProcessIndex()
      Returns:
    • toString

      public String toString()
      toString
      Overrides:
      toString in class KElement
      Returns:
      String
      See Also:
    • unpartition

      public void unpartition(boolean bRemovePartMapVector, boolean bRemoveAmountPool)
      remove all partition stuff
      Parameters:
      bRemovePartMapVector -
      bRemoveAmountPool - if true, assume all amounts apply to the main resource and copy from the first partamount
    • setTarget

      public boolean setTarget(JDFResource resourceTarget)
      setTarget - sets the link to the target defined by partLeaf. Automatically generates a part subelement, if partleaf is not the root resource
      Parameters:
      resourceTarget - the resource that this ResourceLink shoud refer to
      Returns:
      boolean - always true
      Throws:
      JDFException - if an attempt is made to link to a resource sub-element
    • getAmount

      public double getAmount(JDFAttributeMap mPart)
      get double attribute Amount, defaults to the value of Amount for the linked partition
      Parameters:
      mPart - partition map to retrieve Amount for
      Returns:
      the amount, -1 if none is specified
    • getMinAmount

      public double getMinAmount(JDFAttributeMap mPart)
      get double attribute MinAmount, defaults to getAmount if MinAmount is not set
      Parameters:
      mPart - partition map to retrieve MinAmount for
      Returns:
      the MinAmount value
    • getMaxAmount

      public double getMaxAmount(JDFAttributeMap mPart)
      get double attribute MaxAmount, defaults to getAmount if MinAmount is not set
      Parameters:
      mPart - partition map to retrieve MaxAmount for
      Returns:
      the MaxAmount value
    • getLinkRoot

      public JDFResource getLinkRoot()
      getLinkRoot - gets the root resource of the target
      Specified by:
      getLinkRoot in interface IAmountPoolContainer
      Returns:
      JDFResource
    • getLinkTarget

      @Deprecated public JDFResource getLinkTarget()
      Deprecated.
      never used
      getLinkTarget
      Returns:
      JDFResource
    • setQuantity

      public void setQuantity(int quant)
      setQuantity
      Parameters:
      quant -
    • setAmount

      public void setAmount(double value, JDFAttributeMap mPart)
      setAmount in PartAmount or in this if partAmount=null
      Parameters:
      value - amount to set
      mPart - partition map to set amount for
    • setMinAmount

      public void setMinAmount(double value, JDFAttributeMap mPart)
      set MinAmount in PartAmount or in this if partAmount=null
      Parameters:
      value - amount to set
      mPart - partition map to set amount for
    • setMaxAmount

      public void setMaxAmount(double value, JDFAttributeMap mPart)
      set MaxAmount in PartAmount or in this if partAmount=null
      Parameters:
      value - amount to set
      mPart - partition map to set amount for
    • getStatusJDF

      public JDFResource.EnumResStatus getStatusJDF()
      get the status of the Resource that is linked by this link
      Returns:
      JDFResource.EnumResStatus
    • getStatusFromLeaves

      public JDFResource.EnumResStatus getStatusFromLeaves()
      get the status of the Resource that is linked by this link
      Returns:
      JDFResource.EnumResStatus
    • setStatus

      public void setStatus(JDFResource.EResStatus s)
      set the status of the Resource that is linked by this link
      Parameters:
      s - value to set
    • setStatus

      public void setStatus(JDFResource.EnumResStatus s)
      set the status of the Resource that is linked by this link
      Parameters:
      s - value to set
    • isLocal

      public boolean isLocal()
      check whether the resource is in the same node as the link
      Returns:
      true, if the linked resource resides in the same node
    • getPart

      public JDFPart getPart(int i)
      get first Part element beyond i
      Parameters:
      i - number of elements to skip
      Returns:
      JDFResource
    • getCreatePart

      public JDFPart getCreatePart(int i)
      get element Part, create if it does not exist
      Parameters:
      i - number of elements to skip
      Returns:
      JDFResource
    • getAuditString

      public String getAuditString()
      get element Audit
      Returns:
      String
    • getParts

      public VElement getParts()
      getParts - get the vector of part elements, note that a resource link with multiple part elements is effectively an OR of these parts
      Returns:
      VElement
    • setPart

      public void setPart(String key, String value)
      setPart - shorthand if only one part is required, should be set to key = value
      Parameters:
      key - the partition key
      value - the partition value
    • setPartition

      public void setPartition(JDFResource.EnumPartIDKey key, String value)
      shorthand if only one part is required, should be set to key = value
      Parameters:
      key - the partition key
      value - the partition value
    • removePart

      public void removePart(int iSkip)
      remove element Part
      Parameters:
      iSkip - number of elements to skip
    • isExecutable

      public boolean isExecutable(JDFAttributeMap partMap, boolean bCheckChildren)
      isExecutable - checks whether the resource link links to a resource, which is in a state that will allow a node to execute
      Parameters:
      partMap - the attribute map of parts
      bCheckChildren - if true, calculates the availability status of a resource from all child partition leaves, else the status is taken from the appropriate leaf itself
      Returns:
      boolean - true if the node is executable, false if not
    • getResourceLinkPool

      protected JDFResourceLinkPool getResourceLinkPool()
      get the parent ResourceLinkPool
      Returns:
      JDFResourceLinkPool - the parent ResourceLinkPool
    • getTarget

      public JDFResource getTarget()
      gets the first resource leaf that this resourcelink refers to
      see the description of getTargetVector for details overrides the deprecated method JDFElement.getTarget()
      Overrides:
      getTarget in class JDFElement
      Returns:
      JDFResource - the first leaf that is referenced by this ResourceLink
      Since:
      102103 GetTarget returns the lowest common denominator if all children of a resource are referenced
    • getTargetVector

      public VElement getTargetVector(int nMax)
      Method getTargetVector gets the resource nodes this resourcelink refers to. Skips links that do not exist or where the name mangling is illegal.
      Actual behavior varies according to the value of PartUsage of the referenced resource:
      if PartUsage="Explicit", all elements that are referenced in PartIDKeys and the ResourceLink must exist and fit
      if PartUsage="Implicit", the best fitting intermediate node of the partitioned resource is returned.
      Attributes in the Part elements, that are not referenced in PartIDKeys, are assumed to be logical attributes (e.g. RunIndex of a RunList) and ignored when searching the part.
      Parameters:
      nMax - maximum number of requested resources; -1= all
      Returns:
      VElement - the set of leaves that are referenced by this ResourceLink
    • getRawTargetVector

      public VElement getRawTargetVector(int nMax)
      Method getTargetVector gets the resource nodes this resourcelink refers to including all leaves with identical elements. Skips links that do not exist or where the name mangling is illegal.
      Actual behavior varies according to the value of PartUsage of the referenced resource:
      if PartUsage="Explicit", all elements that are referenced in PartIDKeys and the ResourceLink must exist and fit
      if PartUsage="Implicit", the best fitting intermediate node of the partitioned resource is returned.
      Attributes in the Part elements, that are not referenced in PartIDKeys, are assumed to be logical attributes (e.g. RunIndex of a RunList) and ignored when searching the part.
      Parameters:
      nMax - maximum number of requested resources; -1= all
      Returns:
      VElement - the set of leaves that are referenced by this ResourceLink
    • getPool

      public JDFPool getPool()
      get the parent ResourceLinkPool
      Returns:
      the parent ResourceLinkPool
    • hasResourcePartMap

      public boolean hasResourcePartMap(JDFAttributeMap partMap, boolean bCheckResource)
      checks whether a given partMap is compatible with this link
      Parameters:
      partMap - the map of parts that this link is compared to
      bCheckResource - if true, also recurse into the resource and check if the parts exist
      Returns:
      boolean - true if this is compatible with partMap
    • overlapsResourcePartMap

      public boolean overlapsResourcePartMap(JDFAttributeMap partMap)
      Parameters:
      partMap -
      Returns:
      boolean
    • isResourceSelected

      public boolean isResourceSelected(JDFResource resourceToCheck)
      Check whether a resource is selected by a ResourceLink.
      A resource is selected if all (partition) leaves are selected by the resource link
      Parameters:
      resourceToCheck - The resource which may be selected by the ResourceLink. This ResourceLink must always be the full ResourceLink, i.e. Part Elements are not allowed as parameters.
      Returns:
      true, if the resource link selects the resource
    • getResourcePartMapVector

      public VJDFAttributeMap getResourcePartMapVector()
      get part map vector as defined by the linked resource. This returns the vector of leaves that would be returned.
      Returns:
      vector of mAttribute, one for each part
    • getLeafVector

      public VElement getLeafVector()
      Returns:
      the vector of referenced leaves
    • getLinkedResourceName

      public String getLinkedResourceName()
      Returns the linked resource name
      Returns:
      - the name
    • getNamedProcessUsage

      public String getNamedProcessUsage()
      Get the expected name of the linked resource and an optional processusage in name:usage format. If no processusage is available, return GetLinkedResourceName:input / GetLinkedResourceName:output respectively.
      Returns:
      String
    • validResourcePosition

      public boolean validResourcePosition()
      checks whether the resource lives in the same node or an ancestor node of the link
      Returns:
      true, if the linked resource resides in a legal node
    • isValid

      public boolean isValid(JDFElement.EnumValidationLevel level)
      default validator
      Overrides:
      isValid in class JDFElement
      Parameters:
      level - validation level
      Returns:
      boolean the validity of the node
      See Also:
    • isPhysical

      public boolean isPhysical()
      checks whether this is a link to a physical resource.
      Note that this method only works on links to resources that have a valid "Class" attribute.
      Returns:
      true, if the link links to a physical resource
    • isImplementation

      public boolean isImplementation()
      Returns:
      boolean
    • appendPart

      public JDFPart appendPart()
      append element Part
      Returns:
    • getCreateAmountPool

      public JDFAmountPool getCreateAmountPool()
      Description copied from class: JDFAutoResourceLink
      (25) getCreateAmountPool
      Specified by:
      getCreateAmountPool in interface IAmountPoolContainer
      Overrides:
      getCreateAmountPool in class JDFAutoResourceLink
      Returns:
      See Also:
    • appendAmountPool

      public JDFAmountPool appendAmountPool()
      Description copied from class: JDFAutoResourceLink
      (29) append element AmountPool
      Overrides:
      appendAmountPool in class JDFAutoResourceLink
      Returns:
    • getLot

      public JDFLot getLot(int n)
      get the nTh Lot element
      Overrides:
      getLot in class JDFAutoResourceLink
      Parameters:
      n - the index of the element
      Returns:
      the nth Lot, null if it does not exist
    • reduceParts

      public void reduceParts()
      reduce the parts to the canonical representation. If all children of a parent node are in defined in parts, they are replaced by their parent. E.g. the canonical representation of all leaves is the root.
    • expandTarget

      public void expandTarget(boolean bForce)
      Expand the target resource to contain all parts specified in the link.
      If PartUsage==Explicit or bForce==true, loop over all part elements as well.
      Parameters:
      bForce - if true, implicitly referenced partitions are also expanded
    • expandAmountPool

      public void expandAmountPool()
      create an Amountpool and fill it with the values of Amount and ActualAmount
    • getMinAmountPoolAttribute

      public double getMinAmountPoolAttribute(String attrib, String nameSpaceURI, JDFAttributeMap mPart, int def)
      returns the minimum value of attribute occurence in PartAmount,
      Parameters:
      attrib - the attribute name
      nameSpaceURI - the XML-namespace URI
      mPart - defines which part of this ResourceLink the amount belongs to. If empty get the ResourceLink root attribute.
      def - the default value id, if no matching attribute is found
      Returns:
      double - the value of attribute found, def if no matches found
      Since:
      060630
    • getAmountMap

      public JDFAmountPool.AmountMap getAmountMap(VString vPartIDKeys)
      get an AmountMap for the child Amountpool of this
      Parameters:
      vPartIDKeys -
      Returns:
      the AmountMap for the Amountpool, null if no amountpool exists
    • getAmountPoolAttribute

      public String getAmountPoolAttribute(String attrib, String nameSpaceURI, JDFAttributeMap mPart, int iSkip)
      returns the attribute occurence in PartAmount, or the default in the ResourceLink
      Parameters:
      attrib - the attribute name
      nameSpaceURI - the XML-namespace
      mPart - defines which part of this ResourceLink the Amount belongs to. If empty get the ResourceLink root attribute.
      iSkip -
      Returns:
      value of attribute found, null if not available
      Since:
      071103
    • getAmountPoolAttribute

      public String getAmountPoolAttribute(String attrib, String nameSpaceURI, VJDFAttributeMap vPart)
      returns the attribute occurence in PartAmount, or the default in the ResourceLink
      Parameters:
      attrib - the attribute name
      nameSpaceURI - the XML-namespace
      vPart - defines which part of this ResourceLink the Amount belongs to. If null get the ResourceLink root attribute.
      Returns:
      value of attribute found, null if not available
      Since:
      071103
    • hasAmountPoolAttribute

      @Deprecated public boolean hasAmountPoolAttribute(String attrib, String nameSpaceURI, JDFAttributeMap mPart)
      Deprecated.
      060601 use getAmountPoolAttribute(attrib,nameSpaceURI,mPart,0)!=null;
      returns true if the attribute occurrs
      Parameters:
      attrib - the attribute name
      nameSpaceURI - the XML-namespace
      mPart - which part of this ResourceLink the Amount belongs to, if empty get the ResourceLink root attribute
      Returns:
      true if available
      Since:
      071103
    • setAmountPoolAttribute

      public void setAmountPoolAttribute(String attrib, String value, String nameSpaceURI, VJDFAttributeMap vPart)
      sets the attribute occurence in the appropriate PartAmount when called for a resourceLink and creates the AmountPool and/or PartAmount(s) if they are not yet there
      Parameters:
      attrib - the attribute name
      value - value to set in string form.
      nameSpaceURI - the XML-namespace
      vPart - defines which part of this ResourceLink the Amount belongs to, if empty set the ResourceLink root attribute.
      Throws:
      JDFException - when called directly on a PartAmount
      Since:
      060630
    • setAmountPoolAttribute

      public void setAmountPoolAttribute(String attrib, String value, String nameSpaceURI, JDFAttributeMap mPart)
      sets the attribute occurence in the appropriate PartAmount when called for a resourceLink and creates the AmountPool and/or PartAmount if it is not yet there
      Parameters:
      attrib - the attribute name
      value - value to set in string form.
      nameSpaceURI - the XML-namespace
      mPart - defines which part of this ResourceLink the Amount belongs to, if empty set the ResourceLink root attribute
      Throws:
      JDFException - when called directly on a PartAmount
      Since:
      071103
    • getAmountPoolSumDouble

      public double getAmountPoolSumDouble(String attName, VJDFAttributeMap vPart)
      Parameters:
      attName -
      vPart -
      Returns:
    • getAmountPoolDouble

      public double getAmountPoolDouble(String attName, VJDFAttributeMap vPart)
      get the exactly matching AmountPool/PartAmount/@AttName as a double
      Parameters:
      attName -
      vPart -
      Returns:
      double -
      Throws:
      JDFException - if the element can not be cast to double
    • getAmountPoolDouble

      public double getAmountPoolDouble(String attName, JDFAttributeMap mPart)
      get the sum of all matching AmountPool/PartAmount/@attName as a double PartAmounts match if all attributes match those in PartAmount, i.e. mPart is a submap of the searched PartAmount elements
      Parameters:
      attName - the Attribute name , e.g Amount, ActualAmount
      mPart -
      Returns:
      double - the element
      Throws:
      JDFException - if the element can not be cast to double
    • setActualAmount

      public void setActualAmount(double value, JDFAttributeMap mPart)
      Set attribute ActualAmount in the AmountPool or in the link, depending on the value of mPart
      Parameters:
      value - the value to set ActualAmount to
      mPart - the part map of AmountPool/PartAmount
    • getActualAmount

      public double getActualAmount(JDFAttributeMap mPart)
      Parameters:
      mPart -
      Returns:
    • getEnumProcessUsage

      public JDFNode.EnumProcessUsage getEnumProcessUsage()
      get attribute ProcessUsage
      Returns:
      EnumProcessUsage
    • setProcessUsage

      public void setProcessUsage(JDFNode.EnumProcessUsage processUsage)
      set attribute ProcessUsage
      Parameters:
      processUsage -
    • getMinStatus

      public JDFResource.EnumResStatus getMinStatus()
      getMinStatus - get the minimum status of the ResourceLink in a JDF node. If usage is input or not available, check DraftOK as well.
      Overrides:
      getMinStatus in class JDFAutoResourceLink
      Returns:
      the status of the ResourceLink
    • getMinLateStatus

      public JDFResource.EnumResStatus getMinLateStatus()
      get attribute MinLateStatus
      Overrides:
      getMinLateStatus in class JDFAutoResourceLink
      Returns:
      EnumUsage
    • setPipePartIDKeys

      @Deprecated public void setPipePartIDKeys(VString keys)
      Deprecated.
      use setPipePartIDKeys(Vector enum)
      Sets the value of PipePartIDKeys
      Parameters:
      keys - vector of values to set
    • getPipePartIDKeysEnum

      public Vector<JDFResource.EnumPartIDKey> getPipePartIDKeysEnum()
      Gets an enumerated list of all valid pipe part keys for this resource
      Returns:
      Vector of EnumPartIDKey - list of all PipePartIDKeys
    • setCombinedProcessIndex

      public void setCombinedProcessIndex(JDFIntegerList value)
      sets attribute CombinedProcessIndex
      Overrides:
      setCombinedProcessIndex in class JDFAutoResourceLink
      Parameters:
      value - attribute value to set
    • setCombinedProcessIndex

      public void setCombinedProcessIndex(int value)
      sets attribute CombinedProcessIndex
      Parameters:
      value - attribute value to set
    • getCombinedProcessTypes

      public VString getCombinedProcessTypes()
      gets list of all types referenced by CombinedProccessIndex or CombinedProcessType
      Returns:
      VString - the list of types. Each type occurs at most once
    • setDraftOK

      public void setDraftOK(boolean value)
      sets attribute DraftOK if version>=1.3, set MinStatus=Draft instead of DraftOK=true
      Overrides:
      setDraftOK in class JDFAutoResourceLink
      Parameters:
      value - attribute value to set
    • getDraftOK

      public boolean getDraftOK()
      gets attribute DraftOK
      Overrides:
      getDraftOK in class JDFAutoResourceLink
      Returns:
      boolean - attribute value. Default is false
    • getPipeProtocol

      public String getPipeProtocol()
      gets string attribute PipeProtocol
      Overrides:
      getPipeProtocol in class JDFAutoResourceLink
      Returns:
      String - attribute value.
    • getPipeURL

      public String getPipeURL()
      gets string attribute PipeURL
      Overrides:
      getPipeURL in class JDFAutoResourceLink
      Returns:
      String - attribute value.
    • getPartMapVector

      public VJDFAttributeMap getPartMapVector()
      get part map vector
      Specified by:
      getPartMapVector in interface IAmountPoolContainer
      Overrides:
      getPartMapVector in class JDFElement
      Returns:
      VJDFAttributeMap - vector of attribute maps, one for each part
    • getPartMapArray

      public JDFAttributeMapArray getPartMapArray()
      get part map array
      Overrides:
      getPartMapArray in class JDFElement
      Returns:
      array of attribute, one for each part
    • setPartMapVector

      public void setPartMapVector(VJDFAttributeMap vParts)
      set all parts to those define in vParts
      Overrides:
      setPartMapVector in class JDFElement
      Parameters:
      vParts - vector of attribute maps for the parts
    • setPartMap

      public void setPartMap(JDFAttributeMap mPart)
      set all parts to those defined in vParts
      Overrides:
      setPartMap in class JDFElement
      Parameters:
      mPart - attribute map for the part to set
    • removePartMap

      public void removePartMap(JDFAttributeMap mPart)
      remove the part defined in mPart
      Overrides:
      removePartMap in class JDFElement
      Parameters:
      mPart - attribute map for the part to remove
    • hasPartMap

      public boolean hasPartMap(JDFAttributeMap mPart)
      check whether the part defined in mPart is included
      Overrides:
      hasPartMap in class JDFElement
      Parameters:
      mPart - attribute map for the part to remove
      Returns:
      boolean - returns true if the part exists
    • matchesString

      public boolean matchesString(String namedResLink)
      return true if this is moderately well described by namedReslink
      Parameters:
      namedResLink -
      Returns:
    • getTargetList

      public List<JDFResource> getTargetList()