Chapter 13th Implementation Mode
There are three basic process execution modes: objects, persistence, and embedding. For persistent and embedded execution patterns, process execution must be performed in a single transaction. In that case, the process execution must be placed inside an environment. The environment is used to bind process execution and update to a transaction that applies transactions. Environments can be used to bind, such as a JDBC connection, jta,bmt,spring transactions, and so on.
13.1. Object Execution Mode
Object execution mode is the simplest form of using a process virtual machine. This means that the process definition and execution objects are used directly through the client API. Let's illustrate this with an example. We start by creating a clientprocessdefinition that looks like this:
Object execution mode is the simplest form of using a process virtual machine. This means that the process definition and execution objects are used directly through the client API. Let's illustrate this with an example. We start by creating a clientprocessdefinition that looks like this:
Figure 13.1. Loan process
ClientProcessDefinition processDefinition = ProcessFactory.build("loan")
.activity("submit loan request").initial().behaviour(AutomaticActivity.class)
.transition().to("evaluate")
.activity("evaluate").behaviour(WaitState.class)
.transition("approve").to("wire money")
.transition("reject").to("end")
.activity("wire money").behaviour(AutomaticActivity.class)
.transition().to ("archive")
.activity("archive").behaviour(WaitState.class)
.transition ().to("end")
.activity("end").behaviour(WaitState.class)
.done();
Processfactory is a helper class that facilitates the construction of an object graph that behaves as a process definition. Automaticactivity is an activity through which no operation occurs, and Waitstate will wait until the external signal occurs. The implementation of both activities will be discussed further later.
The ProcessDefinition object acts as a factory, as a process instance object. A process instance behaves as an execution of a process definition. More precisely, the process instance is the main path of execution.
Clientexecution execution = processdefinition.startprocessinstance ();