3 Replies Latest reply on Jun 17, 2008 9:35 PM by Neil C

    Relationship Between Pageflows and Process Definitions

    Neil C Novice

      I am working on an application that involves the rare phenomen of processing an order.  The flow involves a salesperson creating the order and then a shipper actually packaging the items and sending it off. The order component needs to persist across actors throughout the process.


      I have defined the pageflow-definition for the sales staff portion of it.  I will do the same for the shippers.  I would now like to do two things:



      1. To produce a process flow legend so that actors can see where they are in the process

      2. To have the order component persist in the business process context across actors



      The pageflow, although it is a JPDL definition, seems to be inadequate on its own for these things.  Can I modify the  pageflow-definition to allow me to do these?  Or do I have to have a companion process-definition to allow me to do this?  If the latter is true, how can I inform one of the other?  Where do I start to cross the line of redundancy?


      Let me know if I need to be clearer.  Any insight is appreciated.


      Thanks.


        • 1. Re: Relationship Between Pageflows and Process Definitions
          Dan Allen Master

          Pageflows and business processes are two distinct concepts. A pageflow only has the visibility of a single user and even then is transient. The best way to think of it is as a managed conversation. To get any indication of progress of a process you need a business process. The jBPM API can give you a tremendous amount of information about the state of a process. In fact, jBPM is built on Hibernate, so you can query the tables directly if you feel like the API is not serving you well.


          As for driving the business process, Seam has @CreateProcess, @ResumeProcess, @BeginTask, and @EndTask that work similarly to the conversation annotations. In fact, you can work on a task, start a page flow, and start a long-running conversation all with @BeginTask.

          • 2. Re: Relationship Between Pageflows and Process Definitions
            Neil C Novice

            Thanks, Dan, for the insight.  I am still not sure though how the two can work together.  In the scenario I described, would I then simply have two tasks?  One for the sales staff and one for the shippers since each will have a pageflow associated with it?


            Basically, when I get to the page that kicks off the order processing by the sales staff, it seems to me I should do both @CreateProcess and @BeginTask(pageflow="salesOrderPageflow"), which is the pageflow I have working now.  Then I will do an @EndTask when the sales staff confirms the order.  All the while, the order component is saved to the business process context.  Similarly, I will do @BeginTask(pageflow="shippingOrderPageflow") on the page that kicks things off for the shippers and do an @EndTask when they have sent the package off.


            The fact there are only two tasks worries me that I misunderstand the notion of a task.  With my current understanding, each task is a pageflow.  Does my description sound reasonable?


            By the way, I have been following the progress of your book closely, and I am really looking forward to its publication.


            Thanks.

            • 3. Re: Relationship Between Pageflows and Process Definitions
              Neil C Novice

              Here is an example of the issue I am having resolving where one process flow ends and another begins:


              First, my pageflow:


              <start-page view-id="/sales/beginOrder.jspx" name="beginOrder">
                    <description>Begin Order</description>
                    <redirect/>
                    <transition name="shop" to="shop"/>
                    <transition name="backToConfirmation" to="confirm"/>
               </start-page>
              <page view-id="/sales/shop.jspx" name="shop">
                    <description>Shop</description>     
                    <redirect/>
                    <transition name="addToOrder" to="shop">
                       <action expression="#{orderAction.addItem}"/>
                    </transition>
              </page>
              .
              .
              .
              



              Then my process-definition:


              <start-state name="start">     
                    <transition to="beginOrder"/>
              </start-state>
              <task-node name="beginOrder">
                    <task name="beginOrder" description="Begin Order">
                       <assignment actor-id="sales"/>
                    </task>
                    <transition name="shop" to="shop"/>
                    <transition name="backToConfirmation" to="confirm"/
              </task-node>
              <task-node name="shop">
                    <task name="shop" description="Shop for SRM's">
                       <assignment actor-id="sales"/>
                    </task>     
                    <transition name="addToOrder" to="shop">
                       <action expression="#{orderAction.addItem}"/>
                    </transition>
              </task-node>
              .
              .
              .
              



              As you can see, I am finding that I am repeating myself.  This smells bad to me, so I am sure that what I am doing is redundant.  Is this so?  How do I get the two to mesh?  For example, do I state the same transitions in both but specifiy the actions associated with those transitions only in the pageflow?


              Any insight is appreciated.


              Thanks.