[jboss-user] [JBoss Seam] - Re: Ending multiple nested conversations?

vladimir.ralev@jboss.com do-not-reply at jboss.com
Sun Apr 22 09:43:14 EDT 2007


Actually it's better to use the instance methods


  |    /**
  |     * End a conversation together with all nested conversations. The
  |     * conversation passed in cid will be destroyed at the end of the
  |     * request while the nested conversations are destroyed immediately.
  |     * 
  |     * @param cid the ID of the conversation
  |     */   
  |    public void endConversationByID(String cid, boolean beforeRedirect)
  |    {
  |       log.debug("Ending long-running conversation");
  |       
  |       if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.endConversation");
  |      
  |       ConversationEntries ce = ConversationEntries.instance();
  |       setCurrentConversationId( cid );
  |       setCurrentConversationIdStack(
  |          ce.getConversationEntry( cid ).getConversationIdStack());
  |       setLongRunningConversation( false );
  |       destroyBeforeRedirect = beforeRedirect;
  |       endNestedConversations( cid );
  |       storeConversationToViewRootIfNecessary();
  |    }
  | 

with


  |    public String endParent()
  |    {
  |       Manager m = Manager.instance();
  |       m.endConversationByID(Conversation.instance().getParentId(), false);
  |       return "next.seam"; 
  |    }
  | 
  |    //Assuming conversations 1->2->3
  |    public String endParentOfParent()
  |    {
  |       Manager m = Manager.instance()
  | 
  |       // kill immediately 3, set Conversation.instance() to 2 and mark it to
  |       // be ended at the end of the request
  |       m.endConversationByID(Conversation.instance().getParentId(), false);
  |       
  |       // kill immediately 2, set Conversation.instance() to 1 and mark it to
  |       // be ended at the end of the request 
  |       m.endConversationByID(Conversation.instance().getParentId(), false); 
  |       return "next.seam"; 
  |    }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039600#4039600

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039600



More information about the jboss-user mailing list