001: /*
002: * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/MemberDAO.java,v 1.53 2007/12/17 09:09:40 minhnn Exp $
003: * $Author: minhnn $
004: * $Revision: 1.53 $
005: * $Date: 2007/12/17 09:09:40 $
006: *
007: * ====================================================================
008: *
009: * Copyright (C) 2002-2007 by MyVietnam.net
010: *
011: * All copyright notices regarding mvnForum MUST remain
012: * intact in the scripts and in the outputted HTML.
013: * The "powered by" text/logo with a link back to
014: * http://www.mvnForum.com and http://www.MyVietnam.net in
015: * the footer of the pages MUST remain visible when the pages
016: * are viewed on the internet or intranet.
017: *
018: * This program is free software; you can redistribute it and/or modify
019: * it under the terms of the GNU General Public License as published by
020: * the Free Software Foundation; either version 2 of the License, or
021: * any later version.
022: *
023: * This program is distributed in the hope that it will be useful,
024: * but WITHOUT ANY WARRANTY; without even the implied warranty of
025: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
026: * GNU General Public License for more details.
027: *
028: * You should have received a copy of the GNU General Public License
029: * along with this program; if not, write to the Free Software
030: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
031: *
032: * Support can be obtained from support forums at:
033: * http://www.mvnForum.com/mvnforum/index
034: *
035: * Correspondence and Marketing Questions can be sent to:
036: * info at MyVietnam net
037: *
038: * @author: Luis Miguel Hernanz
039: * @author: Minh Nguyen
040: */
041: package com.mvnforum.db;
042:
043: import java.sql.Date;
044: import java.sql.Timestamp;
045: import java.util.Collection;
046:
047: import net.myvietnam.mvncore.exception.*;
048:
049: /**
050: * Interface to access to the user data.
051: *
052: * @author <a href="luish@germinus.com">Luis Miguel Hernanz</a>
053: * @version $Revision: 1.53 $
054: */
055: public interface MemberDAO {
056:
057: public static final String TABLE_NAME = DatabaseConfig.TABLE_PREFIX
058: + "Member";
059:
060: public static final int ALL_MEMBER_STATUS = -1;
061: public static final int ALL_OFFSET = 0;
062:
063: public boolean isSupportFindByPrimaryKey();
064:
065: public void findByPrimaryKey(int memberID)
066: throws ObjectNotFoundException, DatabaseException;
067:
068: public boolean isSupportFindByPrimaryKey2();
069:
070: public void findByPrimaryKey2(int memberID, String memberName)
071: throws ObjectNotFoundException, DatabaseException;
072:
073: public boolean isSupportFindByAlternateKey_MemberName();
074:
075: public String findByAlternateKey_MemberName(String memberName)
076: throws ObjectNotFoundException, DatabaseException;
077:
078: public boolean isSupportFindByAlternateKey_MemberEmail();
079:
080: public void findByAlternateKey_MemberEmail(String memberEmail)
081: throws ObjectNotFoundException, DatabaseException;
082:
083: public boolean isSupportDeleteByPrimaryKey();
084:
085: public void deleteByPrimaryKey(int memberID)
086: throws DatabaseException;
087:
088: public boolean isSupportCreate();
089:
090: public void create(String memberName, String memberPassword,
091: String memberFirstEmail, String memberEmail,
092: int memberEmailVisible, int memberNameVisible,
093: String memberFirstIP, String memberLastIP,
094: int memberViewCount, int memberPostCount,
095: Timestamp memberCreationDate, Timestamp memberModifiedDate,
096: Timestamp memberExpireDate,
097: Timestamp memberPasswordExpireDate,
098: Timestamp memberLastLogon, int memberOption,
099: int memberStatus, String memberActivateCode,
100: String memberTempPassword, int memberMessageCount,
101: int memberMessageOption, int memberPostsPerPage,
102: int memberWarnCount, int memberVoteCount,
103: int memberVoteTotalStars, int memberRewardPoints,
104: String memberTitle, double memberTimeZone,
105: String memberSignature, String memberAvatar,
106: String memberSkin, String memberLanguage,
107: String memberFirstname, String memberLastname,
108: int memberGender, Date memberBirthday,
109: String memberAddress, String memberCity,
110: String memberState, String memberCountry,
111: String memberPhone, String memberMobile, String memberFax,
112: String memberCareer, String memberHomepage,
113: String memberYahoo, String memberAol, String memberIcq,
114: String memberMsn, String memberCoolLink1,
115: String memberCoolLink2) throws CreateException,
116: DatabaseException, DuplicateKeyException;
117:
118: public boolean isSupportUpdate();
119:
120: public void update(
121: int memberID, // primary key
122: int memberEmailVisible, int memberNameVisible,
123: Timestamp memberModifiedDate, int memberOption,
124: int memberStatus, int memberMessageOption,
125: int memberPostsPerPage, double memberTimeZone,
126: String memberSkin, String memberLanguage,
127: String memberFirstname, String memberLastname,
128: int memberGender, Date memberBirthday,
129: String memberAddress, String memberCity,
130: String memberState, String memberCountry,
131: String memberPhone, String memberMobile, String memberFax,
132: String memberCareer, String memberHomepage,
133: String memberYahoo, String memberAol, String memberIcq,
134: String memberMsn, String memberCoolLink1,
135: String memberCoolLink2) throws ObjectNotFoundException,
136: DatabaseException;
137:
138: public boolean isSupportUpdateEmail();
139:
140: public void updateEmail(int memberID, // primary key
141: String memberEmail) throws ObjectNotFoundException,
142: DatabaseException, DuplicateKeyException;
143:
144: public boolean isSupportUpdatePassword();
145:
146: public void updatePassword(int memberID, // primary key
147: String memberPassword, Timestamp memberPasswordExpireDate)
148: throws ObjectNotFoundException, DatabaseException;
149:
150: public boolean isSupportUpdateTempPassword();
151:
152: public void updateTempPassword(int memberID, // primary key
153: String memberTempPassword) throws ObjectNotFoundException,
154: DatabaseException;
155:
156: public boolean isSupportUpdateActivateCode();
157:
158: public void updateActivateCode(int memberID, // primary key
159: String memberActivateCode) throws ObjectNotFoundException,
160: DatabaseException;
161:
162: public boolean isSupportUpdateAvatar();
163:
164: public void updateAvatar(int memberID, // primary key
165: String memberAvatar) throws ObjectNotFoundException,
166: DatabaseException;
167:
168: public boolean isSupportUpdateSignature();
169:
170: public void updateSignature(int memberID, // primary key
171: String memberSignature) throws ObjectNotFoundException,
172: DatabaseException;
173:
174: public boolean isSupportUpdateTitle();
175:
176: public void updateTitle(int memberID, // primary key
177: String memberTitle) throws ObjectNotFoundException,
178: DatabaseException;
179:
180: public boolean isSupportUpdateLastLogon();
181:
182: public void updateLastLogon(int memberID, // primary key
183: Timestamp memberLastLogon, String lastIP)
184: throws ObjectNotFoundException, DatabaseException;
185:
186: public boolean isSupportGetPassword();
187:
188: public String getPassword(int memberID)
189: throws ObjectNotFoundException, DatabaseException;
190:
191: public boolean isSupportGetTempPassword();
192:
193: public String getTempPassword(int memberID)
194: throws ObjectNotFoundException, DatabaseException;
195:
196: public boolean isSupportGetActivateCode();
197:
198: public String getActivateCode(int memberID)
199: throws ObjectNotFoundException, DatabaseException;
200:
201: public boolean isSupportGetMember();
202:
203: public MemberBean getMember(int memberID)
204: throws ObjectNotFoundException, DatabaseException;
205:
206: public boolean isSupportGetNumberOfMembers();
207:
208: public int getNumberOfMembers() throws DatabaseException;
209:
210: public boolean isSupportGetNumberOfMembers_inMemberStatus();
211:
212: public int getNumberOfMembers_inMemberStatus(int memberStatus)
213: throws DatabaseException;
214:
215: public boolean isSupportGetNumberOfMembers_inActivationStatus();
216:
217: public int getNumberOfMembers_inActivationStatus(
218: boolean activationStatus) throws DatabaseException;
219:
220: /************************************************
221: * Customized methods come below
222: ************************************************/
223: public boolean isSupportGetMemberIDFromMemberName();
224:
225: public int getMemberIDFromMemberName(String memberName)
226: throws ObjectNotFoundException, DatabaseException;
227:
228: public boolean isSupportGetMemberIDFromMemberEmail();
229:
230: /* @todo check if this method work with other DBMS other than MySql (check case-sensitive) */
231: public int getMemberIDFromMemberEmail(String memberEmail)
232: throws ObjectNotFoundException, DatabaseException;
233:
234: public boolean isSupportGetMembers_withSortSupport_limit();
235:
236: public Collection getMembers_withSortSupport_limit(int offset,
237: int rowsToReturn, String sort, String order,
238: int memberStatus) throws IllegalArgumentException,
239: DatabaseException;
240:
241: public boolean isSupportGetEnableMembers_inActivationStatus();
242:
243: /**
244: * Get all members that based on the activation status criteria
245: * @param kind String can be one of three values: all, activated, nonactivated
246: * @throws DatabaseException
247: * @return Collection
248: */
249: public Collection getEnableMembers_inActivationStatus(String kind)
250: throws DatabaseException;
251:
252: public boolean isSupportGetMaxMemberID();
253:
254: public int getMaxMemberID() throws DatabaseException;
255:
256: public boolean isSupportGetMembersFromIDRange();
257:
258: public Collection getMembers_fromIDRange(int fromID, int toID)
259: throws IllegalArgumentException, DatabaseException;
260:
261: public boolean isSupportUpdateStatus();
262:
263: public void updateStatus(int memberID, // primary key
264: int memberStatus) throws ObjectNotFoundException,
265: DatabaseException;
266:
267: public boolean isSupportUpdatePostCount();
268:
269: public void updatePostCount(int memberID, // primary key
270: int memberPostCount) throws ObjectNotFoundException,
271: DatabaseException;
272:
273: public boolean isSupportIncreaseViewCount();
274:
275: /**
276: * This method should be call only when we can make sure that memberID is in database
277: */
278: public void increaseViewCount(int memberID)
279: throws DatabaseException, ObjectNotFoundException;
280:
281: public boolean isSupportIncreasePostCount();
282:
283: /**
284: * This method should be call only when we can make sure that memberID is in database
285: */
286: public void increasePostCount(int memberID)
287: throws DatabaseException, ObjectNotFoundException;
288:
289: public boolean isSupportGetMembers_inExpire_limit();
290:
291: public Collection getMembers_inExpire_limit(Timestamp expireDate,
292: int offset, int rowsToReturn, String sort, String order)
293: throws IllegalArgumentException, DatabaseException;
294:
295: public boolean isSupportGetNumberOfMembers_inExpire();
296:
297: public int getNumberOfMembers_inExpire(Timestamp expireDate)
298: throws DatabaseException;
299:
300: public boolean isSupportUpdateMember_expireDate();
301:
302: public void updateMember_expireDate(int memberID, // primary key
303: Timestamp expireDate) throws ObjectNotFoundException,
304: DatabaseException;
305:
306: public boolean isSupportGetMembers();
307:
308: public Collection getMembers() throws DatabaseException;
309:
310: public boolean isSupportGetEnableMembers_inGroup();
311:
312: public Collection getEnableMembers_inGroup(int groupID)
313: throws DatabaseException;
314:
315: public boolean isSupportGetForumsAuthorizedMembers();
316:
317: public Collection getForumsAuthorizedMembers()
318: throws DatabaseException;
319:
320: public boolean isSupportGetAuthorizedMembers();
321:
322: public Collection getAuthorizedMembers() throws DatabaseException;
323:
324: public boolean isSupportGetNonActivatedNoPostMembers();
325:
326: public Collection getNonActivatedNoPostMembers(Timestamp before)
327: throws DatabaseException;
328:
329: }
|