Trace:
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
workflow:custom_function [2019/03/13 14:28] admin created |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ~~NOTRANS~~ | ||
- | ~~Title: Custom function~~ | ||
- | A function is behind the code block behind a task. It's very simple to create a new function because a function is defined as a single Java interface: | ||
- | |||
- | <file java IFunction.java> | ||
- | public interface IFunction | ||
- | { | ||
- | /** | ||
- | * The current workflow step. | ||
- | * @return The current workflow step. | ||
- | */ | ||
- | public IWorkflowStep getWorkflowStep(); | ||
- | |||
- | /** | ||
- | * Initializes the function. | ||
- | * | ||
- | * @param pWorkflow the current workflow step | ||
- | */ | ||
- | public void init(IWorkflowStep pWorkflow); | ||
- | |||
- | /** | ||
- | * Runs the function. | ||
- | * If the function returns true, the function is fully done, and the workflow jumps to the next step. | ||
- | * In case there are more then one next steps, the finish function of IWorkflowStep has to be called. | ||
- | * An exception will be thrown otherwise. | ||
- | * If finish is already called, it does not matter whether true or false is returned. | ||
- | * | ||
- | * @return true, if the function is done. | ||
- | * @throws Throwable if function fails. | ||
- | */ | ||
- | public boolean run() throws Throwable; | ||
- | |||
- | /** | ||
- | * Notifies, that the workflow is cancelled. | ||
- | * | ||
- | * @throws Throwable if canceling fails. | ||
- | */ | ||
- | public void cancel() throws Throwable; | ||
- | |||
- | } | ||
- | </file> |