Class NormalCompletionResultBuilder
- java.lang.Object
-
- de.xima.fc.workflow.processor.logic.execution.NormalCompletionResultBuilder
-
- All Implemented Interfaces:
ICompletionResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>
,INormalCompletionResultBuilder
,ISuccessResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>
,org.apache.commons.lang3.builder.Builder<INormalCompletionResult>
public final class NormalCompletionResultBuilder extends Object implements INormalCompletionResultBuilder
Default implementation ofINormalCompletionResultBuilder
used by the task runner. A new instance should be each time a node was processed.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Constructor Description NormalCompletionResultBuilder(INodeHandler<?> handler, WorkflowNode node)
A new result builder for a node of a certain type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description INormalCompletionResultBuilder
always(IValueCreator<?> alwaysValue)
Sets (replaces) the value made available by the node regardless of whether it was executed successfully (or threw an exception).INormalCompletionResultBuilder
attachment(IWorkflowAttachmentValue attachmentValue)
Sets (replaces) the attachments created by the plugin when it was executed.INormalCompletionResult
build()
INormalCompletionResultBuilder
file(IWorkflowFileValue fileValue)
Sets (replaces) the files made available by the plugin when it was executed.INormalCompletionResultBuilder
softError(String message, Throwable cause, Consumer<IUnionValueBuilder<String>> errorValue)
Adds a soft error to the list of soft errors.INormalCompletionResultBuilder
success(IValueCreator<?> successValue)
Sets (replaces) the value returned by the node when it was executed successfully.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.interfaces.workflow.params.ICompletionResultBuilder
attachment, attachment
-
Methods inherited from interface de.xima.fc.interfaces.workflow.params.INormalCompletionResultBuilder
always, file, file, success
-
Methods inherited from interface de.xima.fc.interfaces.workflow.params.ISuccessResultBuilder
softError, softError
-
-
-
-
Constructor Detail
-
NormalCompletionResultBuilder
public NormalCompletionResultBuilder(INodeHandler<?> handler, WorkflowNode node)
A new result builder for a node of a certain type.- Parameters:
handler
- Handler for the node type.node
- Node that wants to return a value.
-
-
Method Detail
-
attachment
public INormalCompletionResultBuilder attachment(IWorkflowAttachmentValue attachmentValue)
Description copied from interface:ICompletionResultBuilder
Sets (replaces) the attachments created by the plugin when it was executed. When this method is not called, the default value from theIExecutionResultDescriptor.getAttachmentValueDescriptor()
is used. When this method is called multiple times, only the value supplied by the last invocation is used.- Specified by:
attachment
in interfaceICompletionResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>
- Parameters:
attachmentValue
- Attachment or attachments created by the workflow node.- Returns:
- This builder for chaining methods calls.
-
always
public INormalCompletionResultBuilder always(IValueCreator<?> alwaysValue)
Description copied from interface:ICompletionResultBuilder
Sets (replaces) the value made available by the node regardless of whether it was executed successfully (or threw an exception). When this method is not called, the default value from theIExecutionResultDescriptor.getAlwaysValueDescriptor(IValueDescriptorFactory)
is used. When this method is called multiple times, only the value supplied by the last invocation is used.For example, when you wish to return a record with two properties:
// Corresponds to the JSON object {"foo": "bar", "baz": 42} builder.success(b -> b.asRecord().property("foo", "bar").property("baz", 42);
- Specified by:
always
in interfaceICompletionResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>
- Specified by:
always
in interfaceINormalCompletionResultBuilder
- Parameters:
alwaysValue
- Function that takes a value builder to create the value.- Returns:
- This builder for chaining methods calls.
-
build
public INormalCompletionResult build()
- Specified by:
build
in interfaceorg.apache.commons.lang3.builder.Builder<INormalCompletionResult>
-
file
public INormalCompletionResultBuilder file(IWorkflowFileValue fileValue)
Description copied from interface:ICompletionResultBuilder
Sets (replaces) the files made available by the plugin when it was executed. When this method is not called, the default value from theIExecutionResultDescriptor.getFileValueDescriptor()
is used. When this method is called multiple times, only the value supplied by the last invocation is used.- Specified by:
file
in interfaceICompletionResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>
- Specified by:
file
in interfaceINormalCompletionResultBuilder
- Parameters:
fileValue
- File or files supplied by the workflow node.- Returns:
- This builder for chaining methods calls.
-
softError
public INormalCompletionResultBuilder softError(String message, Throwable cause, Consumer<IUnionValueBuilder<String>> errorValue)
Description copied from interface:ISuccessResultBuilder
Adds a soft error to the list of soft errors. 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. SeesoftErrors
for more details.// Adds a soft error with no additional data. builder.softError("bad data", b -> b.value("FOUND_BAD_DATA", new HashMap<>()));
- Specified by:
softError
in interfaceISuccessResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>
- Parameters:
message
- Message providing more details about the error .cause
- The exception that caused the soft error. May benull
when not caused by any exception.errorValue
- Function that takes a value builder to create the error value.- Returns:
- This builder for chaining methods calls.
-
success
public INormalCompletionResultBuilder success(IValueCreator<?> successValue)
Description copied from interface:ISuccessResultBuilder
Sets (replaces) the value returned by the node when it was executed successfully. This value is ignored unless the node was actually executed successfully. When this method is not called, the default value from theIExecutionResultDescriptor.getSuccessValueDescriptor(IValueDescriptorFactory)
is used. When this method is called multiple times, only the value supplied by the last invocation is used.For example, when you wish to return a record with two properties:
// Corresponds to the JSON object {"foo": "bar", "baz": 42} builder.success(b -> b.asRecord().property("foo", "bar").property("baz", 42);
- Specified by:
success
in interfaceINormalCompletionResultBuilder
- Specified by:
success
in interfaceISuccessResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>
- Parameters:
successValue
- Function that takes a value builder to create the value.- Returns:
- This builder for chaining methods calls.
-
-