Identifying operation flows

In this step, you examine the operations in detail and identify the operation flow for each operation. If appropriate, you plan the implementation of a flow processor.

In general, you will want each operation to use the same operation flow so that all operations can use the same operation steps. The Base Sample Application uses a simple operation flow that applies to all four of the operations.

On the client side, the operation flow for each operation consists of the following steps:
On the server side, the operation flow for each operation consists of the following steps:

These three server-side steps are the steps of a main flow for the four business operations that have been identified. The execution flow on the server side can be implemented as a state machine using the toolkit Automaton to define a flow processor. The three steps above are the states of the machine, and the state transitions are triggered by the events signaled by the services used inside the steps. Although the flow could also be implemented using simple operations (rather than a flow processor), you would be repeating the same code for each operation.

The flow processor for each operation has the following three main states:

The initial state, JournalHostRequestStep, records in the Electronic Journal the string that will be sent to the host. If the record is added to the Journal service without problems, an event is signaled, and the flow transitions to the second state, sendHostStep, which sends the message to the host. If this step finishes successfully, then another event is signaled, and the flow transitions to the next state, JournalHostReplyStep, which updates the record with the host response. If this step ends correctly, the flow transitions to the Final State.

Any error in one of the actions inside a step signals an event that causes a transition to an error state. After the flow processor has performed the proper actions in the error state, a new event leads it to the final state.

The following graph illustrates the flow processor, which has six states (the three main states, the error state, and the initial and final states):

For each of the four business operations, the Base Sample Application uses a specialized server operation (extending the DSEServerOperationProcessor) that can execute the associated flow processor as defined in an external file. This server operation runs the flow when it instantiates the operation.

Each business operation executes a generic flow. It is not channel-dependent and is highly reusable, so the same business operations can be used for different kinds of clients. In addition to the business operations, there is one presentation operation per channel. For example, in the case of an HTML client, the presentation operation is the flow of navigation that controls the operations.

The following figure shows that these two tasks (business operation and presentation operation) are clearly located in two separate blocks on the server side:

The HTML client implementation of the Base Sample Application illustrates the presentation operation, the business operations, and the multichannel capabilities of the toolkit. (The Java client could have a presentation operation on the client side, but in the sample application it does not.) The first task of the presentation operation (the navigation flow) is to set up a customer search page in which you can enter a customer ID. When the customer ID is entered, the flow sends a request with an "OK" event. This translates into a transition to the CustomerSearchOpState that executes the customer search process. This process receives from a dummy host a list of accounts that the application will use to render the next HTML page in the flow, which is the transaction page. From this page, you can execute the same business operations that you can from the Java application's desktop: the deposit, the withdrawal, and the account statement transactions. This presentation flow is controlled by the flow processor shown in the following diagram:

On the client side, the Base Sample Application uses only operations (customerSearchClientOp, withdrawalClientOp, and so on.) as identified in the previous step.

On the server side, each of the four business operations (customerSearchServerOp, withdrawalServerOp, and so on.) executes a flow processor, called genFlow, that runs the generic business flow.