public interface ExecutableTask
Parameters of the task can be get using the provided task
execution context
, using the method TaskContext.getParameter(String)
. Task execution context provides also access to process variables, a
namespace, a parent context etc.
The following table describes the mapping between the model types and Java types:
GO-BPMN Model Type | Java Type |
---|---|
Boolean |
java.lang.Boolean
|
Integer |
com.whitestein.lsps.lang.Decimal
|
Decimal |
com.whitestein.lsps.lang.Decimal
|
String |
java.lang.String |
Date |
java.util.Date |
Object |
java.lang.Object |
List<T> |
com.whitestein.lsps.lang.exec.ListHolder |
Set<T> |
com.whitestein.lsps.lang.exec.SetHolder |
Map<K,V> |
com.whitestein.lsps.lang.exec.MapHolder |
Reference<T> |
com.whitestein.lsps.lang.exec.ReferenceHolder |
Closure |
com.whitestein.lsps.lang.exec.ClosureHolder |
record types |
com.whitestein.lsps.lang.exec.RecordHolder |
Task execution starts by the invoking the method start
. The initial code should be placed there. If the method returns
FINISHED
, the method
terminate
is called and
the task execution is finished. If the method returns
WAITING_FOR_INPUT
, the method
processInput
will be called when a
new input comes into the model instance. The method
processInput
is called repeatedly
with each new input until it returns FINISHED
.
Finally, the method terminate
is called the the task execution is finished.
The method terminate
is
called also when the task is terminated abnormally, e.g. by a timeout
intermediate event attached on the task.
The methods start
and
processInput
must be implemented
in such a way that the thread is not blocked.
The task methods may throw ErrorException
. It is equivalent to an
error modeled in the BPMN diagrams. Such an error can be caught by an error
intermediate event attached on the task.
If a task is implemented as a stateless session bean, it can use interceptor
RuntimeExceptionCatcherInterceptor
to catch all exceptions thrown from it's business
methods and convert them to ErrorException
.
Modifier and Type | Interface and Description |
---|---|
static class |
ExecutableTask.Result
A result controlling the task execution.
|
Modifier and Type | Method and Description |
---|---|
ExecutableTask.Result |
processInput(TaskContext context,
Object input)
The method for processing the model instance input.
|
ExecutableTask.Result |
start(TaskContext context)
An initial method that is called when the task execution starts.
|
void |
terminate(TaskContext context,
TerminationReason reason)
Called when this task is to be terminated.
|
ExecutableTask.Result start(TaskContext context) throws ErrorException
context
- null
ErrorException
- the BPMN errorExecutableTask.Result processInput(TaskContext context, Object input) throws ErrorException
This method is invoked when a previous call to either
start
method or
processInput
method returned
WAITING_FOR_INPUT
and a new input is to
be process by the model instance.
context
- input
- null
ErrorException
- the BPMN errorvoid terminate(TaskContext context, TerminationReason reason) throws ErrorException
context
- reason
- ErrorException
- the BPMN errorErrorException
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.