Information Technology Reference
In-Depth Information
Node instance structures
jBPM6 uses a node-instance-based approach to determine what steps are being executed by
the process instance. This means, for every active step in the process, a node instance ob-
ject exists in the process instance. When the step is completed, the node instance is re-
moved. This allows us to have a list of active steps in the process instance that are access-
ible by jBPM6 from the getNodeInstances method available from the NodeIn-
stanceContainer interface. The following code shows a simplification of the methods
of most of the node instance implementations:
public interface NodeInstance {
public ProcessInstance getProcessInstance() { ... }
public long getId() { ... }
public long getNodeId() { ... }
public void trigger(NodeInstance from, String type) { ... }
public void cancel() { ... }
}
Here, you can see that node instance objects have methods to trigger the execution of a par-
ticular step or to cancel it from the outside. It also has an identifier for itself, the step defin-
ition, and the process instance it belongs to.
Finally, we can assert the internal status of the process instance by the getState method.
Its implementation will return an integer value determined by constants in the Pro-
cessInstance interface to any of the following states:
STATE_PENDING : The process instance hasn't started yet
STATE_ACTIVE : The process instance is running
STATE_COMPLETED : The process instance has finished successfully
STATE_ABORTED : The process instance has been forcefully finished
STATE_SUSPENDED : The process instance is paused
Process instances are created based on the process definitions using a special Pro-
cessInstanceFactory implementation. This implementation contains the logic on
how to create and initialize process instances according to a particular process definition
and environment configuration. Since this factory is internally used by the exposed
runtime, let's start learning about the said runtime to get a better picture of using processes
in jBPM6.
Search WWH ::




Custom Search