1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.apache.myfaces.orchestra.conversation.jsf;
25
26 import org.apache.myfaces.orchestra.conversation.ConversationManager;
27
28 import javax.faces.context.FacesContext;
29
30 /***
31 * Some helpers usable for public use
32 */
33 public final class JsfConversationUtils
34 {
35 private JsfConversationUtils()
36 {
37 }
38
39 /***
40 * <p>if no conversation with name <code>conversationName</code> is active a navigation with
41 * the given action will be issued</p>
42 * <p/>
43 * Notice: optionally you can use the conversationName as "fromAction" in your faces-config.xml
44 * </p>
45 */
46 public static void ensureConversation(String conversationName, String action)
47 {
48 if (!ConversationManager.getInstance().hasConversation(conversationName))
49 {
50 FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(
51 FacesContext.getCurrentInstance(),
52 conversationName,
53 action
54 );
55 }
56 }
57 }