Interface INodeExecutionParams<TData>
-
- Type Parameters:
TData
- Type of the properties model for the node. SeeINodeHandler
.
public interface INodeExecutionParams<TData>
Interface for the parameters that are passed toINodeHandler.execute(INodeExecutionParams)
.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description TData
getData()
WorkflowNode
getNode()
IWorkflowExecutionContext
getWorkflowContext()
INormalCompletionResultBuilder
normalResult()
When the node was executed normally (without an exception and without returning), use this method to create the result and return it.INodeReturnedExceptionBuilder
returningException()
When the node was executed and you wish to stop the execution of the current workflow task via a return statement, create a returning exception with this method and throw it.default <T> void
softError(String errorCode, Class<T> memberClass, String message, IValueCreator<T> valueCreator, Throwable cause)
Adds a soft error to the list of soft errors.default void
softError(String errorCode, String message, Object value, Throwable cause)
Adds a soft error to the list of soft errors.void
softError(String message, Throwable cause, Consumer<IUnionValueBuilder<String>> errorValue)
Adds a soft error to the list of soft errors.IResolvedFileListProcessor<List<IResolvedFile>,NodeThrewException>
standardFileErrorsMultiple(boolean required)
Returns aIResolvedFileListProcessor
that can be used withIResolvedFileList#collectResult
.IResolvedFileListProcessor<List<IResolvedFile>,NodeThrewException>
standardFileErrorsMultiple(boolean required, IStandardFileListResolutionErrorCreator errorCreator)
Returns aIResolvedFileListProcessor
that can be used withIResolvedFileList#collectResult
.IResolvedFileListProcessor<Optional<IResolvedFile>,NodeThrewException>
standardFileErrorsSingle(boolean required)
Returns aIResolvedFileListProcessor
that can be used withIResolvedFileList#collectResult
.IResolvedFileListProcessor<Optional<IResolvedFile>,NodeThrewException>
standardFileErrorsSingle(boolean required, IStandardFileListResolutionErrorCreator errorCreator)
Returns aIResolvedFileListProcessor
that can be used withIResolvedFileList#collectResult
.INodeThrewExceptionBuilder
throwingException()
When the node was executed, but an exception did occur, use this method to create a throwing exception and throw it.
-
-
-
Method Detail
-
getData
TData getData()
- Returns:
- The custom data of the given node. This is passed for convenience, it the the same as
AWorkflowElement.getCustomParameters()
, but already deserialized and updated.
-
getNode
WorkflowNode getNode()
- Returns:
- The node that needs to be executed.
-
getWorkflowContext
IWorkflowExecutionContext getWorkflowContext()
- Returns:
- The workflow context of the current workflow execution. Use this context to access various system related features, such as replacing placeholders, retrieving / writing files, or sending HTTP responses.
-
normalResult
INormalCompletionResultBuilder normalResult()
When the node was executed normally (without an exception and without returning), use this method to create the result and return it.- Returns:
- A builder for a normal completion result.
-
returningException
INodeReturnedExceptionBuilder returningException()
When the node was executed and you wish to stop the execution of the current workflow task via a return statement, create a returning exception with this method and throw it.- Returns:
- A builder for a returning exception.
-
softError
default <T> void softError(String errorCode, Class<T> memberClass, String message, IValueCreator<T> valueCreator, Throwable cause)
Adds a soft error to the list of soft errors. The soft error added via this method is always automatically included in the success result of the node, in addition to the soft errors already present in the success result. Compare withINormalCompletionResultBuilder#softError
, which only adds the error when that builder is used.When a node is executed normally, it may provide one or more soft errors to indicate that some issues have occurred that were not sever enough for the node to throw an exception. See
softErrors
for more details.- Parameters:
errorCode
- String with the soft error type.memberClass
- Type of the value for that soft error type.message
- Message providing more details about the error .valueCreator
- Function that takes a value builder to create the soft error value.cause
- The exception that caused the soft error. May benull
when not caused by any exception.- Since:
- 7.1.0
-
softError
default void softError(String errorCode, String message, Object value, Throwable cause)
Adds a soft error to the list of soft errors. The soft error added via this method is always automatically included in the success result of the node, in addition to the soft errors already present in the success result. Compare withINormalCompletionResultBuilder#softError
, which only adds the error when that builder is used.When a node is executed normally, it may provide one or more soft errors to indicate that some issues have occurred that were not sever enough for the node to throw an exception. See
softErrors
for more details.- Parameters:
errorCode
- String with the error type.message
- Message providing more details about the error .value
- Value with details about the error.cause
- The exception that caused the soft error. May benull
when not caused by any exception.- Since:
- 7.1.0
-
softError
void softError(String message, Throwable cause, Consumer<IUnionValueBuilder<String>> errorValue)
Adds a soft error to the list of soft errors. The soft error added via this method is always automatically included in the success result of the node, in addition to the soft errors already present in the success result. Compare withINormalCompletionResultBuilder#softError
, which only adds the error when that builder is used.When a node is executed normally, it may provide one or more soft errors to indicate that some issues have occurred that were not sever enough for the node to throw an exception. See
softErrors
for more details.// Adds a soft error with no additional data. builder.softError("bad data", b -> b.value("FOUND_BAD_DATA", new HashMap<>()));
- Parameters:
message
- Message providing more details about the error .errorValue
- Function that takes a value builder to create the error value.cause
- The exception that caused the soft error. May benull
when not caused by any exception.- Since:
- 7.1.0
-
standardFileErrorsMultiple
IResolvedFileListProcessor<List<IResolvedFile>,NodeThrewException> standardFileErrorsMultiple(boolean required)
Returns aIResolvedFileListProcessor
that can be used withIResolvedFileList#collectResult
. The processor implements the standard error behavior for resolved files, seestandardFileErrorsMultiple
for more details.Furthermore, this method uses the standard error codes
NETWORK_ERROR
(hard error),DATABASE_ERROR
(hard error),FILE_SYSTEM_ERROR
(hard error), andNO_SOURCE_FILE_FOUND
(hard and soft error). You should make sure that your action includes these error codes in theerror value descriptor
andsoft error value descriptor
. SeeCodeOnlyStandardFileListResolutionErrorCreator
for more details.If you need more customization, extend the
StandardErrorFileListProcessor
or use a custom implementation ofIResolvedFileListProcessor
.- Parameters:
required
- Whether at least one file must be present. Whentrue
, an error is issued to the handler when not at least one file was found.- Returns:
- A processor that collects the resolved resource items into a list of all files.
-
standardFileErrorsMultiple
IResolvedFileListProcessor<List<IResolvedFile>,NodeThrewException> standardFileErrorsMultiple(boolean required, IStandardFileListResolutionErrorCreator errorCreator)
Returns aIResolvedFileListProcessor
that can be used withIResolvedFileList#collectResult
. The processor implements the standard error behavior for resolved files, see below.If you need more customization, extend the
StandardErrorFileListProcessor
or use a custom implementation ofIResolvedFileListProcessor
.The standard error behavior is as follows:
Form record attachment query
: Soft errorNoSourceFileFound
when not a single attachment was found.Referenced client file
: Hard errorNoSourceFileFound
when the referenced client file with the UUID does not exist in the system.Network resource
: Hard errorNetworkError
when either the URL is invalid or the data cannot be read from the network.Files from previously executed node
: Hard errorNoSourceFileFound
when the referenced node does not exist in the workflow, soft errorNoSourceFileFound
when the node was not executed or does not provide any files.Referenced form file
: Hard errorNoSourceFileFound
when the referenced form file with the UUID does not exist in the system.Uploads
: Hard errorNoSourceFileFound
when the referenced upload element does not exist in the workflow, soft errorNoSourceFileFound
when no attachment exists for the referenced upload element.
- A soft
NoSourceFileFound
is produced when at least one resolved file was found for a resource item, but the additionalfilter
excluded all those files. - A hard
FileSystem
is thrown when files could not be read from the file system or written to the file system. - A hard
DatabaseError
is thrown when an error occurred during the communication with the database. - A hard
General
error is thrown when an unexpected error occurred that could not be handled otherwise.
errorCreator
.- Parameters:
required
- Whether at least one file must be present. Whentrue
, an error is issued to the handler when not at least one file was found.errorCreator
- Instance that provides the error code and error data for each predefined standard file resolution error.- Returns:
- A processor that collects the resolved resource items into a list of all files.
-
standardFileErrorsSingle
IResolvedFileListProcessor<Optional<IResolvedFile>,NodeThrewException> standardFileErrorsSingle(boolean required)
Returns aIResolvedFileListProcessor
that can be used withIResolvedFileList#collectResult
. The processor implements the standard error behavior for resolved files, seestandardFileErrorsSingle
for more details.Furthermore, this method uses the standard error codes
NETWORK_ERROR
,DATABASE_ERROR
,FILE_SYSTEM_ERROR
, andNO_SOURCE_FILE_FOUND
. You should make sure that your action includes these error codes in theerror value descriptor
andsoft error value descriptor
. SeeCodeOnlyStandardFileListResolutionErrorCreator
for more details.If you need more customization, extend the
StandardErrorFileListProcessor
or use a custom implementation ofIResolvedFileListProcessor
.- Parameters:
required
- Whether at least one file must be present. Whentrue
, an error is issued to the handler when not at least one file was found.- Returns:
- A processor that collects the resolved resource items into an optional with the first resolved file.
-
standardFileErrorsSingle
IResolvedFileListProcessor<Optional<IResolvedFile>,NodeThrewException> standardFileErrorsSingle(boolean required, IStandardFileListResolutionErrorCreator errorCreator)
Returns aIResolvedFileListProcessor
that can be used withIResolvedFileList#collectResult
. The processor implements the standard error behavior for resolved files, seestandardFileErrorsSingle
for more details. Furthermore, this method uses the standard error codes, seeCodeOnlyStandardFileListResolutionErrorCreator
.If you need more customization, extend the
StandardErrorFileListProcessor
or use a custom implementation ofIResolvedFileListProcessor
.The standard error behavior is as follows:
Form record attachment query
: Soft errorNoSourceFileFound
when not a single attachment was found.Referenced client file
: Hard errorNoSourceFileFound
when the referenced client file with the UUID does not exist in the system.Network resource
: Hard errorNetworkError
when either the URL is invalid or the data cannot be read from the network.Files from previously executed node
: Hard errorNoSourceFileFound
when the referenced node does not exist in the workflow, soft errorNoSourceFileFound
when the node was not executed or does not provide any files.Referenced form file
: Hard errorNoSourceFileFound
when the referenced form file with the UUID does not exist in the system.Uploads
: Hard errorNoSourceFileFound
when the referenced upload element does not exist in the workflow, soft errorNoSourceFileFound
when no attachment exists for the referenced upload element.
- A soft
NoSourceFileFound
is produced when at least one resolved file was found for a resource item, but the additionalfilter
excluded all those files. - A hard
FileSystem
is thrown when files could not be read from the file system or written to the file system. - A hard
DatabaseError
is thrown when an error occurred during the communication with the database. - A hard
General
error is thrown when an unexpected error occurred that could not be handled otherwise.
errorCreator
.- Parameters:
required
- Whether at least one file must be present. Whentrue
, an error is issued to the handler when not at least one file was found.errorCreator
- Instance that provides the error code and error data for each predefined standard file resolution error.- Returns:
- A processor that collects the resolved resource items into an optional with the first resolved file.
-
throwingException
INodeThrewExceptionBuilder throwingException()
When the node was executed, but an exception did occur, use this method to create a throwing exception and throw it. Please note that if you just throw some exception, it will be wrapped in aNodeThrewException
.- Returns:
- A builder for a throwing exception.
-
-