KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portlet > forums > action > NewTopicAction


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Forums JBoss Portlet *
6  * *
7  * Distributable under GPL license. *
8  * See terms of license at gnu.org. *
9  * *
10  *****************************************/

11 package org.jboss.portlet.forums.action;
12
13 import java.util.Collections JavaDoc;
14 import java.util.List JavaDoc;
15
16 import org.jboss.portal.core.modules.ModuleException;
17 import org.jboss.portlet.forums.impl.MessageImpl;
18 import org.jboss.portlet.forums.impl.PollImpl;
19 import org.jboss.portlet.forums.impl.PosterImpl;
20 import org.jboss.portlet.forums.model.Forum;
21 import org.jboss.portlet.forums.model.Message;
22 import org.jboss.portlet.forums.model.Poll;
23 import org.jboss.portlet.forums.model.Poster;
24
25 /**
26  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
27  * @author <a HREF="mailto:theute@jboss.org">Thomas Heute</a>
28  * @version $Revision: 1.2 $
29  */

30 public class NewTopicAction
31    extends ForumAction
32 {
33    private int forumID;
34    private Poster poster;
35    private Message message;
36    private Poll poll;
37    private List JavaDoc attachments;
38    private Forum forum;
39
40    /**
41     * Creates a new {@link NewTopicAction} object.
42     *
43     * @param poster DOCUMENT_ME
44     * @param message DOCUMENT_ME
45     * @param forumID DOCUMENT_ME
46     * @param attachments DOCUMENT_ME
47     * @param poll DOCUMENT_ME
48     */

49    public NewTopicAction(Poster poster,
50                          Message message,
51                          int forumID,
52                          List JavaDoc attachments,
53                          Poll poll)
54    {
55       super(REFRESH);
56       this.poster = poster;
57       this.message = message;
58       this.forumID = forumID;
59       this.attachments = attachments;
60       this.poll = poll;
61    }
62
63    /**
64     * Creates a new {@link NewTopicAction} object.
65     *
66     * @param forumID DOCUMENT_ME
67     */

68    public NewTopicAction(int forumID)
69    {
70       super(INIT);
71       this.poster = new PosterImpl();
72       this.message = new MessageImpl();
73       this.forumID = forumID;
74       this.attachments = Collections.EMPTY_LIST;
75       this.poll = new PollImpl();
76    }
77
78    /**
79     * DOCUMENT_ME
80     *
81     * @return DOCUMENT_ME
82     */

83    public Poster getPoster()
84    {
85       return poster;
86    }
87
88    /**
89     * DOCUMENT_ME
90     *
91     * @return DOCUMENT_ME
92     */

93    public Forum getForum()
94    {
95       return forum;
96    }
97
98    /**
99     * DOCUMENT_ME
100     *
101     * @return DOCUMENT_ME
102     */

103    public Message getMessage()
104    {
105       return message;
106    }
107
108    /**
109     * DOCUMENT_ME
110     *
111     * @return DOCUMENT_ME
112     */

113    public List JavaDoc getAttachments()
114    {
115       return attachments;
116    }
117
118    /**
119     * DOCUMENT_ME
120     */

121    public void init()
122    {
123       try
124       {
125          forum = module.findForumByID(new Integer JavaDoc(forumID));
126          if (getMode() == INIT)
127          {
128             message.setSignatureEnabled((poster.getUser().getSignature() != null)
129                                         && (poster.getUser().getSignature().trim().length() != 0));
130          }
131       }
132       catch (ModuleException e)
133       {
134          throw new RuntimeException JavaDoc();
135       }
136    }
137
138    /**
139     * DOCUMENT_ME
140     *
141     * @return DOCUMENT_ME
142     */

143    public Poll getPoll()
144    {
145       return poll;
146    }
147 }
Popular Tags