3 Replies Latest reply on May 4, 2007 1:26 PM by delphi'sghost

    Pageflow Question & Switcher Issue

    delphi'sghost

      FYI - using Seam 1.2.1 GA, with a seam-gen built app.

      I was having some issues with pageflows while I was writing a dummy app, and ended up running into so many brick walls with pageflows that I decided to write a PageFlow test application so I could determine how they really work. I have a page that starts page flows using method calls annotated with @Begin, or using the inline pageflow/conversation starter in s:link. They all work which is really nice. However, I did notice a couple of things :

      1) Using the begin-conversation in pages.xml means that you have to use join=true since anytime that page is refreshed, it tries to start a new conversation, which, when called from a long running conversation (as it is in this case since the page flow is a long running conversation) results in an error. To get around this, I set join = true and it works.

      This was documented in a Jira issue

      http://jira.jboss.org/jira/browse/JBSEAM-608, and was marked as fixed in Seam 1.1. Although maybe it was referring to the pageflow restarting each time, and not the conversation.

      I just wondered whether this was 'as intended' or whether there is an issue (join="true" is, I think , an acceptable solution)

      Also,

      2) The conversation switcher is never displaying conversations for a pageflow. When I start a pageflow with the conversation the description on the conversationEntry object is null. If I start a conversation and no pageflow, then the descriptions appear in the switcher just fine, so I know that the page description is correct and in the right place. I have a conversation logger bean that listens for conversation start/end events, and on the event, lists the conversationEntry descriptions which are all null when a pageflow is used (and set when no pageflow is used)
      I guess the problem is with description not being populated when needed.

      All the conversation, and pageflow elements are working fine. The switcher code is copied and pasted from the pdf seam reference guide with just to two example fixed items removed.

      I did search for any existing JIRA issues related to this problem, but didn't find any. I can fill out a JIRA for the issues unless someone can find an error in my thinking?

      I have stumbled across both of these issues outside of my example application, and they are very reproduceable.

      Here's the code basics :

       <page view-id="/countpage.xhtml">
       <begin-conversation join="true" pageflow="counter_page" />
       <description>
       Count page with value #{counter.value}
       </description>
       </page>
      



      S:Link to start the conversation and pageflow (starts conversation and pageflow, but no switcher)

       <s:link value="Start Flow From S link"
       view="/countpage.xhtml" propagation="begin" pageflow="counter_state">
       </s:link>
      
      


      S: link to start conversation only, which causes the conversation to appear in the switcher.

       <s:link value="Start Conversation Only From S link"
       view="/countpage.xhtml" propagation="begin">
       </s:link>
      
      


      For the pageflow, I have two almost identical ones, one for start-page and the other for start-state (as I said, it is a dummy app for testing page flows)


       <start-state name="start">
       <transition to="counterpage"/>
       </start-state>
      
       <page name="counterpage" view-id="/countpage.xhtml">
       <transition name="increase" to="counterpage" />
      
       <transition name="increaseExec" to="counterpage">
       <action expression="#{counter.increase}" />
       </transition>
      
       <transition name="decrease" to="counterpage" />
      
       <transition name="decreaseExec" to="counterpage">
       <action expression="#{counter.decrease}" />
       </transition>
      
       <transition name="done" to="complete" />
       </page>
      
       <page name="complete" view-id="/home.xhtml">
       <end-conversation />
       </page>
      


      The other one uses the counterpage as the start-page, and is identical.


      Switcher code (taken from the pdf seam reference guide), this resides in my template.xml file in the footer.

      <div class="footer"><h:form>
       <h:selectOneMenu value="#{switcher.conversationIdOrOutcome}">
       <f:selectItems value="#{switcher.selectItems}" />
       </h:selectOneMenu>
       <h:commandButton action="#{switcher.select}" value="Switch" />
      </h:form></div>
      
      



        • 1. Re: Pageflow Question & Switcher Issue
          pmuir

           

          "Delphi's Ghost" wrote:
          1) Using the begin-conversation in pages.xml means that you have to use join=true since anytime that page is refreshed, it tries to start a new conversation, which, when called from a long running conversation (as it is in this case since the page flow is a long running conversation) results in an error. To get around this, I set join = true and it works.


          Yes, I think this is correct. I need to think about it tho.

          http://jira.jboss.org/jira/browse/JBSEAM-608, and was marked as fixed in Seam 1.1. Although maybe it was referring to the pageflow restarting each time, and not the conversation.


          Yes, this was about the pageflow, not the conversation.

          2)
           <page view-id="/countpage.xhtml">
           <begin-conversation join="true" pageflow="counter_page" />
           <description>
           Count page with value #{counter.value}
           </description>
           </page>
          




          You need to put the description element on the page element in the pageflow, not in pages.xml.

          • 2. Re: Pageflow Question & Switcher Issue
            delphi'sghost

            Hey, thanks for the reply,


            Yes, I think this is correct. I need to think about it tho.


            Ok, my only thought was that nested=true would result in a new nested conversation on each render, and join = false results in errors on each render, so if it was by design, it would make those two attributes irrelevant on the <begin-conversation> tag.

            Wonder what happens if you put join=true and nested=true?


            You need to put the description element on the page element in the pageflow, not in pages.xml.


            Thanks, it works perfectly. It's always the little things that trip me up, and looking again, I see it talks about it in the reference guide. I can't believe I missed it, although it doesn't say you have to define it in the page flow, only that it lets you put a description per page.

            Thanks again,



            • 3. Re: Pageflow Question & Switcher Issue
              delphi'sghost

              Looking at this a bit more, it seems that join="true" might not be the best answer.
              In my dummy app, I have meeting objects which has one or more person objects as members. When editing the meeting, you can select "add member" to go to the person search page where you select a person and the pageflow takes you back to the meeting edit with the person added as a member.

              However, when on the person search page, you might want to invoke the add or edit person button to add or edit a person. The add/edit person page should have its own conversation and pageflow (right now, there is no pageflow). Bear in mind that add/edit person could be called from the search page (or a RESTful URL) without being part of a conversation, and therefore should be able to start it's own conversation.


              If I start my person edit conversation with <begin-conversation nested="true"/> :

              Edit meeting (start conversation A)
              click add member->goto person search page
              click add person->goto person edit page (start nested conversation B)
              click save person -> (end conversation B) goto person search page
              select my new person ->goto edit meeting page
              save my meeting (end conversation A)

              If I use join=true, which at the moment, the pageflow issue is forcing me to :

              Edit meeting (start conversation A)
              click add member->goto person search page
              click add person->goto person edit page (join conversation A)
              click save person -> (end conversation A) goto person search page
              ....I have no active conversation at this point!

              My person editor just ended my original conversation.

              So it looks like nested should be the best option when dealing with pageflows. However the problem there is that nested=true on the begin-conversation tag causes a new nested conversation with each page rendering. Again, it's this issue of repeating the conversation tag everytime the page is rendered.

              It sounds like the I should go submit a JIRA, and link back to this thread, and see what the powers that be think.

              OTOH, my little meet manager test app rocks with seam, I can add meetings go select people, and come back to the meeting editor, and the conversation stuff just makes it so painless and straightforward.