[jboss-user] [JBoss Seam] - Re: Named conversation and new instance redirected to Home?

enda do-not-reply at jboss.com
Wed Feb 13 11:10:19 EST 2008


Hi Erik this is my working solution (I am handling conversation on my own)

entityManager that inherits generalManager

  | 
  | @Begin(flushMode = FlushModeType.MANUAL, join = true, pageflow = "teamHomeFlow")
  |     public String select(Team team) {
  |         // set conversation
  |         setConversationId(team.getId());
  |         // manually join conversation 
  |     if(joinConversation()) {
  |             return null;
  |         } else {
  |             return super.select(team);
  |         }        
  |     }
  | 
  | 

generalManager


  | 
  | /**
  |      * joins conversations
  |      * expects conversationName set with the same name as in pages.xml 
  |      *  
  |      * @return true if joined, false if not
  |      * 
  |      * @see http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126294#4126294
  |      */
  |     protected boolean joinConversation() {
  |         //ConversationEntries.getInstance().updateConversationId(Conversation.instance().getId(), getConversationId());
  |         
  |         ConversationEntry ce = ConversationEntries.getInstance().getConversationEntry(conversationName + ":" + conversationId);
  |         if(ce != null) {
  |             ce.redirect();             
  |             getFacesMessages().add("Conversation already exists");
  |             return true;
  |         } else {
  |             return false;
  |             
  |         }    
  |                 
  |     }
  | 
  | 

pages.xml


  | 
  |  <conversation name="teamHome"
  |                   parameter-name="team" 
  |                   parameter-value="#{teamActionManager.conversationId}"/>
  | 
  | 

the idea is that every xxManager has unique instance ID (entity.ID) and this id is assigned to its whole conversational life (it solves the problem with creating new entity too)

Conversation has the same name as instance ID

I am joining that on my own by instance ID.

The disadvantages is your naming convention for conversation and its usage also in xxManager not only in pages.xml (coupling)

I hope that it helps. Good thing is that I tested it from various scenarios and it works!

I also thank you for comments to convince Seam documentation to do this as their example.

Tomas

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

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



More information about the jboss-user mailing list