KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mvnforum > db > ThreadDAO


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/ThreadDAO.java,v 1.23 2006/04/14 17:05:26 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.23 $
5  * $Date: 2006/04/14 17:05:26 $
6  *
7  * ====================================================================
8  *
9  * Copyright (C) 2002-2006 by MyVietnam.net
10  *
11  * All copyright notices regarding mvnForum MUST remain
12  * intact in the scripts and in the outputted HTML.
13  * The "powered by" text/logo with a link back to
14  * http://www.mvnForum.com and http://www.MyVietnam.net in
15  * the footer of the pages MUST remain visible when the pages
16  * are viewed on the internet or intranet.
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31  *
32  * Support can be obtained from support forums at:
33  * http://www.mvnForum.com/mvnforum/index
34  *
35  * Correspondence and Marketing Questions can be sent to:
36  * info at MyVietnam net
37  *
38  * @author: Minh Nguyen
39  */

40 package com.mvnforum.db;
41
42 import java.sql.Timestamp JavaDoc;
43 import java.util.Collection JavaDoc;
44
45 import net.myvietnam.mvncore.exception.AssertionException;
46 import net.myvietnam.mvncore.exception.CreateException;
47 import net.myvietnam.mvncore.exception.DatabaseException;
48 import net.myvietnam.mvncore.exception.ObjectNotFoundException;
49 import net.myvietnam.mvncore.exception.ForeignKeyNotFoundException;
50
51 public interface ThreadDAO {
52
53     public static final String JavaDoc TABLE_NAME = DatabaseConfig.TABLE_PREFIX + "Thread";
54
55     public void findByPrimaryKey(int threadID)
56         throws ObjectNotFoundException, DatabaseException;
57
58     public int createThread(int forumID, String JavaDoc memberName, String JavaDoc lastPostMemberName,
59                         String JavaDoc threadTopic, String JavaDoc threadBody, int threadVoteCount,
60                         int threadVoteTotalStars, Timestamp JavaDoc threadCreationDate, Timestamp JavaDoc threadLastPostDate,
61                         int threadType, int threadOption, int threadStatus,
62                         int threadHasPoll, int threadViewCount, int threadReplyCount,
63                         String JavaDoc threadIcon, int threadDuration, int threadAttachCount /* to backup */)
64         throws ObjectNotFoundException, CreateException, DatabaseException, ForeignKeyNotFoundException;
65
66     public void delete(int threadID)
67         throws DatabaseException, ObjectNotFoundException;
68
69     public void delete_inForum(int forumID)
70         throws DatabaseException;
71
72     public void updateForumID(int threadID, // primary key
73
int forumID)
74         throws ObjectNotFoundException, DatabaseException, ForeignKeyNotFoundException;
75
76     public void updateThreadStatus(int threadID, // primary key
77
int threadStatus)
78         throws ObjectNotFoundException, DatabaseException;
79
80     public void updateThreadType(int threadID, // primary key
81
int threadType)
82         throws ObjectNotFoundException, DatabaseException;
83
84     public void updateTopic_Body_Icon(int threadID, // primary key
85
String JavaDoc threadTopic, String JavaDoc threadBody, String JavaDoc threadIcon)
86         throws ObjectNotFoundException, DatabaseException;
87
88     public void increaseReplyCount(int threadID)
89         throws DatabaseException, ObjectNotFoundException;
90
91     public void updateLastPostMemberName(int threadID, // primary key
92
String JavaDoc lastPostMemberName)
93         throws ObjectNotFoundException, DatabaseException, ForeignKeyNotFoundException;
94
95     public void updateLastPostDate(int threadID, // primary key
96
Timestamp JavaDoc threadLastPostDate)
97         throws ObjectNotFoundException, DatabaseException;
98
99     public void updateThreadAttachCount(int threadID,
100                                         int count)
101         throws ObjectNotFoundException, DatabaseException;
102
103     public ThreadBean getThread(int threadID)
104         throws ObjectNotFoundException, DatabaseException;
105
106     public int getNumberOfEnableThreads_inForum(int forumID)
107         throws AssertionException, DatabaseException;
108
109     public int getNumberOfDisableThreads_inForum(int forumID)
110         throws AssertionException, DatabaseException;
111
112     public int getNumberOfNormalEnableThreads_inForum(int forumID)
113         throws AssertionException, DatabaseException;
114
115     public int getNumberOfEnableThreads()
116         throws AssertionException, DatabaseException;
117
118     public Collection JavaDoc getEnableThreads_withSortSupport_limit(int offset, int rowsToReturn, String JavaDoc sort, String JavaDoc order)
119         throws IllegalArgumentException JavaDoc, DatabaseException;
120
121     public int getNumberOfDisableThreads()
122         throws AssertionException, DatabaseException;
123
124     public Collection JavaDoc getDisableBeans_withSortSupport_limit(int offset, int rowsToReturn, String JavaDoc sort, String JavaDoc order)
125         throws IllegalArgumentException JavaDoc, DatabaseException;
126
127     public Collection JavaDoc getNormalEnableThreads_inForum_withSortSupport_limit(int forumID, int offset, int rowsToReturn, String JavaDoc sort, String JavaDoc order)
128         throws IllegalArgumentException JavaDoc, DatabaseException;
129
130     public Collection JavaDoc getAllEnableThreads_inForum_withSortSupport_limit(int forumID, int offset, int rowsToReturn, String JavaDoc sort, String JavaDoc order)
131         throws IllegalArgumentException JavaDoc, DatabaseException;
132
133     public Collection JavaDoc getDisableThreads_inForum_withSortSupport_limit(int forumID, int offset, int rowsToReturn, String JavaDoc sort, String JavaDoc order)
134         throws IllegalArgumentException JavaDoc, DatabaseException;
135
136     // Should Enable only ???
137
public Collection JavaDoc getThreads_inFavorite_inMember(int memberID)
138         throws DatabaseException;
139
140     public Collection JavaDoc getEnableStickies_inForum(int forumID)
141         throws DatabaseException;
142
143     public Collection JavaDoc getEnableForumAnnouncements_inForum(int forumID)
144         throws DatabaseException;
145
146     public Collection JavaDoc getEnableGlobalAnnouncements()
147         throws DatabaseException;
148
149     public void increaseViewCount(int threadID)
150         throws DatabaseException, ObjectNotFoundException;
151
152     public void updateReplyCount(int threadID, // primary key
153
int threadReplyCount)
154         throws IllegalArgumentException JavaDoc, DatabaseException, ObjectNotFoundException;
155
156     public int getPreviousEnableThread(int forumID, int threadID)
157         throws DatabaseException, AssertionException;
158
159     public int getNextEnableThread(int forumID, int threadID)
160         throws DatabaseException, AssertionException;
161
162     public Collection JavaDoc getEnableThreads_inGlobal(Timestamp JavaDoc sinceDate)
163         throws DatabaseException;
164
165     public Collection JavaDoc getEnableThreads_inCategory(int categoryID, Timestamp JavaDoc sinceDate)
166         throws DatabaseException;
167
168     public Collection JavaDoc getEnableThreads_inForum(int forumID, Timestamp JavaDoc sinceDate)
169         throws DatabaseException;
170
171     public Collection JavaDoc getEnableThreads_inThread(int threadID, Timestamp JavaDoc sinceDate)
172         throws DatabaseException;
173
174     public int getNumberOfEnableThreadsWithPendingPosts()
175         throws AssertionException, DatabaseException;
176
177     public int getNumberOfEnableThreadsWithPendingPosts_inForum(int forumID)
178         throws AssertionException, DatabaseException;
179
180     /**
181      * This method is used to get enable threads that having at least one pending post (for moderation)
182      *
183      * Note: current implementation use the NOSCROLL method which is quite slow
184      *
185      * @param offset
186      * @param rowsToReturn
187      * @param sort
188      * @param order
189      * @return
190      * @throws java.lang.IllegalArgumentException if the arguments are not valid
191      * @throws DatabaseException
192      */

193     public Collection JavaDoc getEnableThreadsWithPendingPosts_withSortSupport_limit(int offset, int rowsToReturn, String JavaDoc sort, String JavaDoc order)
194         throws IllegalArgumentException JavaDoc, DatabaseException, ObjectNotFoundException;
195
196     public Collection JavaDoc getEnableThreadsWithPendingPosts_inForum_withSortSupport_limit(int forumID, int offset, int rowsToReturn, String JavaDoc sort, String JavaDoc order)
197         throws IllegalArgumentException JavaDoc, DatabaseException, ObjectNotFoundException;
198
199 }
200
Popular Tags