1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.custom.conversation;
20
21 import javax.faces.component.StateHolder;
22 import javax.faces.context.FacesContext;
23 import javax.faces.event.AbortProcessingException;
24 import javax.faces.event.ActionEvent;
25 import javax.faces.event.ActionListener;
26
27
28
29
30
31 public abstract class AbstractConversationActionListener implements ActionListener, StateHolder
32 {
33 private String conversationName;
34
35 private transient boolean isTransient;
36
37 public AbstractConversationActionListener()
38 {
39 }
40
41
42
43
44 public String getConversationName()
45 {
46 return conversationName;
47 }
48
49
50
51
52
53
54 public void setConversationName(String conversationName)
55 {
56 this.conversationName = conversationName;
57 }
58
59
60 public Object saveState(FacesContext context)
61 {
62 return new Object[]
63 {
64 conversationName
65 };
66 }
67
68 public void restoreState(FacesContext context, Object state)
69 {
70 Object[] states = (Object[]) state;
71 conversationName = (String) states[0];
72 }
73
74 public boolean isTransient()
75 {
76 return isTransient;
77 }
78
79 public void setTransient(boolean newTransientValue)
80 {
81 isTransient = newTransientValue;
82 }
83
84 public void processAction(ActionEvent actionEvent) throws AbortProcessingException
85 {
86 AbstractConversationComponent startOrEndconversation = ConversationUtils.findStartOrEndConversationComponent(actionEvent.getComponent(), getConversationName());
87
88 doConversationAction(startOrEndconversation);
89 }
90
91
92
93
94 public abstract void doConversationAction(AbstractConversationComponent abstractConversationComponent);
95 }