KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/MemberDAO.java,v 1.27 2006/04/14 17:05:26 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.27 $
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: Luis Miguel Hernanz
39  * @author: Minh Nguyen
40  */

41 package com.mvnforum.db;
42
43 import java.sql.Date JavaDoc;
44 import java.sql.Timestamp JavaDoc;
45 import java.util.Collection JavaDoc;
46
47 import net.myvietnam.mvncore.exception.AssertionException;
48 import net.myvietnam.mvncore.exception.CreateException;
49 import net.myvietnam.mvncore.exception.DatabaseException;
50 import net.myvietnam.mvncore.exception.DuplicateKeyException;
51 import net.myvietnam.mvncore.exception.ObjectNotFoundException;
52
53 /**
54  * Interface to access to the user data.
55  *
56  * @author <a HREF="luish@germinus.com">Luis Miguel Hernanz</a>
57  * @version $Revision: 1.27 $
58  */

59 public interface MemberDAO {
60
61     public static final String JavaDoc TABLE_NAME = DatabaseConfig.TABLE_PREFIX + "Member";
62
63     public void findByPrimaryKey(int memberID)
64         throws ObjectNotFoundException, DatabaseException;
65
66     public void findByPrimaryKey2(int memberID, String JavaDoc memberName)
67         throws ObjectNotFoundException, DatabaseException;
68
69     public void findByAlternateKey_MemberName(String JavaDoc memberName)
70         throws ObjectNotFoundException, DatabaseException;
71
72     public void findByAlternateKey_MemberEmail(String JavaDoc memberEmail)
73         throws ObjectNotFoundException, DatabaseException;
74
75     public void deleteByPrimaryKey(int memberID)
76         throws DatabaseException;
77
78     public void create(String JavaDoc memberName,
79                        String JavaDoc memberPassword,
80                        String JavaDoc memberFirstEmail,
81                        String JavaDoc memberEmail,
82                        int memberEmailVisible,
83                        int memberNameVisible,
84                        String JavaDoc memberFirstIP,
85                        String JavaDoc memberLastIP,
86                        int memberViewCount,
87                        int memberPostCount,
88                        Timestamp JavaDoc memberCreationDate,
89                        Timestamp JavaDoc memberModifiedDate,
90                        Timestamp JavaDoc memberExpireDate,
91                        Timestamp JavaDoc memberLastLogon,
92                        int memberOption,
93                        int memberStatus,
94                        String JavaDoc memberActivateCode,
95                        String JavaDoc memberTempPassword,
96                        int memberMessageCount,
97                        int memberMessageOption,
98                        int memberPostsPerPage,
99                        int memberWarnCount,
100                        int memberVoteCount,
101                        int memberVoteTotalStars,
102                        int memberRewardPoints,
103                        String JavaDoc memberTitle,
104                        double memberTimeZone,
105                        String JavaDoc memberSignature,
106                        String JavaDoc memberAvatar,
107                        String JavaDoc memberSkin,
108                        String JavaDoc memberLanguage,
109                        String JavaDoc memberFirstname,
110                        String JavaDoc memberLastname,
111                        int memberGender,
112                        Date JavaDoc memberBirthday,
113                        String JavaDoc memberAddress,
114                        String JavaDoc memberCity,
115                        String JavaDoc memberState,
116                        String JavaDoc memberCountry,
117                        String JavaDoc memberPhone,
118                        String JavaDoc memberMobile,
119                        String JavaDoc memberFax,
120                        String JavaDoc memberCareer,
121                        String JavaDoc memberHomepage,
122                        String JavaDoc memberYahoo,
123                        String JavaDoc memberAol,
124                        String JavaDoc memberIcq,
125                        String JavaDoc memberMsn,
126                        String JavaDoc memberCoolLink1,
127                        String JavaDoc memberCoolLink2)
128         throws CreateException, DatabaseException, DuplicateKeyException;
129
130     public void update(int memberID, // primary key
131
int memberEmailVisible,
132                        int memberNameVisible,
133                        Timestamp JavaDoc memberModifiedDate,
134                        int memberOption,
135                        int memberStatus,
136                        int memberMessageOption,
137                        int memberPostsPerPage,
138                        double memberTimeZone,
139                        String JavaDoc memberSkin,
140                        String JavaDoc memberLanguage,
141                        String JavaDoc memberFirstname,
142                        String JavaDoc memberLastname,
143                        int memberGender,
144                        Date JavaDoc memberBirthday,
145                        String JavaDoc memberAddress,
146                        String JavaDoc memberCity,
147                        String JavaDoc memberState,
148                        String JavaDoc memberCountry,
149                        String JavaDoc memberPhone,
150                        String JavaDoc memberMobile,
151                        String JavaDoc memberFax,
152                        String JavaDoc memberCareer,
153                        String JavaDoc memberHomepage,
154                        String JavaDoc memberYahoo,
155                        String JavaDoc memberAol,
156                        String JavaDoc memberIcq,
157                        String JavaDoc memberMsn,
158                        String JavaDoc memberCoolLink1,
159                        String JavaDoc memberCoolLink2)
160         throws ObjectNotFoundException, DatabaseException;
161
162     public void updateEmail(int memberID, // primary key
163
String JavaDoc memberEmail)
164         throws ObjectNotFoundException, DatabaseException, DuplicateKeyException;
165
166     public void updatePassword(int memberID, // primary key
167
String JavaDoc memberPassword)
168         throws ObjectNotFoundException, DatabaseException;
169
170     public void updateTempPassword(int memberID, // primary key
171
String JavaDoc memberTempPassword)
172         throws ObjectNotFoundException, DatabaseException;
173
174     public void updateActivateCode(int memberID, // primary key
175
String JavaDoc memberActivateCode)
176         throws ObjectNotFoundException, DatabaseException;
177
178     public void updateAvatar(int memberID, // primary key
179
String JavaDoc memberAvatar)
180         throws ObjectNotFoundException, DatabaseException;
181
182     public void updateSignature(int memberID, // primary key
183
String JavaDoc memberSignature)
184         throws ObjectNotFoundException, DatabaseException;
185
186     public void updateTitle(int memberID, // primary key
187
String JavaDoc memberTitle)
188         throws ObjectNotFoundException, DatabaseException;
189
190     public void updateLastLogon(int memberID, // primary key
191
Timestamp JavaDoc memberLastLogon, String JavaDoc lastIP)
192         throws ObjectNotFoundException, DatabaseException;
193
194     public String JavaDoc getPassword(int memberID)
195         throws ObjectNotFoundException, DatabaseException;
196
197     public String JavaDoc getTempPassword(int memberID)
198         throws ObjectNotFoundException, DatabaseException;
199
200     public String JavaDoc getActivateCode(int memberID)
201         throws ObjectNotFoundException, DatabaseException;
202
203     public MemberBean getMember_forViewCurrentMember(int memberID)
204         throws ObjectNotFoundException, DatabaseException;
205
206     public MemberBean getMember_forEditCurrentMember(int memberID)
207         throws ObjectNotFoundException, DatabaseException;
208
209     public MemberBean getMember_forPublic(int memberID)
210         throws ObjectNotFoundException, DatabaseException;
211
212     public int getNumberOfMembers()
213         throws AssertionException, DatabaseException;
214
215     public int getNumberOfMembers_inMemberStatus(int memberStatus)
216         throws AssertionException, DatabaseException;
217
218     public int getNumberOfMembers_inActivationStatus(boolean activationStatus)
219         throws AssertionException, DatabaseException;
220
221     /************************************************
222      * Customized methods come below
223      ************************************************/

224     public int getMemberIDFromMemberName(String JavaDoc memberName)
225         throws ObjectNotFoundException, DatabaseException;
226
227     /* @todo check if this method work with other DBMS other than MySql (check case-sensitive) */
228     public int getMemberIDFromMemberEmail(String JavaDoc memberEmail)
229         throws ObjectNotFoundException, DatabaseException;
230
231     public Collection JavaDoc getMembers_withSortSupport_limit(int offset, int rowsToReturn, String JavaDoc sort, String JavaDoc order)
232         throws IllegalArgumentException JavaDoc, DatabaseException;
233
234     /**
235      * Get all members that based on the activation status criteria
236      * @param kind String can be one of three values: all, activated, nonactivated
237      * @throws DatabaseException
238      * @return Collection
239      */

240     public Collection JavaDoc getEnableMembers_inActivationStatus(String JavaDoc kind)
241         throws DatabaseException;
242
243     public void updateStatus(int memberID, // primary key
244
int memberStatus)
245         throws ObjectNotFoundException, DatabaseException;
246
247     public void updatePostCount(int memberID, // primary key
248
int memberPostCount)
249         throws ObjectNotFoundException, DatabaseException;
250
251     /**
252      * This method should be call only when we can make sure that memberID is in database
253      */

254     public void increaseViewCount(int memberID)
255         throws DatabaseException, ObjectNotFoundException;
256
257     /**
258      * This method should be call only when we can make sure that memberID is in database
259      */

260     public void increasePostCount(int memberID)
261         throws DatabaseException, ObjectNotFoundException;
262
263     public Collection JavaDoc getMembers_inExpire_limit(Timestamp JavaDoc expireDate, int offset, int rowsToReturn, String JavaDoc sort, String JavaDoc order)
264         throws IllegalArgumentException JavaDoc, DatabaseException;
265
266     public int getNumberOfMembers_inExpire(Timestamp JavaDoc expireDate)
267         throws AssertionException, DatabaseException;
268
269     public void updateMember_expireDate(int memberID, // primary key
270
Timestamp JavaDoc expireDate)
271         throws ObjectNotFoundException, DatabaseException;
272
273     public Collection JavaDoc getMembers()
274         throws DatabaseException;
275
276     public Collection JavaDoc getEnableMembers_inGroup(int groupID)
277         throws DatabaseException;
278
279     public Collection JavaDoc getForumsAuthorizedMembers()
280         throws DatabaseException;
281
282     public Collection JavaDoc getAuthorizedMembers()
283         throws DatabaseException;
284
285     public Collection JavaDoc getNonActivatedNoPostMembers(Timestamp JavaDoc before)
286         throws DatabaseException;
287
288 }
289
Popular Tags