public class ProcessModelTools
extends java.lang.Object
| Constructor and Description |
|---|
ProcessModelTools() |
| Modifier and Type | Method and Description |
|---|---|
static InstanceStatus |
cloneInstanceStatus(InstanceStatus status,
ProcessModelFactory factory)
Clones an instance status object using the designated factory.
|
static Node |
cloneNode(Node node,
ProcessModelFactory pmf)
Clones the designated node using the designated factory.
|
static ProcessModelParameter |
cloneProcessModelParameter(ProcessModelParameter param,
ProcessModelFactory pmf)
Clones the designated parameter using the designated factory.
|
static Template |
cloneTemplate(Template template,
ProcessModelFactory factory)
Clones a given template using the given process model factory.
|
static TemplateStatus |
cloneTemplateStatus(TemplateStatus status,
ProcessModelFactory factory)
Clones a template status object using the given factory.
|
protected static java.util.Set<java.lang.Integer> |
findNodes(int first,
int last,
boolean includeBlocks,
Template template)
Find all nodes between start and end using the topological sorting
|
protected static java.util.Set<java.lang.Integer> |
findNodesRecursive(int startID,
int endID,
Template template)
Recursively find all nodes between the start node and the end node, and
return their IDs.
|
protected static java.util.Set<java.lang.Integer> |
findNodesSlow(int first,
int last,
boolean includeBlocks,
Template template)
Find nodes the hard way, without relying on the topological sorting
|
static int |
getBranchEndNode(Template template,
int splitNodeID,
int branchID)
Returns the ID of the last node in the branch (given by its
branchID), beginning after splitNode.
|
static int |
getCommonSplitNode(Template template,
int node1ID,
int node2ID)
Returns the split node that both nodes have in common.
|
static java.util.Set<java.lang.Integer> |
getDataElementIDsByName(Template template,
java.util.Set<java.lang.String> names)
Returns the IDs of the data elements given by their names.
|
static Pair<java.util.Set<java.util.UUID>,java.util.Set<java.util.UUID>> |
getDirectChildTemplateIDsFromDeltaLayer(Template current,
Template originalTemplate,
boolean embeddedOnly)
For a given instance specific template and its base template, this method
will calculate the child templates that only occur in the base template or
the instance specific template.
|
static java.util.Set<java.util.UUID> |
getDirectChildTemplates(Template parent,
boolean embeddedOnly)
Gets a set of all child templates (direct children only) of the designated
parent template which may be restricted to embedded child templates.
|
static EBPType |
getEBPType(ExecutableBusinessProcess ebp)
Helper method to get the ebpType of an EBP.
|
static java.util.List<Node> |
getEmbdTmplNodesFromDeltaLayer(Template current,
Template originalTemplate)
Gets a list of all nodes of the designated template having embedded
templates are not also direct embedded children of the designated original
template.
|
static int[] |
getNodesInArea(int first,
int last,
boolean includeBlocks,
Template t,
boolean inTransaction)
Find all nodes in an area.
|
static ProcessModelParameter |
getProcessModelParameter(int connectorId,
Node node,
ActivityConstants.AccessType accessType)
Gets the process model parameter for the designated connector ID either from the designated
node or its assigned EBP depending on the access type.
|
static ProcessModelParameter |
getProcessModelParameter(java.lang.String name,
Node node,
ActivityConstants.AccessType accessType)
Gets the process model parameter with the designated name either from the designated node or
its assigned EBP depending on the access type.
|
static java.util.List<java.lang.Integer> |
getSplitNodes(Template template,
int nodeID)
Trace the path from the given node to the start node of the template, and record
all split nodes along the way.
|
static java.util.Map<java.lang.Integer,java.lang.String> |
getWrittenDataElements(Template template,
int nodeID)
Gets the IDs and the names of the data elements that are written by the
designated node.
|
static int[] |
intArrayDataElement(java.util.Set<DataElement> set)
Build integer array containing DataElement IDs for all DataElements in the Set
|
static int[] |
intArrayNode(java.util.Set<Node> set)
Build an int array containing the IDs of all nodes in the set
|
static java.util.List<java.lang.Integer> |
intArrayToInteger(int[] intArray)
Converts an int array to an Integer list.
|
static int[] |
integerToIntArray(java.util.Collection<java.lang.Integer> integerArray)
converts an Integer Collection to an int array.
|
static boolean |
isDecisionDataElement(Template template,
int dataElementID)
Returns true, if the given data element is a decision data element, ie.
|
static boolean |
isInParallelBranch(Template template,
int nodeID)
Gets whether the designated node is in a parallel branch (with respect to
the designated template).
|
static boolean |
isNullNode(ProcessConstants.NodeType type)
Returns true, if the node of the given type is a null node, i.e.
|
static boolean |
isSystemDataElement(Template template,
int dataElementID)
Returns true, if the data element with the given ID is a system data
element, ie. it has system data access and no non-system data access.
|
static int[] |
nodesWithSyncEdgesInArea(Template template,
int firstID,
int lastID,
boolean includingInnerSyncEdges)
Returns those nodes which are between first and last (including) and which do have
sync-edges.
|
static TemplateStatus |
updateTemplateStatus(TemplateStatus status,
ProcessConstants.TemplateBuildtimeState buildtimeState,
ProcessModelFactory pmf)
Since the template status interface is missing a setter for the
build time state, this method clones the status while changing the
build time state.
|
public static int[] nodesWithSyncEdgesInArea(Template template, int firstID, int lastID, boolean includingInnerSyncEdges)
template - the template where the method is performed on.firstID - the node who specifies the beginning of the arealastID - the last node of the areaincludingInnerSyncEdges - true if inner sync edges (i.e. sync-edges which do have source and
dest between first and last) should be returnedpublic static int[] intArrayNode(java.util.Set<Node> set)
set - Set containing nodespublic static java.util.List<java.lang.Integer> getSplitNodes(Template template, int nodeID)
template - the template that contains the nodenodeID - the node to examinepublic static int getCommonSplitNode(Template template, int node1ID, int node2ID)
template - the template that contains the nodesnode1ID - node2ID - public static int getBranchEndNode(Template template, int splitNodeID, int branchID)
template - splitNodeID - The split node of the branch.branchID - The ID of the branch, whose end node will be returned.java.lang.IllegalArgumentException - if branchID is not one of
the branches leaving splitNodepublic static int[] getNodesInArea(int first,
int last,
boolean includeBlocks,
Template t,
boolean inTransaction)
first - ID of the first (left-most) node of the arealast - ID of the last (right-most) node of the areaincludeBlocks - include nodes on a different brancht - the Template that contains the nodesinTransaction - in transactions the topological sorting may be wrong and can't be usedTemplate.getNodeIDsInArea(int, int, boolean)protected static java.util.Set<java.lang.Integer> findNodes(int first,
int last,
boolean includeBlocks,
Template template)
first - ID of the first nodelast - ID of the last nodeincludeBlocks - if false, subblocks are excludedtemplate - the template containing the nodesprotected static java.util.Set<java.lang.Integer> findNodesSlow(int first,
int last,
boolean includeBlocks,
Template template)
first - ID of the first nodelast - ID of the last nodeincludeBlocks - allow nodes on other branchestemplate - the Template containing the nodesprotected static java.util.Set<java.lang.Integer> findNodesRecursive(int startID,
int endID,
Template template)
startID - ID of the first nodeendID - ID of the last nodetemplate - the template containing the nodespublic static boolean isInParallelBranch(Template template, int nodeID)
template - The template of which to examine the structure.nodeID - The ID of the node which to check for whether it is in a
parallel branch.public static java.util.Map<java.lang.Integer,java.lang.String> getWrittenDataElements(Template template, int nodeID)
template - The template of which to retrieve data elements.nodeID - The ID of the node of which to retrieve the written data
elements.public static java.util.Set<java.lang.Integer> getDataElementIDsByName(Template template, java.util.Set<java.lang.String> names)
template - names - public static ProcessModelParameter getProcessModelParameter(int connectorId, Node node, ActivityConstants.AccessType accessType)
connectorId - The ID of the connector of the process model parameter which to retrieve.node - The node of which to retrieve a system related parameter.accessType - The access type of the parameter which to retrieve.null will be returned.public static ProcessModelParameter getProcessModelParameter(java.lang.String name, Node node, ActivityConstants.AccessType accessType)
name - The name of the process model parameter which to retrieve.node - The node of which to retrieve a system related parameter.accessType - The access type of the parameter which to retrieve.null will be returned.public static int[] integerToIntArray(java.util.Collection<java.lang.Integer> integerArray)
integerArray - public static java.util.List<java.lang.Integer> intArrayToInteger(int[] intArray)
intArray - public static int[] intArrayDataElement(java.util.Set<DataElement> set)
set - public static Template cloneTemplate(Template template, ProcessModelFactory factory)
This may be used for transforming a Template
in a ChangeableTemplate. If a changeable or a non-changeable
Template is created depends on the setting of the given factory
(ProcessModelFactory.setCreateChangeable(boolean)).
template - The template which will be cloned.factory - The factory which will be used for the creation of the new objects.public static TemplateStatus cloneTemplateStatus(TemplateStatus status, ProcessModelFactory factory)
status - factory - public static Node cloneNode(Node node, ProcessModelFactory pmf)
node - The node to clone.pmf - The factory for creating the clone.public static ProcessModelParameter cloneProcessModelParameter(ProcessModelParameter param, ProcessModelFactory pmf)
param - The parameter to clone.pmf - The factory for creating the clone.public static boolean isNullNode(ProcessConstants.NodeType type)
type - The type of the node.public static TemplateStatus updateTemplateStatus(TemplateStatus status, ProcessConstants.TemplateBuildtimeState buildtimeState, ProcessModelFactory pmf)
status - buildtimeState - pmf - The process model factory for creating the status object.public static boolean isSystemDataElement(Template template, int dataElementID)
template - The process template.dataElementID - The ID of the data element.public static boolean isDecisionDataElement(Template template, int dataElementID)
template - The process template.dataElementID - The ID of the data element.public static java.util.Set<java.util.UUID> getDirectChildTemplates(Template parent, boolean embeddedOnly)
EmbeddedProcess.getTemplateID())
will be returned.parent - The template from which to retrieve the IDs of the direct
child templates (all or only the embedded ones).embeddedOnly - Whether the returned child templates should only
contain embedded templates.public static java.util.List<Node> getEmbdTmplNodesFromDeltaLayer(Template current, Template originalTemplate)
EmbeddedProcess.getTemplateID()) need not be set in the current
template and may be null. In this case the template is
expected to be new and therefore the corresponding node will be in the
result.current - The instance-specific template from which to retrieve the
nodes having embedded templates which are not also children of the
designated original template.originalTemplate - The original template of the designated template to
detect the direct embedded children which are not
instance-specific. Note that it is not checked whether this
template really is the original template of the provided template.public static Pair<java.util.Set<java.util.UUID>,java.util.Set<java.util.UUID>> getDirectChildTemplateIDsFromDeltaLayer(Template current, Template originalTemplate, boolean embeddedOnly)
The first set of the returned pair is a set of all child template IDs (direct children only, including embedded) of the base template which are not also children of the instance specific template.
The second set of the returned pair is a set of all child template IDs (direct children only, including embedded) of the instance specific template which are not also children of the base template.
The IDs may be restricted to the ones of
embedded child templates.
Note that unlike
getEmbdTmplNodesFromDeltaLayer(Template, Template)
the internal IDs of the embedded templates
(EmbeddedProcess.getTemplateID()) needs to be set for all embedded
templates.
current - The instance-specific template from which to retrieve the
IDs of all direct child templates which are not also children of
the designated original template.originalTemplate - The original template of the designated template to
detect the children which are not instance-specific. Note that it
is not checked whether this template really is the original
template of the provided template.embeddedOnly - Whether the returned child template IDs should only
contain embedded template IDs.public static EBPType getEBPType(ExecutableBusinessProcess ebp)
ebp - The EBP the type is needed from.EBPType.NULL, if the EBP is null.public static InstanceStatus cloneInstanceStatus(InstanceStatus status, ProcessModelFactory factory)
status - The instance status to be cloned.factory - The process model factory for creating the new instance
status.