org.domain.rhims.dao
Interface UserDAO

All Known Implementing Classes:
UserDAOMySQL

public interface UserDAO

The UserDAO is responsible for managing the persistence of application Users. This includes the base User, along with Administrator, Clinician, and Patient entities. It is a component of the Persistance layer of the application. Currently, it contains methods for adding and retrieving both Users, Administrators, Patients and Clinicians.

Author:
Mitch Williams

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.
 

Method Detail

addUser

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

Parameters:
user - the User to save
Returns:
"success" if the user is saved, "failure" if not

addAdministrator

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

Parameters:
admin - the Administrator to save
Returns:
"success" if the user is saved, "failure" if not

addPatient

java.lang.String addPatient(Patient patient)
This method persists a new patient. If the patient was saved successfully, then it returns "success". Otherwise, it returns "failure".

Parameters:
patient - the Patient to save
Returns:
"success" if the patient is saved, "failure" if not

addClinician

java.lang.String addClinician(Clinician clinician)
This method persists a new clinician. If the clinician was saved successfully, then it returns "success". Otherwise, it returns "failure".

Parameters:
clinician -
Returns:
"success" if the Clinician

getAdministrator

Administrator getAdministrator(java.lang.String userName,
                               java.lang.String password)
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.

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

getUser

User getUser(java.lang.String userName,
             java.lang.String password)
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.

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.

getPatient

Patient getPatient(long patientID)
This method retrieves a Patient based on their unique patientID number. If the Patient is not found, then it returns null;

Parameters:
patientID - the ID number of the patient to find
Returns:
the Patient object if the patient exists, null otherwise

getPatient

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

Parameters:
patientUsername - the username of the patient to find
Returns:
the Patient object if the patient exists, null otherwise

getClinician

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

Parameters:
clinicianID - the ID number of the clinician to find
Returns:
the Clinician object if they are found, null otherwise

getClinician

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

Parameters:
clinicianUsername - the username of the clinician to find
Returns:
the Clinician object if they are found, null otherwise

getAllPatients

java.util.List<Patient> getAllPatients()
This method returns a list of all the Patients in the system

Returns:
a list containing all the Patients in the system

getAllClinicians

java.util.List<Clinician> getAllClinicians()
This method returns a list of all the Clinicians in the system

Returns:
a list containing all the Clinicians in the system