This page goes through the excellent workflow patterns list showing how to implement them using BeanFlow.
Basic Control Patterns
Execute activities in sequence. Flash animation
There are a few ways to do this. The simplest is regular Java method calls.
public void useRegularMethodCalls() {
a();
b();
c();
}
Another option is to make each activity be a separate method and then chain them together.
The final step can do nothing (which puts the flow in to a suspend or it can explicitly call stop()
public String a() {
return "b";
}
public String b() {
return "c";
}
public void c() {
}
Execute activities in parallel. Flash animation
Firstly we can fork using explicit activity beans
public void myStep() {
fork(new ActivityA(), new ActivityB(), new ActivityC());
}
In this case each activity class can be any kind of activity; from a simple activity to a full workflow process.
If you are inside a workflow you may wish to fork the evaluation of separate steps in parallel using the method names in the current workflow.
e.g.
public void myStep() {
fork("a", "b", "c");
}
public void a() {
}
public void b() {
}
public void c() {
}
Synchronize two parallel threads of execution.
Choose one execution path from many alternatives
Merge two alternative execution paths