Interface IWorkflowVariableHandler
-
public interface IWorkflowVariableHandlerInterface for the variable handler used during execution of the workflow. During workflow execution, nodes may access data via variables. This contains methods for retrieving and storing variables.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<?>accessAtPath(Object base, String jsonPath)Access a value of the given object at a certain JSON path.NodeThrewExceptiongetException(int index)Returns the exception at the given index in the exception stack.IWorkflowNodeResultgetResultForNode(WorkflowNode node)Finds the latest result for the given node.List<IWorkflowNodeResult>getResultsForNode(WorkflowNode node)Finds all results for the given node.ObjectgetTriggerData(String path)Each trigger can provide a set of data that will be available when the task is executed.booleanhasResultForNode(WorkflowNode node)voidpopException()Pops the exception on top of the exception stack, seegetException(int).voidpushException(NodeThrewException e)Pushes the given exception to the exception stack, seegetException(int).
-
-
-
Method Detail
-
accessAtPath
@Nullable List<?> accessAtPath(Object base, String jsonPath)
Access a value of the given object at a certain JSON path. Note that while simple JSON path only result in a single value, some JSON paths may match multiple values. This method always returns a list of all matching values. If the JSON path only matches a single value, this returns a list with one item.For example:
// => ["a"] accessAtPath(["a", "b"], "[0]") // => [ ["a", "b"] ] accessAtPath([ ["a", "b"], ["c", "d"] ], "[0]") // => [ "b" ] accessAtPath([ ["a", "b"], ["c", "d"] ], "[0][1]") // => [ 0 ] accessAtPath({"foo": {"bar": 0}, "baz": 1}, "foo.bar") // => [ 0 ] accessAtPath({"foo": {"bar": 0}, "baz": 1}, "foo.bar") // => [ "c", "d" ] accessAtPath([ ["a", "b"] , ["c", "d"] ], "[1][*]")- Parameters:
base- Base object where to start. Ifnull, an empty list is returned.jsonPath- Path to access on the result. Ifnullor empty, an empty list is returned.- Returns:
- A list containing all values matching the given JSON path.
-
getException
NodeThrewException getException(int index)
Returns the exception at the given index in the exception stack.An exception can be caught via
try-catch-blocks. The exception stack keeps track of the exception that was caught by thecatch-block. When a catch block contains another try-catch-block, the stack contains a list of all exceptions from all currently active catch-blocks- Parameters:
index- Index of the exception to access.0corresponds to the most recent catch-block,1corresponds to the outer catch block,2corresponds to the outer catch block of the outer catch block etc. You can also use negative indices to refer to elements from the beginning of the stack:-1corresponds to the outermost catch block.- Returns:
- The exception at the given index, or
nullwhen the index is out of range.
-
getResultForNode
@Nonnull IWorkflowNodeResult getResultForNode(WorkflowNode node)
Finds the latest result for the given node. When no result exists, this returns an emptyINormalCompletionResultinstead ofnull. UsehasResultForNode(WorkflowNode)to check whether a result exists.- Parameters:
node- A node for which to retrieve the result.- Returns:
- The result that was obtained when the node was executed, never
null. When no result is available, an empty result is returned. When the node was executed multiple times (such as when placed in a loop), the latest result is returned. - See Also:
To find nodes, use the node locator IAdvancedWorkflowContext#node(),To check whether a result exists, use #hasResultForNode,To find all results, use #getResultsForNode.
-
getResultsForNode
@Nonnull List<IWorkflowNodeResult> getResultsForNode(WorkflowNode node)
Finds all results for the given node. A node may be executed multiple times when placed inside a loop.- Parameters:
node- A node for which to retrieve the result.- Returns:
- All results that were obtained when the node was executed. When the node was executed multiple times, returns the results in the order of the individual executions. Do not attempt to modify this list.
- See Also:
To find nodes, use the node locator IAdvancedWorkflowContext#node()
-
hasResultForNode
boolean hasResultForNode(WorkflowNode node)
- Parameters:
node- AWorkflowNodeto check.- Returns:
- Whether a result exist for the given node, i.e. whether it was executed or not.
- See Also:
To find nodes, use the node locator IAdvancedWorkflowContext#node()
-
getTriggerData
@Nullable Object getTriggerData(String path)
Each trigger can provide a set of data that will be available when the task is executed. The data can be a JSON like object with nested objects and arrays. This method finds the data at the given JSON path, if it exists.- Parameters:
path- JSON path to access, e.g.button[0].name.- Returns:
- The value at the given path.
nullwhen the trigger provides no such data.
-
popException
void popException()
Pops the exception on top of the exception stack, seegetException(int). This method should only be used by workflow nodes that represent atry-catchblock.
-
pushException
void pushException(NodeThrewException e)
Pushes the given exception to the exception stack, seegetException(int). This method should only be used by workflow nodes that represent atry-catchblock.- Parameters:
e- Exception to push to the stack.
-
-