Information Technology Reference
In-Depth Information
Tip
Downloading the example code
You can download the example code files for all Packt topics you have purchased from
your account at http://www.packtpub.com . If you purchased this topic elsewhere, you can
visit http://www.packtpub.com/support and register to have the files e-mailed directly to
you.
This process contains three components: a start node, a script node, and an end node. In
this case, this simple process is in charge of executing a simple action. The start and end
tasks simply specify a sequence.
Even if this is a correct way to create a process definition, it is not the recommended one
(unless you're making a low-level functionality test). Real-world, complex processes are
better off being designed in a process modeler, with visual tools, and exported to standard
representations such as BPMN 2.0. The output of both the cases is the same; a process ob-
ject that will be understandable by the jBPM6 runtime. While we analyze how the process
instance structures are created and how they are executed, this will do.
Process instance structures
Process instances represent the running processes and all the information being handled
by them. Every time you want to start a process execution, the engine will create a process
instance. Each particular instance will keep track of all the activities that are being created
by its execution.
In jBPM6, the structure is very similar to that of the process definitions, with one root
structure (the ProcessInstance object) in charge of keeping all the information and
NodeInstance objects to keep track of live nodes. The following code shows a simpli-
fication of the methods of the ProcessInstance implementation:
public class RuleFlowProcessInstance implements
ProcessInstance {
public RuleFlowProcess getRuleFlowProcess() { ... }
public long getId() { ... }
public void start() { ... }
public int getState() { ... }
public void setVariable(String name, Object value) { ... }
public Collection<NodeInstance> getNodeInstances() { ... }
Search WWH ::




Custom Search