3 Replies Latest reply on Oct 24, 2008 2:05 AM by shane.bryzak

    conversation-required: its purpose and its name are not related

      The bug JBSEAM-3480 was marked to day as Won't Fix and I am posting here to start a discussion trying to make its spirit reincarnate:




      Shane Bryzak wrote in JIRA:



      I've spent a bit of time playing with the test case, and it seems to be working as expected. I think there might be some misunderstanding as to the semantics of the conversation-required attribute in pages.xml, which we are to blame for as it is not clearly documented (I'll raise a separate issue to address this for next release). When a page is marked with conversation-required="true", it means that a previously started conversation must be propagated when that view is restored. This all happens in the RESTORE_VIEW phase, which is too early to know that you'll be calling a @Begin method in the INVOKE_APPLICATION phase.



      Based on Shane Bryzak  comment I now think that conversation-required does not do what its name say (prevent access to a page if a conversation is not active), of course it is inaccurate in many ways, so I propose the following:


      Deprecate the conversation-required="true" option, because it is not to prevent access to a page if a long running conversation is not active, it is to prevent access to a page if a previously started conversation has not been propagated when that view is restored. I really do not get when would we want to do that, but that is what it is for. I do think a new name that is a better fit to what it does should be chosen for it, but I couldn't think of a good one.


      We should have a new long-running-conversation-required="true" (I chose that number trusting that JBSEAM-3484, will be solved, if it is not, the accurate name would look funny: long-or-nested-running-conversation-required="true")  that does what we as users of the framework expect: prevent access to a page if a long conversation/nested conversation is not active. I think that new option should be as shortcut for this code:


      <page xmlns="http://jboss.com/products/seam/pages"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd"
            no-conversation-view-id="/Blank.xhtml" conversation-required="false">
            
         <action execute="#{categoryList.checkConversationRequired}"/>
                 
         <navigation from-action="#{categoryList.checkConversationRequired}">
         <rule if-outcome="forbidden">
          <redirect view-id="/NoConversation.xhtml">
          </redirect>
         </rule>
         </navigation>
      
      </page>
      
      
      public String checkConversationRequired(){
        Conversation conversation = Conversation.instance();
        if(conversation.isLongRunning() || conversation.isNested())
           return "ok";
        return "forbidden";
      } 
      



      So... since JBSEAM-3480 is marked as Won't Fix  should I create a new JIRA asking for long-running-conversation-required  as a new feature?