ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

JBoss Seam
Pages: 1, 2, 3, 4, 5

The most important feature that is shown here is the beginning of the conversation itself; the @Begin(join=true, processDefinition="shopping") on the doSearch() method will start a new conversation using the pageflow definition called shopping. This jBPM pageflow definition will define how the pages are related and define all of the transitions for this particular context. Here is our simple example:

<pageflow-definition [...]

   <start-state name="start">
      <transition to="browse"/>
   <page name="browse" view-id="/browse.xhtml" 
      <transition name="browse" to="browse"/>
      <transition name="checkout" to="checkout"/>
   <page name="checkout" view-id="/checkout.xhtml" 
      <transition name="checkout" to="checkout"/>
      <transition name="complete" to="complete"/>
   <page name="complete" view-id="/complete.xhtml" 
      <end-conversation />

You can automatically generate the above XML file using a visual pageflow editor in the jBPM IDE, shown in Figure 2. For each state, there is a corresponding page with a view-id linking to the actual resource and all available transitions. From the "browse" page, you have two possible transitions: "browse" when a user update his shopping cart and "checkout" when she clicks on the checkout button. From the "checkout" page, she can modify the number of articles in her cart then go back to the checkout page or complete her order. Each action method will return the name of the transition to pass. Once the order is made, the conversation ends and all of the objects stored in that conversation are freed.

Figure 2
Figure 2. The DVD store jBPM pageflow designer in the jBPM IDE

To see how nested conversations work, you can watch and study the "issues" example available in the project CVS.

Business Process Integration

jBPM is used to define a flow of pages, but Seam can also help you to integrate business processes defined using the jBPM Process Definition Language (JPDL).

You won't have to deal with the jBPM API; you only need to provide a JPDL descriptor (which can be built using the jBPM IDE) and annotate the method that will create and start a new process instance. The business process integration offers a new context, called the business process context. Anything added to a process instance will live during the whole instance. Your business process can drive your method calls. This lets the process transitions trigger some method calls.

Pages: 1, 2, 3, 4, 5

Next Pagearrow