org.opensha.refFaultParamDb.dao.db
Class ContributorDB_DAO

java.lang.Object
  extended by org.opensha.refFaultParamDb.dao.db.ContributorDB_DAO

public class ContributorDB_DAO
extends Object

Title:ContributorDB_DAO.java

Description: This class connects with database to access the Contributor table

Copyright: Copyright (c) 2002

Company:

Version:
1.0
Author:
not attributable

Field Summary
static String CONTRIBUTOR_NAME
           
static String EMAIL
           
static String PASSWORD
           
static String TABLE_NAME
           
 
Constructor Summary
ContributorDB_DAO(DB_AccessAPI dbAccessAPI)
          Constructor.
 
Method Summary
 int addContributor(Contributor contributor, String password)
          Add a contributor to the contributor table
 ArrayList<Contributor> getAllContributors()
          Get a list of all the contributors
 Contributor getContributor(int contributorId)
          Get contributor corresponding to an Id
 Contributor getContributor(String name)
          Get the contributor info for a particular contributor name
 Contributor getContributorByEmail(String emailAdd)
          Get the contributor info for a particular contributor email address
static String getEnryptedPassword(String password)
           
static String getPassword(int n)
           
static String getRandomPassword()
          Get random string
 Contributor getValidatedContributor(String name, String password)
          Whether the provided username/password is valid
 boolean isContributorValid(String name, String password)
           
static void main(String[] args)
           
 boolean removeContributor(int contributorId)
          Remove a contributor from the table
 void resetPasswordByEmail(String email)
          reset the password for a contributor in the database
 void setDB_Connection(DB_AccessAPI dbAccessAPI)
           
 boolean updatePassword(String userName, String oldPassword, String newPassword)
          Update a contributor in the table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_NAME

public static final String TABLE_NAME
See Also:
Constant Field Values

CONTRIBUTOR_NAME

public static final String CONTRIBUTOR_NAME
See Also:
Constant Field Values

EMAIL

public static final String EMAIL
See Also:
Constant Field Values

PASSWORD

public static final String PASSWORD
See Also:
Constant Field Values
Constructor Detail

ContributorDB_DAO

public ContributorDB_DAO(DB_AccessAPI dbAccessAPI)
Constructor.

Parameters:
dbConnection -
Method Detail

setDB_Connection

public void setDB_Connection(DB_AccessAPI dbAccessAPI)

addContributor

public int addContributor(Contributor contributor,
                          String password)
                   throws InsertException
Add a contributor to the contributor table

Parameters:
contributor -
Returns:
Throws:
InsertException

getEnryptedPassword

public static String getEnryptedPassword(String password)

updatePassword

public boolean updatePassword(String userName,
                              String oldPassword,
                              String newPassword)
                       throws UpdateException
Update a contributor in the table

Parameters:
contributorId -
contributor -
Throws:
UpdateException

resetPasswordByEmail

public void resetPasswordByEmail(String email)
                          throws UpdateException
reset the password for a contributor in the database

Throws:
UpdateException

getRandomPassword

public static String getRandomPassword()
Get random string

Returns:

getPassword

public static String getPassword(int n)

getContributor

public Contributor getContributor(int contributorId)
                           throws QueryException
Get contributor corresponding to an Id

Parameters:
contributorId -
Returns:
Throws:
QueryException

getContributor

public Contributor getContributor(String name)
                           throws QueryException
Get the contributor info for a particular contributor name

Parameters:
name - username for the contributor
Returns:
Throws:
QueryException

getContributorByEmail

public Contributor getContributorByEmail(String emailAdd)
                                  throws QueryException
Get the contributor info for a particular contributor email address

Parameters:
name - username for the contributor
Returns:
Throws:
QueryException

getValidatedContributor

public Contributor getValidatedContributor(String name,
                                           String password)
Whether the provided username/password is valid

Parameters:
name -
password -
Returns:

isContributorValid

public boolean isContributorValid(String name,
                                  String password)

removeContributor

public boolean removeContributor(int contributorId)
                          throws UpdateException
Remove a contributor from the table

Parameters:
contributorId -
Throws:
UpdateException

getAllContributors

public ArrayList<Contributor> getAllContributors()
                                          throws QueryException
Get a list of all the contributors

Returns:
Throws:
QueryException

main

public static void main(String[] args)