alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/MemberDAO.java,v 1.24 2005/01/18 11:52:18 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.24 $
 * $Date: 2005/01/18 11:52:18 $
 *
 * ====================================================================
 *
 * Copyright (C) 2002-2005 by MyVietnam.net
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or any later version.
 *
 * All copyright notices regarding mvnForum MUST remain intact
 * in the scripts and in the outputted HTML.
 * The "powered by" text/logo with a link back to
 * http://www.mvnForum.com and http://www.MyVietnam.net in the
 * footer of the pages MUST remain visible when the pages
 * are viewed on the internet or intranet.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Support can be obtained from support forums at:
 * http://www.mvnForum.com/mvnforum/index
 *
 * Correspondence and Marketing Questions can be sent to:
 * info@MyVietnam.net
 *
 * @author: Luis Miguel Hernanz <luish@germinus.com>
 * @author: Minh Nguyen  minhnn@MyVietnam.net
 */
package com.mvnforum.db;

import java.sql.Date;
import java.sql.Timestamp;
import java.util.Collection;

import net.myvietnam.mvncore.exception.AssertionException;
import net.myvietnam.mvncore.exception.CreateException;
import net.myvietnam.mvncore.exception.DatabaseException;
import net.myvietnam.mvncore.exception.DuplicateKeyException;
import net.myvietnam.mvncore.exception.ObjectNotFoundException;

/**
 * Interface to access to the user data.
 *
 * @author <a href="luish@germinus.com">Luis Miguel Hernanz
 * @version $Revision: 1.24 $
 */
public interface MemberDAO {

    public static final String TABLE_NAME = DatabaseConfig.TABLE_PREFIX + "Member";

    public void findByPrimaryKey(int memberID)
        throws ObjectNotFoundException, DatabaseException;

    public void findByPrimaryKey2(int memberID, String memberName)
        throws ObjectNotFoundException, DatabaseException;

    public void findByAlternateKey_MemberName(String memberName)
        throws ObjectNotFoundException, DatabaseException;

    public void findByAlternateKey_MemberEmail(String memberEmail)
        throws ObjectNotFoundException, DatabaseException;

    public void deleteByPrimaryKey(int memberID)
        throws DatabaseException;

    public void create(String memberName,
                       String memberPassword,
                       String memberFirstEmail,
                       String memberEmail,
                       int memberEmailVisible,
                       int memberNameVisible,
                       String memberFirstIP,
                       String memberLastIP,
                       int memberViewCount,
                       int memberPostCount,
                       Timestamp memberCreationDate,
                       Timestamp memberModifiedDate,
                       Timestamp memberExpireDate,
                       Timestamp memberLastLogon,
                       int memberOption,
                       int memberStatus,
                       String memberActivateCode,
                       String memberTempPassword,
                       int memberMessageCount,
                       int memberMessageOption,
                       int memberPostsPerPage,
                       int memberWarnCount,
                       int memberVoteCount,
                       int memberVoteTotalStars,
                       int memberRewardPoints,
                       String memberTitle,
                       int memberTimeZone,
                       String memberSignature,
                       String memberAvatar,
                       String memberSkin,
                       String memberLanguage,
                       String memberFirstname,
                       String memberLastname,
                       int memberGender,
                       Date memberBirthday,
                       String memberAddress,
                       String memberCity,
                       String memberState,
                       String memberCountry,
                       String memberPhone,
                       String memberMobile,
                       String memberFax,
                       String memberCareer,
                       String memberHomepage,
                       String memberYahoo,
                       String memberAol,
                       String memberIcq,
                       String memberMsn,
                       String memberCoolLink1,
                       String memberCoolLink2)
        throws CreateException, DatabaseException, DuplicateKeyException;

    public void update(int memberID, // primary key
                       int memberEmailVisible,
                       int memberNameVisible,
                       Timestamp memberModifiedDate,
                       int memberOption,
                       int memberStatus,
                       int memberMessageOption,
                       int memberPostsPerPage,
                       int memberTimeZone,
                       String memberSkin,
                       String memberLanguage,
                       String memberFirstname,
                       String memberLastname,
                       int memberGender,
                       Date memberBirthday,
                       String memberAddress,
                       String memberCity,
                       String memberState,
                       String memberCountry,
                       String memberPhone,
                       String memberMobile,
                       String memberFax,
                       String memberCareer,
                       String memberHomepage,
                       String memberYahoo,
                       String memberAol,
                       String memberIcq,
                       String memberMsn,
                       String memberCoolLink1,
                       String memberCoolLink2)
        throws ObjectNotFoundException, DatabaseException;

