3 Replies Latest reply on Apr 12, 2007 9:27 AM by tomas kral

    Nested Page flows (jpdl) and conversations

    Nathan Thompson Newbie

      Hello all,

      I'm trying to understand how to properly implement nested page flows and conversations with jpdl.

      I would like to have a page flow that will be able to start a new nested flow, but take the outer flow back to a page within itself (but have the client display the start-page of the nested flow).

      Basically:

      1 LoginFlow -> log user in
      2 LoginFlow -> Allow user to select a module (section of the website)
      3 LoginFlow -> Start a nested flow for the module (which the client sees)
      4 LoginFlow -> go back to 2 (when the user switches workspaces back to this flow)

      The problem I've been having is that I don't know how to start a new nested page flow without having to define the nested flow's start-page in the outer flow. If I do define that page in the outer flow, then when the user switches workspaces back to the outer flow, the current node of the outer flow is set to the same page as the start-page of the nested flow.

      To put it another way: The page that ends up being rendered to the client is the destination node of the outer flow rather than the nested flow's start-page. What I want is for the outer flow to pause at the time that the nested flow is started, and resume when the user switches workspaces back to the outer flow (I could then define the destination of the outer flow to loop back to a previously displayed page node).

      Is it possible to do something like this? If so, can someone point me in the right direction?

      Thanks,

      Nate

        • 1. Re: Nested Page flows (jpdl) and conversations
          Norman Richards Master

          I'm not entirely sure I'm following, so I'll start with the obvious and see where it goes. Supposing that you start your nested conversation like this:

           @Begin(nested=true,pageflow="two")
           public void doSomething() { ... }
          


          Flow "two" just needs to start with a start-state:

          <pageflow-definition name="two">
           <start-state name="start">
           <transition to="node1" />
           </start-state>
          
           <page name="node1" view-id="/page.xhtml">
          ...
           </page>
          


          That will start a nested conversation and take you to "/page.xhtml".

          Is that what you were asking, or did I misread the question>

          • 2. Re: Nested Page flows (jpdl) and conversations
            Nathan Thompson Newbie

            No -- I think that I wasn't clear :)

            So here is what I'm trying to do:

            I'm trying to start a new page flow from within an existing flow using jpdl and not from an h:commandLink directly. I'm trying to keep page flow entirely confined to jpdl.

            I have a login page flow defined like so:

            <?xml version="1.0" encoding="UTF-8"?>
            
            <pageflow-definition name="login">
             <start-page name="start" view-id="/loginLanding.xhtml">
             <description>Select Module</description>
             <redirect/>
             <transition name="BILLINGMANAGER" to="billing">
             <action expression="${bMgrAccount.begin}"/>
             </transition>
             [ ... other module transitions defined ]
             </start-page>
            
             <page name="billing" view-id="/Billing_Manager/selectAccount.xhtml">
             <description>Billing Manager</description>
             </page>
            </pageflow-definition>
            


            My loginLanding.xhtml looks like this:
             <h:form>
             <ul>
             <ui:repeat value="${userManager.roles}" var="role">
             <li><h:commandLink action="${role.roles.getFlowname}">${role.roles.description}</h:commandLink></li>
             </ui:repeat>
             </ul>
             </h:form>
            


            And the billing flow is:
            <?xml version="1.0" encoding="UTF-8"?>
            
            <pageflow-definition name="bmgraccount">
             <start-page name="selAcct" view-id="/Billing_Manager/selectAccount.xhtml">
             <redirect/>
             <description>Select Account</description>
             <transition name="displayView" to="targetAction"/>
             </start-page>
            
             [ other transitions and pages not shown]
            </pageflow-definition>
            


            So for the Billing module, the Flowname for the commandLink action would be "BILLINGMANAGER". The login jpdl then calls the bMgrAccount.begin method, which looks like:

            @Stateful
            @Scope(ScopeType.CONVERSATION)
            @Name("bMgrAccount")
            public class BMgrAccountBean implements BMgrAccount {
             @Begin(join=false, nested=true, pageflow="bmgraccount")
             public void begin() {
             }
            
             [ other methods not shown]
            }
            


            Here's the problem:
            The user selects the billing module from the login landing page. In the login page flow the bMgrAccount.begin action is called and starts a new (nested) conversation and the bmgraccount page flow. However, the page that is displayed is the destination node from the login flow, not the <start-page> of the bmgraccount flow. This is, I suppose, OK up until the point that the user switches conversations back to the login flow. When the user does this, they are taken back to the the selectAccount page (b/c that is the last destination node of the login flow). What I would like to happen is for the loginLanding page to be displayed when the user switches conversations.

            I guess it comes down to whether or not it is possible to do what I want to do from within the jpdl files, or if I have to use the commandLink action attribute to directly call @Begin methods?

            Hope this was a little more clear. Thanks for any insight you can give me!

            Nate

            • 3. Re: Nested Page flows (jpdl) and conversations
              tomas kral Newbie

              Please, did you solved this scenario?

              What to define as target node "to" which is in different jpdl file (nested pageflow)?