5 Replies Latest reply on Oct 12, 2007 8:32 AM by Jonas Buechel

    Conversation management in a desktop-like applikation

    Jonas Buechel Novice

      I'm developing an application which has a similar look and feel as a desktop app. So there is a dropdown menu.

      What i've done to open the different modules from the menu is just like this:

      old menuItem.xhtml

      <rich:menuItem value="#{messages.menu_manage_persons}"
       action="/modules/manageCatalogs/persons/main.xhtml" />
      .....


      As i'm thinking of having a new long-running-conversation on each (more complex) module.
      For ending the previous conversation for each menu item i ended up in writing a more complicated (more code) solution as following:

      new menuItem.xhtml
      <rich:menuItem value="#{messages.menu_manage_persons}"
       action="#{navigationManager.managePersons}" />
      

      new NavigationManager class
      @Scope(ScopeType.STATELESS)
      @Name("navigationManager")
      public class NavigationManager {
      
       public void queryOnlineDirectory() {
      
       }
       public void managePersons() {
      
       }
      ...
      

      new entry in pages.xml
      <page view-id="/*" login-required="true">
      
       <navigation from-action="#{navigationManager.queryOnlineDirectory}">
       <end-conversation />
       <redirect view-id="/modules/queryCatalog/catalog/main.xhtml" />
       </navigation>
       <navigation from-action="#{navigationManager.managePersons}">
       <end-conversation />
       <redirect view-id="/modules/manageCatalogs/persons/main.xhtml" />
       </navigation>
       ....
       </page>
      


      I tried quite a lot ways to get around the NavigationManager class, but i couldn't figure out to achive this..

      It would be greate if someone could give me a hint how to get around the use of the NavigationManager class (there are much more menu items of course and i don't like to implement this "needless" class)..


        • 1. Re: Conversation management in a desktop-like applikation
          Stuart Douglas Master


          Seam contains el enhancements that allow you to pass parameters to action methods, so to make it a bit less verbose you could try:

          @End
          String navFunc(String param)
          {
          return param;
          }
          


          <rich:menuItem value="#{messages.menu_manage_persons}"
          action="#{MyClass.navFunc('/modules/manageCatalogs/persons/main.xhtml')}" />
          


          Although you still need a class to put the navFunc method on, so it does not help that much.

          • 2. Re: Conversation management in a desktop-like applikation
            Pete Muir Master

            Why not send logical outcomes from the action="" on the menu and then do a outcome based navigation in pages.xml

            • 3. Re: Conversation management in a desktop-like applikation
              Jonas Buechel Novice

              @swd847:
              Thanks, anyway this sounds better than the current solution.

              @Pete:
              Thanks, that was exactly what i was looking for. I didn't even know that's possible!

              For those who are interested and happy about a code snippet:
              menuItems.xhtml

              <rich:menuItem value="#{messages.menu_manage_persons}"
               action="manage_persons"
               rendered="#{s:hasRole('manage_persons')}" />
              

              pages.xml
              <page view-id="/*" login-required="true">
               <navigation>
              ...
               <rule if-outcome="manage_persons">
               <end-conversation />
               <redirect view-id="/modules/manageCatalogs/persons/main.xhtml" />
               </rule>
              ...
               </navigation>
              </page>
              


              • 4. Re: Conversation management in a desktop-like applikation
                Jonas Buechel Novice

                I'm still fighting with the conversation management:
                I'm trying to begin and end conversations through configuration within the pages.xml:

                <page view-id="/*" login-required="true">
                 <action execute="#{conversationTracker.logConversationState}" />
                
                 <navigation>
                 <rule if-outcome="query_online_directory">
                 <end-conversation before-redirect="true" />
                 <redirect view-id="/modules/queryCatalog/catalog/main.xhtml" />
                 </rule>
                 <rule if-outcome="manage_organigrams">
                 <end-conversation before-redirect="true"/>
                 <redirect view-id="/modules/manageCatalogs/organigram/selectMission.xhtml" />
                 </rule>
                 </navigation>
                 </page>
                
                 <page view-id="/modules/manageCatalogs/organigram/selectMission.xhtml">
                 <navigation evaluate="#{conversation.longRunning}">
                 <rule if-outcome="false">
                 <begin-conversation join="false" flush-mode="manual" />
                 </rule>
                 </navigation>
                 </page>
                

                My intention is to end the previous long running conversation and begin an new one on the outcome "manage_organigrams".

                It's almost working:
                Case 1:
                If the previous view-id was "/modules/queryCatalog/catalog/main.xhtml" i get the "The conversation ended, timed out or was processing another request" message after a few clicks within the view-id "/modules/manageCatalogs/organigram/selectMission.xhtml".

                Case 2:
                If the previous view-id was "/modules/manageCatalogs/organigram/selectMission.xhtml" it's working correctly..

                Some output from the conversation tracker:
                Case 1:
                Click on menu item which switchs from view-id "/modules/queryCatalog/catalog/main.xhtml" to view-id "/modules/manageCatalogs/organigram/selectMission.xhtml":
                14:06:59,187 DEBUG [ConversationTracker] *********** Start log entry ***********
                14:06:59,187 DEBUG [ConversationTracker] LONG RUNNING CONVERSATION: NO
                14:06:59,187 DEBUG [ConversationTracker] NESTED CONVERSATION: NO
                14:06:59,187 DEBUG [ConversationTracker] CONVERSATION ID: 59
                14:06:59,187 DEBUG [ConversationTracker] CONVERSATION VIEW ID: null
                14:06:59,187 DEBUG [ConversationTracker] CONVERSATION DESCRIPTION: null
                14:06:59,187 DEBUG [ConversationTracker] ************ End log entry ************
                14:06:59,187 DEBUG [ConversationTracker] BEGIN CONVERSATION: 59
                14:06:59,328 DEBUG [MissionServiceImpl] initializeMissions() called
                14:06:59,343 INFO [STDOUT] Hibernate: select mission0_.id as id4_, mission0_.name as name4_, mission0_.identifier as identifier4_, mission0_.enddate as enddate4_, mission0_.startdate as startdate4_, mission0_.active as active4_, mission0_.activationDate as activati7_4_, mission0_.deactivationDate as deactiva8_4_ from NMSWEBOWN.Mission mission0_ order by mission0_.name
                


                Click 1 withing view-id "/modules/manageCatalogs/organigram/selectMission.xhtml":
                14:07:05,515 INFO [MissionDataModelManager] select() called
                14:07:05,531 DEBUG [ConversationTracker] *********** Start log entry ***********
                14:07:05,531 DEBUG [ConversationTracker] LONG RUNNING CONVERSATION: YES
                14:07:05,531 DEBUG [ConversationTracker] NESTED CONVERSATION: NO
                14:07:05,531 DEBUG [ConversationTracker] CONVERSATION ID: 59
                14:07:05,531 DEBUG [ConversationTracker] CONVERSATION VIEW ID: null
                14:07:05,531 DEBUG [ConversationTracker] CONVERSATION DESCRIPTION: null
                14:07:05,531 DEBUG [ConversationTracker] ************ End log entry ************
                

                Click 2 withing view-id "/modules/manageCatalogs/organigram/selectMission.xhtml":
                14:07:13,546 DEBUG [MissionServiceImpl] initializeMissions() called
                14:07:13,546 INFO [STDOUT] Hibernate: select mission0_.id as id4_, mission0_.name as name4_, mission0_.identifier as identifier4_, mission0_.enddate as enddate4_, mission0_.startdate as startdate4_, mission0_.active as active4_, mission0_.activationDate as activati7_4_, mission0_.deactivationDate as deactiva8_4_ from NMSWEBOWN.Mission mission0_ order by mission0_.name
                14:07:13,625 INFO [MissionDataModelManager] select() called
                14:07:13,625 DEBUG [ConversationTracker] BEGIN CONVERSATION: 60
                14:07:13,625 DEBUG [ConversationTracker] *********** Start log entry ***********
                14:07:13,625 DEBUG [ConversationTracker] LONG RUNNING CONVERSATION: YES
                14:07:13,625 DEBUG [ConversationTracker] NESTED CONVERSATION: NO
                14:07:13,625 DEBUG [ConversationTracker] CONVERSATION ID: 60
                14:07:13,625 DEBUG [ConversationTracker] CONVERSATION VIEW ID: null
                14:07:13,625 DEBUG [ConversationTracker] CONVERSATION DESCRIPTION: null
                14:07:13,625 DEBUG [ConversationTracker] ************ End log entry ************
                

                After click 2 the conversation is lost somehow and the message "The conversation ended, timed out or was processing another request" is displayed.

                Case 2:
                Click on menu item which reloads view-id "/modules/manageCatalogs/organigram/selectMission.xhtml":
                It works fine and i can do as many clicks withing view-id "/modules/manageCatalogs/organigram/selectMission.xhtml" as i want..

                Help would be very appreciated cause i'm really running out of ideas..


                • 5. Re: Conversation management in a desktop-like applikation
                  Jonas Buechel Novice

                  I just figured out if i add the following to the pages.xml it works for this two view-ids..

                  <page view-id="/modules/queryCatalog/catalog/main.xhtml">
                   <navigation evaluate="#{conversation.longRunning}">
                   <rule if-outcome="false">
                   <begin-conversation join="false" flush-mode="manual" />
                   </rule>
                   </navigation>
                   </page>
                  


                  So the shaky behavior seems to depend on wether the conversation of the previous view-id was long running or not.. !?