Interface IWorkflowNodeLocator
-
public interface IWorkflowNodeLocator
Handler for locating nodes when a task is executed. You can then use the node with other methods of theIWorkflowExecutionContext
. Nodes are uniquely identifier by theirWorkflowNode.getId()
, use the ID if possible. TheAWorkflowElement.getName()
is unique at most within aWorkflowTask
- occasionally there may be different nodes with the same name. TheNodeKey
is guaranteed to be unique within aWorkflowProcess
.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description WorkflowNode
byId(long nodeId)
Finds the node by the given ID in the current workflow execution context.default List<WorkflowNode>
byIds(long... nodeIds)
Finds the nodes by the given ID in the current workflow execution context.default List<WorkflowNode>
byIds(Iterable<Long> nodeIds)
Finds the nodes by the given ID in the current workflow execution context.default WorkflowNode
byUuid(NodeKey nodeKey)
Finds the node by the given UUID in the current workflow execution context.WorkflowNode
byUuid(UUID taskUuid, UUID nodeUuid)
Finds the node by the given UUID in the current workflow execution context.default List<WorkflowNode>
byUuids(NodeKey... nodeKeys)
Finds the nodes by the given UUID in the current workflow execution context.default List<WorkflowNode>
byUuids(Iterable<NodeKey> nodeKeys)
Finds the nodes by the given UUID in the current workflow execution context.WorkflowNode
current()
WorkflowNode
currentByName(String name)
Finds a node that is being executed currently and possesses the given name.WorkflowNode
currentByUuid(UUID nodeUuid)
Finds a node that is being executed currently and has the given UUID.com.google.common.collect.ImmutableList<WorkflowNode>
currents()
WorkflowNode
executedByName(String nodeName)
Finds an executed node with the given name.default List<WorkflowNode>
executedByNames(Iterable<String> nodeNames)
Finds the nodes by the given names in the current workflow execution context.default List<WorkflowNode>
executedByNames(String... nodeNames)
Finds the nodes by the given names in the current workflow execution context.default boolean
isCurrentlyExecuted(WorkflowNode node)
Whether the given node is being executed currently.default boolean
isCurrentlyExecuted(NodeKey nodeKey)
Whether the given node is being executed currently.boolean
isCurrentlyExecuted(UUID taskUuid, UUID nodeUuid)
Whether a node with the given UUID is being executed currently.Object
props(WorkflowNode node)
Retrieves the properties of the given node and deserializes them into the node's properties model.default <T> T
props(WorkflowNode node, Class<T> expectedType)
Retrieves the properties of the given node and deserializes them into the node's properties model.
-
-
-
Method Detail
-
byId
@Nullable WorkflowNode byId(long nodeId)
Finds the node by the given ID in the current workflow execution context.- Parameters:
nodeId
- ID of the node.- Returns:
- The node with the given ID, or
null
when no such node exists.
-
byIds
@Nonnull default List<WorkflowNode> byIds(Iterable<Long> nodeIds)
Finds the nodes by the given ID in the current workflow execution context.- Parameters:
nodeIds
- IDs of the nodes.- Returns:
- The nodes with the given IDs, possibly an empty list when no nodes were found.
-
byIds
@Nonnull default List<WorkflowNode> byIds(long... nodeIds)
Finds the nodes by the given ID in the current workflow execution context.- Parameters:
nodeIds
- IDs of the nodes.- Returns:
- The nodes with the given ID, possibly an empty list when no nodes were found.
-
byUuid
@Nullable default WorkflowNode byUuid(NodeKey nodeKey)
Finds the node by the given UUID in the current workflow execution context.- Parameters:
nodeKey
- UUID of the node to find, and the UUID of the task to which it belongs. Note that nodes in different tasks may have the same UUID.- Returns:
- The node with the given UUID, or
null
when no such node exists.
-
byUuid
@Nullable WorkflowNode byUuid(UUID taskUuid, UUID nodeUuid)
Finds the node by the given UUID in the current workflow execution context.- Parameters:
taskUuid
- UUID of the task of the node to find.nodeUuid
- UUID of the node to find.- Returns:
- The node with the given UUID, or
null
when no such node exists.
-
byUuids
@Nonnull default List<WorkflowNode> byUuids(Iterable<NodeKey> nodeKeys)
Finds the nodes by the given UUID in the current workflow execution context.- Parameters:
nodeKeys
- UUIDs of the nodes to find.- Returns:
- The nodes with the given UUIDs, possibly an empty list when no nodes were found.
-
byUuids
@Nonnull default List<WorkflowNode> byUuids(NodeKey... nodeKeys)
Finds the nodes by the given UUID in the current workflow execution context.- Parameters:
nodeKeys
- UUIDs of the nodes to find.- Returns:
- The nodes with the given UUIDs, possibly an empty list when no nodes were found.
-
current
WorkflowNode current()
- Returns:
- The workflow node that is currently being executed, or
null
when no node is currently being executed.
-
currentByName
WorkflowNode currentByName(String name)
Finds a node that is being executed currently and possesses the given name. When multiple such nodes exists, the node whose execution started most recently is returned.- Parameters:
name
- Name of a node.- Returns:
- The most recently executed node with the given name, that is still being executed.
-
currentByUuid
WorkflowNode currentByUuid(UUID nodeUuid)
Finds a node that is being executed currently and has the given UUID.- Parameters:
nodeUuid
- UUID of a node.- Returns:
- The most recently executed node with the given UUID, that is still being executed.
-
currents
com.google.common.collect.ImmutableList<WorkflowNode> currents()
- Returns:
- A list of all nodes currently being executed, ordered by the time their execution was started, from the node whose execution started most recently to the node whose execution stared least recently.
-
executedByName
@Nullable WorkflowNode executedByName(String nodeName)
Finds an executed node with the given name. If multiple nodes with the same name exist, returns the node that was most recently executed.- Parameters:
nodeName
- Name of the node to execute.- Returns:
- The most recently executed node with the given name, or
null
when no such node exists.
-
executedByNames
@Nonnull default List<WorkflowNode> executedByNames(Iterable<String> nodeNames)
Finds the nodes by the given names in the current workflow execution context. If multiple nodes with the same name exists, returns the node that was most recently executed.- Parameters:
nodeNames
- Names of the nodes to find.- Returns:
- The nodes with the given names, possibly an empty list when no nodes were found.
-
executedByNames
@Nonnull default List<WorkflowNode> executedByNames(String... nodeNames)
Finds the nodes by the given names in the current workflow execution context. If multiple nodes with the same name exists, returns the node that was most recently executed.- Parameters:
nodeNames
- Names of the nodes to find.- Returns:
- The nodes with the given names, possibly an empty list when no nodes were found.
-
isCurrentlyExecuted
default boolean isCurrentlyExecuted(NodeKey nodeKey)
Whether the given node is being executed currently.- Parameters:
nodeKey
- The key of a node to check.- Returns:
- Whether the given node is still being executed.
-
isCurrentlyExecuted
boolean isCurrentlyExecuted(UUID taskUuid, UUID nodeUuid)
Whether a node with the given UUID is being executed currently.- Parameters:
taskUuid
- UUID of the node's task.nodeUuid
- UUID of a node to check.- Returns:
- Whether a node with the given UUID is still being executed.
-
isCurrentlyExecuted
default boolean isCurrentlyExecuted(WorkflowNode node)
Whether the given node is being executed currently.- Parameters:
node
- A node to check.- Returns:
- Whether the given node is still being executed.
-
props
Object props(WorkflowNode node)
Retrieves the properties of the given node and deserializes them into the node's properties model.- Parameters:
node
- Node to process.- Returns:
- The deserialized properties model instance
-
props
default <T> T props(WorkflowNode node, Class<T> expectedType)
Retrieves the properties of the given node and deserializes them into the node's properties model.- Type Parameters:
T
- Type of the expected properties model.- Parameters:
node
- Node to process.expectedType
- Expected type of the properties model.- Returns:
- The deserialized properties model instance, or
null
when the properties model is not of the expected type.
-
-