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 ofINormalCompletionResultBuilderused 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 INormalCompletionResultBuilderalways(IValueCreator<?> alwaysValue)Sets (replaces) the value made available by the node regardless of whether it was executed successfully (or threw an exception).INormalCompletionResultbuild()INormalCompletionResultBuilderfile(IWorkflowFileValue fileValue)Sets (replaces) the files made available by the plugin when it was executed successfully.INormalCompletionResultBuildersoftError(String message, Throwable cause, Consumer<IUnionValueBuilder<String>> errorValue)Adds a soft error to the list of soft errors.INormalCompletionResultBuildersuccess(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.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
-
always
public INormalCompletionResultBuilder always(IValueCreator<?> alwaysValue)
Description copied from interface:ICompletionResultBuilderSets (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:
alwaysin interfaceICompletionResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>- Specified by:
alwaysin 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:
buildin interfaceorg.apache.commons.lang3.builder.Builder<INormalCompletionResult>
-
file
public INormalCompletionResultBuilder file(IWorkflowFileValue fileValue)
Description copied from interface:ICompletionResultBuilderSets (replaces) the files made available by the plugin when it was executed successfully. 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:
filein interfaceICompletionResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>- Specified by:
filein interfaceINormalCompletionResultBuilder- Parameters:
fileValue- File or files supplied by the plugin.- Returns:
- This builder for chaining methods calls.
-
softError
public INormalCompletionResultBuilder softError(String message, Throwable cause, Consumer<IUnionValueBuilder<String>> errorValue)
Description copied from interface:ISuccessResultBuilderAdds 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. SeesoftErrorsfor more details.// Adds a soft error with no additional data. builder.softError("bad data", b -> b.value("FOUND_BAD_DATA", new HashMap<>()));- Specified by:
softErrorin interfaceISuccessResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>- Parameters:
message- Message providing more details about the error .cause- The exception that caused the soft error. May benullwhen 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:ISuccessResultBuilderSets (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:
successin interfaceINormalCompletionResultBuilder- Specified by:
successin interfaceISuccessResultBuilder<INormalCompletionResultBuilder,INormalCompletionResult>- Parameters:
successValue- Function that takes a value builder to create the value.- Returns:
- This builder for chaining methods calls.
-
-