Package org.cip4.jdflib.resource
Class PartitionGetter
- java.lang.Object
-
- org.cip4.jdflib.resource.PartitionGetter
-
- Direct Known Subclasses:
JDFResource.PartitionGetter
public class PartitionGetter extends java.lang.Objectclass that evaluates the partitions based on the underlying PartitionMap This class will typically return JDFAttributeMaps that exist in the PartitionMap
-
-
Constructor Summary
Constructors Constructor Description PartitionGetter(JDFResource jdfResource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VElementcreatePartitions(VJDFAttributeMap vPartMap, VString vPartIDKeys)Recursively adds the partition leaves defined in vPartMapvoidfillSparse()refactor a resource to add all sparse partitionsJDFResourcegetCreatePartition(JDFAttributeMap partMap, VString vPartKeys)Recursively adds the partition leaves defined in partMapprotected JDFResourcegetDeepPart(JDFAttributeMap m, JDFResource.EnumPartUsage partUsage)Gets a matching part from somewhere down there,
returns the closest ancestor of all matching elements within the target vectorJDFResourcegetPartition(JDFAttributeMap m, JDFResource.EnumPartUsage partUsage)Gets the first part that matches mAttributeVJDFAttributeMapgetPartitionMaps(VJDFAttributeMap vm, JDFResource.EnumPartUsage partUsage)Gets the vector of parts (resource leaves or nodes) that match mAttributeVElementgetPartitionVector(JDFAttributeMap m, JDFResource.EnumPartUsage partUsage)Gets the vector of parts (resource leaves or nodes) that match mAttributeVElementgetPartitionVector(VJDFAttributeMap vm, JDFResource.EnumPartUsage partUsage)Gets the vector of parts (resource leaves or nodes) that match mAttributebooleanisFollowIdentical()Getter for followIdentical attribute.booleanreorderPartitions(java.util.List<java.lang.String> newPartIDKeys)refactor a resource to new partIDKeysvoidsetFollowIdentical(boolean followIdentical)Setter for followIdentical attribute.voidsetStrictPartVersion(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 overlapjava.lang.StringtoString()
-
-
-
Constructor Detail
-
PartitionGetter
public PartitionGetter(JDFResource jdfResource)
- Parameters:
jdfResource- TODO
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
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 fitpartUsage- 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 keysvPartKeys- 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 partitionsJDFException- if there is an attempt to fill non-matching partIDKeysJDFException- if by adding of last partition key there is either non-continuous partmap or left more than one key
-
reorderPartitions
public boolean reorderPartitions(java.util.List<java.lang.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 keysvPartIDKeys- 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 partitionsJDFException- if there is an attempt to fill non-matching partIDKeysJDFException- 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-
-
-