This page goes through the excellent workflow patterns list showing how to implement them using BeanFlow.
Basic Control Patterns
Sequence
Execute activities in sequence. Flash animation
There are a few ways to do this. The simplest is regular Java method calls.
Code Block |
---|
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()
Code Block |
---|
public String a() {
return "b";
}
public String b() {
return "c";
}
public void c() {
}
|
Parallel Split
Execute activities in parallel. Flash animation
Firstly we can fork using explicit activity beans
Code Block |
---|
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.
Code Block |
---|
public void myStep() {
fork("a", "b", "c");
}
public void a() {
// do something...
}
public void b() {
// do something...
}
public void c() {
// do something...
}
|
Synchronization
Synchronize two parallel threads of execution.
Exclusive Choice
Choose one execution path from many alternatives
Simple Merge
Merge two alternative execution paths