-
1. Re: Declaratively end any levels of nested conversations
pmuir Jul 14, 2008 7:24 PM (in response to luxspes) -
2. Re: Declaratively end any levels of nested conversations
luxspes Jul 15, 2008 10:43 PM (in response to luxspes)Hi!
I wasn't sure if I should post this on JIRA or here, so I posted it in both (if that is wrong just tell me and I will not happen again):
Is @End(root=true) the most flexible way to deal with this problem? what if one need to end only 2 or 3 levels of nested conversations, wouldn't it be better if had an option like:
@End(levels="#{3}")
to end all nested conversation (but not root) (regardless of the nesting levels) something like
@End(levels="#{conversation.nestingLevel}")
and, to end the root conversation (regardless of the nesting levels) something like
@End(levels="#{conversation.nestingLevel+1}")
Of course that means we would need to add the nestingLevel to conversation.
Regards,
-
3. Re: Declaratively end any levels of nested conversations
luxspes Jul 15, 2008 10:50 PM (in response to luxspes)And same thing for .pages.xml:
<navigation from-action="#{bienMuebleHomeC.remove}"> <rule if="#{not empty bienMuebleFrom}"> <end-conversation levels="#{conversation.nestingLevel+1}"/> <redirect view-id="/Inventario/#{empty bienMuebleFrom ? 'BienMuebleListC' : bienMuebleFrom}.xhtml"/> </rule> </navigation>
What do you think?
-
4. Re: Declaratively end any levels of nested conversations
luxspes Aug 1, 2008 5:24 AM (in response to luxspes)Hi!
I do not think JBSEAM-1943 is the solution to my problem, because I do not need to end the root conversation, I need to end all nested conversations but keep the root one, at first, I thought that this would work:
private void endRootConversation() { Conversation conversation = Conversation.instance(); while(conversation.isNested()) { conversation.root(); } conversation.endBeforeRedirect(); }
but it obviusly doesnt (as it ends the root of all nested conversations).
So, since for now I only need to end 2 levels, I tried with:
private void endRootConversation() { Conversation conversation1 = Conversation.instance(); conversation.end(); Conversation conversation2 = Conversation.instance(); conversation.end(); }
But it doesn't seem to be working (it seems to be ending only one level of nested conversations).
Any hints on how could I end 2 levels? (or simply all nested ones but not the initial long running one?)
Thanks,
Regards,
-
5. Re: Declaratively end any levels of nested conversations
luxspes Aug 1, 2008 5:25 AM (in response to luxspes)I am sorry, my second example should have been:
private void endNestedConversations() { Conversation conversation1 = Conversation.instance(); conversation1.end(); Conversation conversation2 = Conversation.instance(); conversation2.end(); }
Thanks,
-
6. Re: Declaratively end any levels of nested conversations
luxspes Aug 1, 2008 10:24 PM (in response to luxspes)Finally found the way:
@Override public String remove() { String remove = super.remove(); switchToParentConversation(); return remove; } private void switchToParentConversation() { Conversation conversation1 = Conversation.instance(); Manager.instance().switchConversation(conversation1.getParentId()); }
after that, the .page.xml ends the right conversation:
<navigation from-action="#{someEntityHome.remove}"> <rule> <end-conversation /> <redirect view-id="someViewId.xhml" /> </rule> </navigation>
I still feel that this should be solved declaratively with:
<end-conversation levels="conversation.nestingLevel"/>
Regards,