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 addPatient(Patient 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.
 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)

addPatient

public java.lang.String addPatient(Patient patient)
Specified by:
addPatient in interface UserDAO

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)

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)

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)