KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portlet > forums > ForumsModule


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;
12
13 import org.jboss.portal.core.model.User;
14 import org.jboss.portal.core.modules.ModuleException;
15 import org.jboss.portlet.forums.model.*;
16
17 import java.util.Date JavaDoc;
18 import java.util.List JavaDoc;
19
20 /**
21  * @author <a HREF="mailto:theute@jboss.org">Thomas Heute </a>
22  * @version $Revision: 1.9 $
23  */

24 public interface ForumsModule
25 {
26    /**
27     * Returns all the announcements of the forum
28     *
29     * @param forum Forum in which we want to search for the announcements
30     * @return List of topics
31     * @throws ModuleException Throws an exception if unable to find the announcements.
32     */

33    List JavaDoc findAnnouncements(Forum forum)
34          throws ModuleException;
35
36    /**
37     * Returns some topics of a forum that are not of a certain type
38     * The topics are ordered by creation date from oldest to newest
39     *
40     * @param forum Forum in which we want to search for topics
41     * @param type Type to avoid
42     * @param start Index for fetching result
43     * @param perPage Number of result to return
44     * @return List of perPage topics ordered by creation date.
45     * @throws ModuleException Throws an excpetion if unable to find the topics.
46     */

47    List JavaDoc findTopicsAsc(Forum forum,
48                       int type,
49                       int start,
50                       int perPage)
51          throws ModuleException;
52
53    /**
54     * Returns some topics of a forum that are not of a certain type
55     * The topics are ordered by creation date from newest to oldest
56     *
57     * @param forum Forum in which we want to search for topics
58     * @param type Type to avoid
59     * @param start Index for fetching result
60     * @param perPage Number of result to return
61     * @return List of perPage topics ordered by opposite creation date.
62     * @throws ModuleException Throws an excpetion if unable to find the topics.
63     */

64    List JavaDoc findTopicsDesc(Forum forum,
65                        int type,
66                        int start,
67                        int perPage)
68          throws ModuleException;
69
70    /**
71     * DOCUMENT_ME
72     *
73     * @param forum DOCUMENT_ME
74     * @param type DOCUMENT_ME
75     * @param start DOCUMENT_ME
76     * @param perPage DOCUMENT_ME
77     * @param date DOCUMENT_ME
78     * @return DOCUMENT_ME
79     * @throws ModuleException DOCUMENT_ME
80     */

81    List JavaDoc findTopicsBefore(Forum forum,
82                          int type,
83                          int start,
84                          int perPage,
85                          Date JavaDoc date)
86          throws ModuleException;
87
88    /**
89     * Find a forum by specifying its ID
90     *
91     * @param id ID of the forum to retrieve
92     * @return Forum with specified ID
93     * @throws ModuleException Throws an exception if the forum cannot be found
94     */

95    Forum findForumByID(Integer JavaDoc id)
96          throws ModuleException;
97
98    /**
99     * DOCUMENT_ME
100     *
101     * @param category DOCUMENT_ME
102     * @param name DOCUMENT_ME
103     * @param description DOCUMENT_ME
104     * @return DOCUMENT_ME
105     * @throws ModuleException DOCUMENT_ME
106     */

107    Forum createForum(Category category,
108                      String JavaDoc name,
109                      String JavaDoc description)
110          throws ModuleException;
111
112    /**
113     * DOCUMENT_ME
114     *
115     * @param id DOCUMENT_ME
116     * @return DOCUMENT_ME
117     * @throws ModuleException DOCUMENT_ME
118     */

119    Post findPostByID(Integer JavaDoc id)
120          throws ModuleException;
121
122    /**
123     * DOCUMENT_ME
124     *
125     * @param userID DOCUMENT_ME
126     * @return DOCUMENT_ME
127     * @throws ModuleException DOCUMENT_ME
128     */

129    Poster findPosterByUserID(Integer JavaDoc userID)
130          throws ModuleException;
131
132    /**
133     * Get all the categories of forums.
134     *
135     * @return All the categories
136     * @throws ModuleException
137     */

138    List JavaDoc findCategories()
139          throws ModuleException;
140
141    /**
142     * DOCUMENT_ME
143     *
144     * @return DOCUMENT_ME
145     * @throws ModuleException DOCUMENT_ME
146     */

147    List JavaDoc findForums()
148          throws ModuleException;
149
150    /**
151     * Get all the forums of a category
152     *
153     * @param categoryID Category of forums
154     * @return Forums of one category
155     */

156    List JavaDoc findForumsByCategoryID(Integer JavaDoc categoryID)
157          throws ModuleException;
158
159    /**
160     * DOCUMENT_ME
161     *
162     * @param forum DOCUMENT_ME
163     * @param message DOCUMENT_ME
164     * @param creationDate DOCUMENT_ME
165     * @param poster DOCUMENT_ME
166     * @return The new post created
167     * @throws ModuleException DOCUMENT_ME
168     */

169    Post createTopic(Forum forum,
170                     Message message,
171                     Date JavaDoc creationDate,
172                     Poster poster,
173                     int type)
174          throws ModuleException;
175
176    /**
177     * DOCUMENT_ME
178     *
179     * @param topic DOCUMENT_ME
180     * @param forum DOCUMENT_ME
181     * @param message DOCUMENT_ME
182     * @param creationTime DOCUMENT_ME
183     * @param poster DOCUMENT_ME
184     * @return DOCUMENT_ME
185     * @throws ModuleException DOCUMENT_ME
186     */

187    Post createPost(Topic topic,
188                    Forum forum,
189                    Message message,
190                    Date JavaDoc creationTime,
191                    Poster poster)
192          throws ModuleException;
193
194    /**
195     * DOCUMENT_ME
196     *
197     * @param name DOCUMENT_ME
198     * @return DOCUMENT_ME
199     * @throws ModuleException DOCUMENT_ME
200     */

201    Category createCategory(String JavaDoc name)
202          throws ModuleException;
203
204    /**
205     * DOCUMENT_ME
206     *
207     * @param category DOCUMENT_ME
208     * @throws ModuleException DOCUMENT_ME
209     */

210    void removeCategory(Category category)
211          throws ModuleException;
212
213    /**
214     * DOCUMENT_ME
215     *
216     * @param forum DOCUMENT_ME
217     * @throws ModuleException DOCUMENT_ME
218     */

219    void removeForum(Forum forum)
220          throws ModuleException;
221
222    /**
223     * Delete a post
224     *
225     * @param post Post to delete
226     * @throws ModuleException DOCUMENT_ME
227     */

228    void removePost(Post post)
229          throws ModuleException;
230
231    /**
232     * Delete a topic
233     *
234     * @param topic Topic to delete
235     * @throws ModuleException DOCUMENT_ME
236     */

237    void removeTopic(Topic topic)
238          throws ModuleException;
239
240    /**
241     * DOCUMENT_ME
242     *
243     * @param categoryID DOCUMENT_ME
244     * @return DOCUMENT_ME
245     * @throws ModuleException DOCUMENT_ME
246     */

247    Category findCategoryByID(Integer JavaDoc categoryID)
248          throws ModuleException;
249
250    /**
251     * DOCUMENT_ME
252     *
253     * @param source DOCUMENT_ME
254     * @param target DOCUMENT_ME
255     */

256    void addAllForums(Category source,
257                      Category target);
258
259    /**
260     * @param topicID
261     * @return
262     */

263    Topic findTopicByID(Integer JavaDoc topicID)
264          throws ModuleException;
265
266    /**
267     * DOCUMENT_ME
268     *
269     * @param topicID DOCUMENT_ME
270     * @param start DOCUMENT_ME
271     * @param limit DOCUMENT_ME
272     * @return DOCUMENT_ME
273     * @throws ModuleException DOCUMENT_ME
274     */

275    List JavaDoc findPostsByTopicIDAsc(Integer JavaDoc topicID,
276                               int start,
277                               int limit)
278          throws ModuleException;
279
280    /**
281     * DOCUMENT_ME
282     *
283     * @param topicID DOCUMENT_ME
284     * @param start DOCUMENT_ME
285     * @param limit DOCUMENT_ME
286     * @return DOCUMENT_ME
287     * @throws ModuleException DOCUMENT_ME
288     */

289    List JavaDoc findPostsByTopicIDDesc(Integer JavaDoc topicID,
290                                int start,
291                                int limit)
292          throws ModuleException;
293
294
295    Date JavaDoc findLastPostDateForUser(User user) throws ModuleException;
296
297    Post findLastPost(Forum forum) throws ModuleException;
298
299    Post findFirstPost(Topic topic) throws ModuleException;
300
301    Post findLastPost(Topic topic) throws ModuleException;
302
303    List JavaDoc findForumWatchByUser(User user) throws ModuleException;
304
305    Poster createPoster(Integer JavaDoc userID) throws ModuleException;
306
307    /**
308     * @param poster
309     * @param forum
310     * @param i
311     */

312    void createWatch(Poster poster, Forum forum, int i) throws ModuleException;
313
314    /**
315     * @param forumWatchID
316     * @return
317     */

318    ForumWatch findForumWatchByID(Integer JavaDoc forumWatchID) throws ModuleException;
319
320    /**
321     * @param poster
322     * @param topic
323     */

324    void createWatch(Poster poster, Topic topic) throws ModuleException;
325
326    /**
327     * @param topicWatchID
328     * @return
329     */

330    TopicWatch findTopicWatchByID(Integer JavaDoc topicWatchID) throws ModuleException;
331
332    /**
333     * @param watch
334     */

335    void removeWatch(Watch watch) throws ModuleException;
336
337 }
Popular Tags