<br><br><div class="gmail_quote">On Mon, Feb 1, 2010 at 4:01 PM, William Draï <span dir="ltr">&lt;<a href="mailto:william.drai@graniteds.org">william.drai@graniteds.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>Right for the ConversationManager.beginConversation, there is already Conversation.begin. I&#39;ve been mistaken by the ConversationManager.endConversation of Niklas&#39; proposal.</div><div><br></div>I can maybe explain how we use the currently existing API, and in fact we are relatively happy with what exists today, except for one thing :<div>


<br></div><div>start() {</div><div>    ConversatonManager manager = { get from BeanManager };</div><div>    manager.beginOrRestoreConversation(cid);</div><div>    Conversation conversation = { get from BeanManager };</div>


<div><br></div><div>    // Beginning of the ugly part !!</div><div>    String cid = ((ConversationImpl)conversation).getUnderlyingId();</div><div>    ConversationContext ctx = Container.instance().deploymentServices().get(ContextLifecycle.class).getConversationContext();</div>


<div>    ctx.setBeanStore(new ConversationBeanStore(httpSession, cid));</div><div>    ctx.setActive(true);</div><div>    // End of the ugly part<br><div><br></div><div>    if (cid != null &amp;&amp; conversation.isTransient())  // Don&#39;t remember why I need this, beginOrRestore should be enough</div>


<div>        conversation.begin(cid);<br><div>}</div><div><br></div><div>end() {</div><div>    ConversationManager manager = { get from BeanManager };</div><div>    manager.cleanupConversation();</div><div>}</div><div><br>


</div><div>The main thing is that I would prefer not having to mess with bean stores and contexts, so the manager.activateContext() looks fine. Ideally here what I would like to do (I know, I&#39;m too lazy :-)) : </div>

<div>
<br></div><div><div>start() {</div><div>    ConversatonManager manager = { get from BeanManager };</div><div>    manager.startupConversation();</div><div><br></div><div>    if (cid != null &amp;&amp; conversation.isTransient())</div>


<div>        conversation.beginOrRestoreConversation(cid);<br></div><div>}</div><div><div><div><br></div><div>end() {</div><div>    ConversationManager manager = { get from BeanManager };</div><div>    manager.cleanupConversation();</div>


<div>}</div><div><br></div><div>From Flex, there is no need to switch the conversation in a particular request, but getting the list of the currently existing conversations with ConversationManager.getCurrentConversationIds() can be useful.</div>


<div><br></div></div></div></div></div></div></blockquote><div><br></div><div>The beanstore-thingie with underlyingId will most likely go away soon as we are tuning the contexts to survive session invalidation with a two-stage BeanStore (that doesn&#39;t require id:s for transient conversations) so you</div>
<div>will probably get away with a single call to activate the conversation context to start with a fresh transient conversation.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div><div><div><div><div></div><div>Finally I really think it&#39;s necessary to be able to share a conversation instance between different UIs and use the same ConversationContext implementation for all. We could obviously ship a FlexConversationContext with GraniteDS/CDI but we want to make possible to build applications where a part of the UI uses JSF, another part uses Flex and why not another uses ZK or the iPhone SDK.</div>


<div><br></div><font color="#888888"><div></div></font></div></div></div></div></div></blockquote><div><br></div><div>&quot;Sharing a conversation instance&quot; as in &quot;running it on several UI:s simultaneously&quot; might be a bit tricky as the conversations don&#39;t pass the session boundary (per spec) when running in JSF</div>
<div><br></div></div>-- <br>---<br>Nik<br>