Class PartitionGetter

java.lang.Object
org.cip4.jdflib.resource.PartitionGetter
Direct Known Subclasses:
JDFResource.PartitionGetter

public class PartitionGetter extends Object
class that evaluates the partitions based on the underlying PartitionMap This class will typically return JDFAttributeMaps that exist in the PartitionMap
  • Constructor Details

    • PartitionGetter

      public PartitionGetter(JDFResource jdfResource)
      Parameters:
      jdfResource - TODO
  • Method Details

    • isAlwaysStrictPartVersion

      public static boolean isAlwaysStrictPartVersion()
    • setAlwaysStrictPartVersion

      public static void setAlwaysStrictPartVersion(boolean alwaysStrictPartVersion)
      globally enable/disable matching of single versions to multiple versions
      Parameters:
      alwaysStrictPartVersion -
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • isFollowIdentical

      public boolean isFollowIdentical()
      Getter for followIdentical attribute.
      Returns:
      the followIdentical
    • setFollowIdentical

      public void setFollowIdentical(boolean followIdentical)
      Setter for followIdentical attribute.
      Parameters:
      followIdentical - the followIdentical to set
    • getPartitionVector

      public VElement getPartitionVector(VJDFAttributeMap vm, JDFResource.EnumPartUsage partUsage)
      Gets the vector of parts (resource leaves or nodes) that match mAttribute
      Parameters:
      vm - the map of key-value partitions (where key - PartIDKey, value - its value)
      partUsage - also accept nodes that are are not completely specified in the partmap, e.g. if partitioned by run, RunPage and only Run is specified
      Returns:
      VElement - the vector of matching resource leaves or nodes
    • getPartitionMaps

      public VJDFAttributeMap getPartitionMaps(VJDFAttributeMap vm, JDFResource.EnumPartUsage partUsage)
      Gets the vector of parts (resource leaves or nodes) that match mAttribute
      Parameters:
      vm - the map of key-value partitions (where key - PartIDKey, value - its value)
      partUsage - also accept nodes that are are not completely specified in the partmap, e.g. if partitioned by run, RunPage and only Run is specified
      Returns:
      VElement - the vector of matching resource leaves or nodes
    • getPartitionVector

      public VElement getPartitionVector(JDFAttributeMap m, JDFResource.EnumPartUsage partUsage)
      Gets the vector of parts (resource leaves or nodes) that match mAttribute
      Parameters:
      m - the map of key-value partitions (where key - PartIDKey, value - its value)
      partUsage - also accept nodes that are are not completely specified in the partmap, e.g. if partitioned by run, RunPage and only Run is specified
      Returns:
      VElement - the vector of matching resource leaves or nodes
    • getPartition

      public JDFResource getPartition(JDFAttributeMap m, JDFResource.EnumPartUsage partUsage)
      Gets the first part that matches mAttribute
      Parameters:
      m - the map of key-value partitions (where key - PartIDKey, value - its value)
      partUsage - also accept nodes that are are not completely specified in the partmap, e.g. if partitioned by run, RunPage and only Run is specified
      Returns:
      JDFResource: the first matching resource leaf or node
    • getDeepPart

      protected JDFResource getDeepPart(JDFAttributeMap m, JDFResource.EnumPartUsage partUsage)
      Gets a matching part from somewhere down there,
      returns the closest ancestor of all matching elements within the target vector
      Parameters:
      m - map of attributes that should fit
      partUsage - lso accept nodes that are are not completely specified in the partmap, e.g. if partitioned by run, RunPage and only Run is specified
      Returns:
      the first found matching resource node or leaf
    • getCreatePartition

      public JDFResource getCreatePartition(JDFAttributeMap partMap, VString vPartKeys)
      Recursively adds the partition leaves defined in partMap
      Parameters:
      partMap - the map of part keys
      vPartKeys - the vector of partIDKeys strings of the resource. If empty (the default), the Resource PartIDKeys attribute is used
      Returns:
      JDFResource the last created partition leaf
      Throws:
      JDFException - if there are in the partMap not matching partitions
      JDFException - if there is an attempt to fill non-matching partIDKeys
      JDFException - if by adding of last partition key there is either non-continuous partmap or left more than one key
    • reorderPartitions

      public boolean reorderPartitions(List<String> newPartIDKeys)
      refactor a resource to new partIDKeys
    • fillSparse

      public void fillSparse()
      refactor a resource to add all sparse partitions
    • createPartitions

      public VElement createPartitions(VJDFAttributeMap vPartMap, VString vPartIDKeys)
      Recursively adds the partition leaves defined in vPartMap
      Parameters:
      vPartMap - the vector of maps of part keys
      vPartIDKeys - the vector of partIDKeys strings of the resource. If empty (the default) the Resource PartIDKeys attribute is used
      Returns:
      VElement - vector of newly created partitions
      Throws:
      JDFException - if there are in the partMap not matching partitions
      JDFException - if there is an attempt to fill non-matching partIDKeys
      JDFException - if by adding of last partition key there is either non-continuous partmap or left more than one key
    • setStrictPartVersion

      public void setStrictPartVersion(boolean strictPartVersion)
      if set to true, partversion will only match if the string matches exactly
      if set to false (the default) partversions will match if tokens overlap
      Parameters:
      strictPartVersion -
    • isStrictPartVersion

      public boolean isStrictPartVersion()