Interface IWorkflowVariableHandler
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionList<?> accessAtPath(Object base, String jsonPath) Access a value of the given object at a certain JSON path.getCurrentException(int index) Returns the exception at the given index in the exception stack.int[]Finds the current nested loop index.Finds the current attachments provided by the node while it is being executed, see alsohandler.getCurrentAttachmentValueDescriptor().Finds the current files provided by the node while it is being executed, see alsohandler.getCurrentFileValueDescriptor().Finds the current value provided by the node while it is being executed, see alsohandler.getCurrentValueDescriptor().Finds all results for the given node, see alsohandler.getSuccessValueDescriptor().getException(int index) Deprecated.<T extends INodeExecutionData>
List<T> getExecutionDataForCurrentNodeStack(Class<T> type) Each node may provide additional data viaIWorkflowExecutor.provideExecutionData(WorkflowNode, INodeExecutionData)that is available while the node is executed.Each node may provide additional data viaIWorkflowExecutor.provideExecutionData(WorkflowNode, INodeExecutionData)that is available while the node is executed.default <T extends INodeExecutionData>
Iterable<T> getExecutionDataForNode(WorkflowNode node, Class<T> type) Same asgetExecutionDataForNode(WorkflowNode), but filters the results to the given type.Looks in thegetExecutionDataForCurrentNodeStack(Class)forIFormElementFieldValueContextDataand returns a map with therepetition indexfor eachfield namewithin a context.Looks in thegetExecutionDataForCurrentNodeStack(Class)forIFormElementRepetitionContextDataand returns a map with therepetition indexfor eachrepeated field name.getLatestException(int index) Gets the latest exception that occurred during the current workflow execution.default IWorkflowNodeResultgetResultForNode(WorkflowNode node) Deprecated.default List<IWorkflowNodeResult> Deprecated.getTriggerData(String path) Each trigger can provide a set of data that will be available when the task is executed.Each trigger can provide a set of files that will be available when the task is executed.booleanEach node may provide additional data viaIWorkflowExecutor.provideExecutionData(WorkflowNode, INodeExecutionData)that is available while the node is being executed.booleanhasResultForNode(WorkflowNode node) voidDeprecated.voidDeprecated.
-
Method Details
-
accessAtPath
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, the base value is returned.- Returns:
- A list containing all values matching the given JSON path.
-
getCurrentLoopIndex
@Nonnull int[] getCurrentLoopIndex()Finds the current nested loop index. When only one loop is active, this returns a single number, e.g.[0]for the first iteration,[1]for the second iteration etc. When multiple loops are nested, this returns a list of indices, with one indices entry for each loop, e.g.[2,1,3]for the 3rd iteration of the first loop, the 2nd iteration of the second loop, and the 4th iteration of the third loop.- Returns:
- The current multi loop index, as determined by the calls to
loopStart()andloopNext(). Empty array when no loop is currently active. Should be treated as read-only, modifications to this array are not reflected. - Since:
- 8.2.0
-
getDeclaredCurrentAttachmentsForNode
Finds the current attachments provided by the node while it is being executed, see alsohandler.getCurrentAttachmentValueDescriptor(). When the node is not being executed currently or does not have any attachments, this returns an empty attachment value, but never null.- Parameters:
node- Node for which to find the current attachments.- Returns:
- Attachments provided of the given node if it is being executed, or an empty attachment value otherwise.
- Since:
- 8.2.0
-
getDeclaredCurrentFilesForNode
Finds the current files provided by the node while it is being executed, see alsohandler.getCurrentFileValueDescriptor(). When the node is not being executed currently or does not have any files, this returns an empty file value, but never null.- Parameters:
node- Node for which to find the current files.- Returns:
- Files provided of the given node if it is being executed, or an empty file value otherwise.
- Since:
- 8.2.0
-
getDeclaredCurrentValueForNode
Finds the current value provided by the node while it is being executed, see alsohandler.getCurrentValueDescriptor(). When the node is not being executed currently or does not provide any value, this returnsnull.- Parameters:
node- Node for which to find the current value.- Returns:
- Value provided of the given node if it is being executed, or
nullotherwise. - Since:
- 8.2.0
-
getDeclaredSuccessValuesForNode
@Nonnull IMultiDimensionalReadOnlyList<IWorkflowNodeResult> getDeclaredSuccessValuesForNode(@Nonnull WorkflowNode node) Finds all results for the given node, see alsohandler.getSuccessValueDescriptor(). A node may be executed multiple times when placed inside a loop. Note that loop can be nested. When the node was not executed yet, this returnsnull.See
IWorkflowExecutionContext.node(), to find the nodes for which to obtain the result.- 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.
- Since:
- 8.1.0
- See Also:
-
getException
Deprecated.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.
-
getCurrentException
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. - See Also:
-
getExecutionDataForCurrentNodeStack
@Nonnull <T extends INodeExecutionData> List<T> getExecutionDataForCurrentNodeStack(@Nonnull Class<T> type) Each node may provide additional data viaIWorkflowExecutor.provideExecutionData(WorkflowNode, INodeExecutionData)that is available while the node is executed. Custom logic may make use of this data to provide different behavior depending on the currently executed nodes.- Parameters:
type- Desired type of the node data to return.- Returns:
- The data associated with the
IWorkflowNodeLocator.currents(), in that order, filtered to instances of the given type. The list is read-only and cannot not be modified. - Since:
- 8.2.0
-
getExecutionDataForNode
Each node may provide additional data viaIWorkflowExecutor.provideExecutionData(WorkflowNode, INodeExecutionData)that is available while the node is executed. Custom logic may make use of this data to provide different behavior depending on the currently executed nodes.- Parameters:
node- Node for which to get its data.- Returns:
- The data associated with the node, or
emptywhen no data is available. The list is read-only and cannot not be modified. - Since:
- 8.2.0
-
getExecutionDataForNode
@Nonnull default <T extends INodeExecutionData> Iterable<T> getExecutionDataForNode(@Nonnull WorkflowNode node, @Nonnull Class<T> type) Same asgetExecutionDataForNode(WorkflowNode), but filters the results to the given type.- Type Parameters:
T- Type of the node data to return.- Parameters:
node- Node for which to get its data.type- Desired type of the node data to return.- Returns:
- The data associated with the node, or
emptywhen no data is available. - Since:
- 8.2.0
-
getFormElementFieldValueContext
Looks in thegetExecutionDataForCurrentNodeStack(Class)forIFormElementFieldValueContextDataand returns a map with therepetition indexfor eachfield namewithin a context. When multiple contexts exist for a field name, the closest context relative to the currently executed is used.- Returns:
- A mapping between the name of each repetition context and the corresponding repetition index.
- Since:
- 8.2.0
-
getFormElementRepetitionContext
Looks in thegetExecutionDataForCurrentNodeStack(Class)forIFormElementRepetitionContextDataand returns a map with therepetition indexfor eachrepeated field name. When multiple contexts exist for a field name, the closest context relative to the currently executed is used.- Returns:
- A mapping between the name of each repetition context and the corresponding repetition index.
- Since:
- 8.2.0
-
getLatestException
Gets the latest exception that occurred during the current workflow execution. An index of 0 returns the most recent exception, an index of 1 returns the exception before that, and so on.There is also
getCurrentException, which gets an exception from the exception stack. Certain workflow elements may push exceptions to the stack, such as an error handler block (try-catch). However, the exception will be popped from the stack when the workflow element completes. This means that the exception is not available in an action that executes after that workflow element has completed. This method effectively inspects all actions that were executed so far, finds the latest action that threw, and returns that exception.- Parameters:
index- The index of the exception to retrieve. 0 for the latest, 1 for the one before that, etc. Indices that are larger than the maximum allowed index are capped to the maximum allowed index. If the index is negative, adds the size of the exceptions to it, i.e. -1 returns the oldest exception, -2 the second oldest, etc.- Returns:
- The exception at the given index, or null if no exception exists at that index.
- See Also:
-
getResultForNode
Deprecated.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.- See
IWorkflowExecutionContext.node()to find the nodes for which to obtain the result. - See
hasResultForNode(WorkflowNode)to check whether any result exists for node. - See
getDeclaredSuccessValuesForNode(WorkflowNode)to find all results for a node.
- 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:
- See
-
getResultsForNode
@Deprecated @Nonnull default List<IWorkflowNodeResult> getResultsForNode(@Nonnull WorkflowNode node) Deprecated.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:
-
getTriggerData
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- Optional JSON path to access, e.g.button[0].name. Ifnullor empty, the root value is returned.- Returns:
- The value at the given path.
nullwhen the trigger provides no such data.
-
getTriggerFiles
IWorkflowFileValue getTriggerFiles()Each trigger can provide a set of files that will be available when the task is executed. This method returns the files provided by the trigger.- Returns:
- The files provided by the trigger.
nullwhen the trigger provides no files.
-
hasExecutionDataForNode
Each node may provide additional data viaIWorkflowExecutor.provideExecutionData(WorkflowNode, INodeExecutionData)that is available while the node is being executed. Custom logic may make use of this data to provide different behavior depending on the currently executed nodes.- Parameters:
node- Node for which to check if data is present.- Returns:
- Whether data associated with the node, or
nullwhen no data is available. - Since:
- 8.2.0
-
hasResultForNode
- Parameters:
node- AWorkflowNodeto check.- Returns:
- Whether a result exist for the given node, i.e. whether it was executed or not.
- See Also:
-
popException
Deprecated.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
Deprecated.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.
-
getCurrentException(int)