    public void updateEmail(int memberID, // primary key
                            String memberEmail)
        throws ObjectNotFoundException, DatabaseException, DuplicateKeyException;

    public void updatePassword(int memberID, // primary key
                               String memberPassword)
        throws ObjectNotFoundException, DatabaseException;

    public void updateTempPassword(int memberID, // primary key
                                   String memberTempPassword)
        throws ObjectNotFoundException, DatabaseException;

    public void updateActivateCode(int memberID, // primary key
                                   String memberActivateCode)
        throws ObjectNotFoundException, DatabaseException;

    public void updateAvatar(int memberID, // primary key
                             String memberAvatar)
        throws ObjectNotFoundException, DatabaseException;

    public void updateSignature(int memberID, // primary key
                                String memberSignature)
        throws ObjectNotFoundException, DatabaseException;

    public void updateTitle(int memberID, // primary key
                            String memberTitle)
        throws ObjectNotFoundException, DatabaseException;

    public void updateLastLogon(int memberID, // primary key
                                Timestamp memberLastLogon, String lastIP)
        throws ObjectNotFoundException, DatabaseException;

    public String getPassword(int memberID)
        throws ObjectNotFoundException, DatabaseException;

    public String getTempPassword(int memberID)
        throws ObjectNotFoundException, DatabaseException;

    public String getActivateCode(int memberID)
        throws ObjectNotFoundException, DatabaseException;

    public MemberBean getMember_forViewCurrentMember(int memberID)
        throws ObjectNotFoundException, DatabaseException;

    public MemberBean getMember_forEditCurrentMember(int memberID)
        throws ObjectNotFoundException, DatabaseException;

    public MemberBean getMember_forPublic(int memberID)
        throws ObjectNotFoundException, DatabaseException;

    public int getNumberOfMembers()
        throws AssertionException, DatabaseException;

    public int getNumberOfMembers_inMemberStatus(int memberStatus)
        throws AssertionException, DatabaseException;

    public int getNumberOfMembers_inActivationStatus(boolean activationStatus)
        throws AssertionException, DatabaseException;

    /************************************************
     * Customized methods come below
     ************************************************/
    public int getMemberIDFromMemberName(String memberName)
        throws ObjectNotFoundException, DatabaseException;

    /* @todo check if this method work with other DBMS other than MySql (check case-sensitive) */
    public int getMemberIDFromMemberEmail(String memberEmail)
        throws ObjectNotFoundException, DatabaseException;

    public Collection getMembers_withSortSupport_limit(int offset, int rowsToReturn, String sort, String order)
        throws IllegalArgumentException, DatabaseException;

    /**
     * Get all members that based on the activation status criteria
     * @param kind String can be one of three values: all, activated, nonactivated
     * @throws DatabaseException
     * @return Collection
     */
    public Collection getEnableMembers_inActivationStatus(String kind)
        throws DatabaseException;

    public void updateStatus(int memberID, // primary key
                             int memberStatus)
        throws ObjectNotFoundException, DatabaseException;

    public void updatePostCount(int memberID, // primary key
                                int memberPostCount)
        throws ObjectNotFoundException, DatabaseException;

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

    /**
     * This method should be call only when we can make sure that memberID is in database
     */
    public void increasePostCount(int memberID)
        throws DatabaseException, ObjectNotFoundException;

    public Collection getMembers_inExpire_limit(Timestamp expireDate, int offset, int rowsToReturn, String sort, String order)
        throws IllegalArgumentException, DatabaseException;

    public int getNumberOfMembers_inExpire(Timestamp expireDate)
        throws AssertionException, DatabaseException;

    public void updateMember_expireDate(int memberID, // primary key
                                        Timestamp expireDate)
        throws ObjectNotFoundException, DatabaseException;

    public Collection getMembers()
        throws DatabaseException;

    public Collection getEnableMembers_inGroup(int groupID)
        throws DatabaseException;

    public Collection getForumsAuthorizedMembers()
        throws DatabaseException;

    public Collection getAuthorizedMembers()
        throws DatabaseException;

    public Collection getNonActivatedNoPostMembers(Timestamp before)
        throws DatabaseException;

}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.