org.domain.rhims.dao
Class UserDAOMySQL

java.lang.Object
  extended by org.domain.rhims.dao.UserDAOMySQL
All Implemented Interfaces:
UserDAO

@Name(value="userDAO")
public class UserDAOMySQL
extends java.lang.Object
implements UserDAO

This EJB provides a MySQL specific implementation of the UserDAO. Its Seam name is "userDAO".

Author:
Mitch Williams

Constructor Summary
UserDAOMySQL()
           
 
Method Summary
 java.lang.String addAdministrator(Administrator admin)
          This method persists a new administrator.
 java.lang.String addClinician(Clinician clinician)
          This method persists a new clinician.
 java.lang.String addPatient(Patient patient)
          This method persists a new patient.
 java.lang.String addUser(User user)
          This method persists a new user.
 Administrator getAdministrator(java.lang.String userName, java.lang.String password)
          This method retrieves an Administrator based on their username and password.
 java.util.List<Clinician> getAllClinicians()
          This method returns a list of all the Clinicians in the system
 java.util.List<Patient> getAllPatients()
          This method returns a list of all the Patients in the system
 Clinician getClinician(long clinicianID)
          This method retrieves a Clinician based on their unique userID number.
 Clinician getClinician(java.lang.String clinicianUsername)
          This method retrieves a Clinician based on their username.
 Patient getPatient(long patientID)
          This method retrieves a Patient based on their unique patientID number.
 Patient getPatient(java.lang.String patientUsername)
          This method retrieves a Patient based on their unique username.
 User getUser(java.lang.String username, java.lang.String password)
          The getUser method retrieves a user based on their userName and password.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserDAOMySQL

public UserDAOMySQL()
Method Detail

addUser

public java.lang.String addUser(User user)
Description copied from interface: UserDAO
This method persists a new user. If the user was saved successfully, then it returns "success". Otherwise, it returns a "failure" message.

Specified by:
addUser in interface UserDAO
Parameters:
user - the User to save
Returns:
"success" if the user is saved, "failure" if not
See Also:
UserDAO.addUser(User)

addAdministrator

public java.lang.String addAdministrator(Administrator admin)
Description copied from interface: UserDAO
This method persists a new administrator. If the user was saved successfully, then it returns "success". Otherwise, it returns a "failure" message.

Specified by:
addAdministrator in interface UserDAO
Parameters:
admin - the Administrator to save
Returns:
"success" if the user is saved, "failure" if not
See Also:
UserDAO.addAdministrator(Administrator)

addPatient

public java.lang.String addPatient(Patient patient)
Description copied from interface: UserDAO
This method persists a new patient. If the patient was saved successfully, then it returns "success". Otherwise, it returns "failure".

Specified by:
addPatient in interface UserDAO
Parameters:
patient - the Patient to save
Returns:
"success" if the patient is saved, "failure" if not
See Also:
UserDAO.addPatient(Patient)

addClinician

public java.lang.String addClinician(Clinician clinician)
Description copied from interface: UserDAO
This method persists a new clinician. If the clinician was saved successfully, then it returns "success". Otherwise, it returns "failure".

Specified by:
addClinician in interface UserDAO
Returns:
"success" if the Clinician
See Also:
UserDAO.addClinician(Clinician)

getUser

public User getUser(java.lang.String username,
                    java.lang.String password)
Description copied from interface: UserDAO
The getUser method retrieves a user based on their userName and password. If the user is not found, then it returns null. Otherwise, the User object is returned. This method is intended to be used for login authentication purposes.

Specified by:
getUser in interface UserDAO
Parameters:
username - the username of the user to find
password - the password of the user to find
Returns:
the User object if the user is found, null otherwise.
See Also:
UserDAO.getUser(String, String)

getAdministrator

public Administrator getAdministrator(java.lang.String userName,
                                      java.lang.String password)
Description copied from interface: UserDAO
This method retrieves an Administrator based on their username and password. If they are not found, then it returns null. Otherwise, the Administrator object is returned. This method is intended to be used for login authentication purposes.

Specified by:
getAdministrator in interface UserDAO
Parameters:
userName - the username of the Administrator to find
password - the password of the Administrator to find
Returns:
the Administrator object if found, null otherwise
See Also:
UserDAO.getAdministrator(String, String)

getClinician

public Clinician getClinician(long clinicianID)
Description copied from interface: UserDAO
This method retrieves a Clinician based on their unique userID number. If the Clinician is not found, then it returns null;

Specified by:
getClinician in interface UserDAO
Parameters:
clinicianID - the ID number of the clinician to find
Returns:
the Clinician object if they are found, null otherwise
See Also:
UserDAO.getClinician(long)

getClinician

public Clinician getClinician(java.lang.String clinicianUsername)
Description copied from interface: UserDAO
This method retrieves a Clinician based on their username. If the Clinician is not found, then it returns null;

Specified by:
getClinician in interface UserDAO
Parameters:
clinicianUsername - the username of the clinician to find
Returns:
the Clinician object if they are found, null otherwise
See Also:
UserDAO.getClinician(String)

getPatient

public Patient getPatient(long patientID)
Description copied from interface: UserDAO
This method retrieves a Patient based on their unique patientID number. If the Patient is not found, then it returns null;

Specified by:
getPatient in interface UserDAO
Parameters:
patientID - the ID number of the patient to find
Returns:
the Patient object if the patient exists, null otherwise
See Also:
UserDAO.getPatient(long)

getPatient

public Patient getPatient(java.lang.String patientUsername)
Description copied from interface: UserDAO
This method retrieves a Patient based on their unique username. If the Patient is not found, then it returns null;

Specified by:
getPatient in interface UserDAO
Parameters:
patientUsername - the username of the patient to find
Returns:
the Patient object if the patient exists, null otherwise
See Also:
UserDAO.getPatient(String)

getAllPatients

public java.util.List<Patient> getAllPatients()
Description copied from interface: UserDAO
This method returns a list of all the Patients in the system

Specified by:
getAllPatients in interface UserDAO
Returns:
a list containing all the Patients in the system
See Also:
UserDAO.getAllPatients()

getAllClinicians

public java.util.List<Clinician> getAllClinicians()
Description copied from interface: UserDAO
This method returns a list of all the Clinicians in the system

Specified by:
getAllClinicians in interface UserDAO
Returns:
a list containing all the Clinicians in the system
See Also:
UserDAO.getAllClinicians()