org.openmrs.api.db.hibernate
Class HibernateUserDAO

java.lang.Object
  extended by org.openmrs.api.db.hibernate.HibernateUserDAO
All Implemented Interfaces:
UserDAO

public class HibernateUserDAO
extends java.lang.Object
implements UserDAO

Hibernate specific database methods for the UserService

See Also:
Context, UserDAO, UserService

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
HibernateUserDAO()
           
 
Method Summary
 void changeHashedPassword(User user, java.lang.String hashedPassword, java.lang.String salt)
           
 void changePassword(java.lang.String pw, java.lang.String pw2)
           
 void changePassword(User u, java.lang.String pw)
           
 void changeQuestionAnswer(java.lang.String pw, java.lang.String question, java.lang.String answer)
           
 void changeQuestionAnswer(User u, java.lang.String question, java.lang.String answer)
           
 void deletePrivilege(Privilege privilege)
           
 void deleteRole(Role role)
           
 void deleteUser(User user)
           
 java.lang.Integer generateSystemId()
           
 java.util.List<Privilege> getAllPrivileges()
           
 java.util.List<Role> getAllRoles()
           
 java.util.List<User> getAllUsers()
           
 LoginCredential getLoginCredential(User user)
           
 LoginCredential getLoginCredentialByUuid(java.lang.String uuid)
          Auto generated method comment
 Privilege getPrivilege(java.lang.String p)
           
 Privilege getPrivilegeByUuid(java.lang.String uuid)
          Auto generated method comment
 Role getRole(java.lang.String r)
           
 Role getRoleByUuid(java.lang.String uuid)
          Auto generated method comment
 User getUser(java.lang.Integer userId)
           
 User getUserByUsername(java.lang.String username)
           
 User getUserByUuid(java.lang.String uuid)
          Auto generated method comment
 java.util.List<User> getUsers(java.lang.String name, java.util.List<Role> roles, boolean includeRetired)
           
 java.util.List<User> getUsersByName(java.lang.String givenName, java.lang.String familyName, boolean includeRetired)
           
 java.util.List<User> getUsersByPerson(Person person, boolean includeRetired)
           
 java.util.List<User> getUsersByRole(Role role)
           
 boolean hasDuplicateUsername(java.lang.String username, java.lang.String systemId, java.lang.Integer userId)
           
 boolean isSecretAnswer(User u, java.lang.String answer)
           
 Privilege savePrivilege(Privilege privilege)
           
 Role saveRole(Role role)
           
 User saveUser(User user, java.lang.String password)
           
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
          Set session factory
 void updateLoginCredential(LoginCredential credential)
          Updates a user's login credentials.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

HibernateUserDAO

public HibernateUserDAO()
Method Detail

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set session factory

Parameters:
sessionFactory -

saveUser

public User saveUser(User user,
                     java.lang.String password)
Specified by:
saveUser in interface UserDAO
See Also:
UserService.saveUser(org.openmrs.User, java.lang.String)

getUserByUsername

public User getUserByUsername(java.lang.String username)
Specified by:
getUserByUsername in interface UserDAO
See Also:
UserService.getUserByUsername(java.lang.String)

hasDuplicateUsername

public boolean hasDuplicateUsername(java.lang.String username,
                                    java.lang.String systemId,
                                    java.lang.Integer userId)
Specified by:
hasDuplicateUsername in interface UserDAO
See Also:
UserService.hasDuplicateUsername(org.openmrs.User)

getUser

public User getUser(java.lang.Integer userId)
Specified by:
getUser in interface UserDAO
See Also:
UserService.getUser(java.lang.Integer)

getAllUsers

public java.util.List<User> getAllUsers()
                                 throws DAOException
Specified by:
getAllUsers in interface UserDAO
Throws:
DAOException
See Also:
UserService.getAllUsers()

deleteUser

public void deleteUser(User user)
Specified by:
deleteUser in interface UserDAO
See Also:
UserService.deleteUser(org.openmrs.User)

getUsersByRole

public java.util.List<User> getUsersByRole(Role role)
                                    throws DAOException
Throws:
DAOException
See Also:
UserService.getUsersByRole(org.openmrs.Role)

getAllPrivileges

public java.util.List<Privilege> getAllPrivileges()
                                           throws DAOException
Specified by:
getAllPrivileges in interface UserDAO
Throws:
DAOException
See Also:
UserService.getAllPrivileges()

getPrivilege

public Privilege getPrivilege(java.lang.String p)
                       throws DAOException
Specified by:
getPrivilege in interface UserDAO
Throws:
DAOException
See Also:
UserService.getPrivilege(String)

deletePrivilege

public void deletePrivilege(Privilege privilege)
                     throws DAOException
Specified by:
deletePrivilege in interface UserDAO
Throws:
DAOException
See Also:
UserDAO.deletePrivilege(org.openmrs.Privilege)

savePrivilege

public Privilege savePrivilege(Privilege privilege)
                        throws DAOException
Specified by:
savePrivilege in interface UserDAO
Throws:
DAOException
See Also:
UserDAO.savePrivilege(org.openmrs.Privilege)

deleteRole

public void deleteRole(Role role)
                throws DAOException
Specified by:
deleteRole in interface UserDAO
Throws:
DAOException
See Also:
UserService.purgeRole(org.openmrs.Role)

saveRole

public Role saveRole(Role role)
              throws DAOException
Specified by:
saveRole in interface UserDAO
Throws:
DAOException
See Also:
UserService.saveRole(org.openmrs.Role)

getAllRoles

public java.util.List<Role> getAllRoles()
                                 throws DAOException
Specified by:
getAllRoles in interface UserDAO
Throws:
DAOException
See Also:
UserService.getAllRoles()

getRole

public Role getRole(java.lang.String r)
             throws DAOException
Specified by:
getRole in interface UserDAO
Throws:
DAOException
See Also:
UserService.getRole(String)

changePassword

public void changePassword(User u,
                           java.lang.String pw)
                    throws DAOException
Specified by:
changePassword in interface UserDAO
Throws:
DAOException
See Also:
UserDAO.changePassword(org.openmrs.User, java.lang.String)

changeHashedPassword

public void changeHashedPassword(User user,
                                 java.lang.String hashedPassword,
                                 java.lang.String salt)
                          throws DAOException
Specified by:
changeHashedPassword in interface UserDAO
Throws:
DAOException
See Also:
UserDAO.changeHashedPassword(User, String, String)

changePassword

public void changePassword(java.lang.String pw,
                           java.lang.String pw2)
                    throws DAOException
Specified by:
changePassword in interface UserDAO
Throws:
DAOException
See Also:
UserService.changePassword(java.lang.String, java.lang.String)

changeQuestionAnswer

public void changeQuestionAnswer(java.lang.String pw,
                                 java.lang.String question,
                                 java.lang.String answer)
                          throws DAOException
Specified by:
changeQuestionAnswer in interface UserDAO
Throws:
DAOException
See Also:
UserService.changeQuestionAnswer(java.lang.String, java.lang.String, java.lang.String)

changeQuestionAnswer

public void changeQuestionAnswer(User u,
                                 java.lang.String question,
                                 java.lang.String answer)
                          throws DAOException
Specified by:
changeQuestionAnswer in interface UserDAO
Throws:
DAOException
See Also:
UserService.changeQuestionAnswer(User, String, String)

isSecretAnswer

public boolean isSecretAnswer(User u,
                              java.lang.String answer)
                       throws DAOException
Specified by:
isSecretAnswer in interface UserDAO
Throws:
DAOException
See Also:
UserService.isSecretAnswer(User, java.lang.String)

getUsers

public java.util.List<User> getUsers(java.lang.String name,
                                     java.util.List<Role> roles,
                                     boolean includeRetired)
Specified by:
getUsers in interface UserDAO
See Also:
UserService.getUsers(java.lang.String, java.util.List, boolean)

generateSystemId

public java.lang.Integer generateSystemId()
Specified by:
generateSystemId in interface UserDAO
See Also:
UserService.generateSystemId()

getUsersByName

public java.util.List<User> getUsersByName(java.lang.String givenName,
                                           java.lang.String familyName,
                                           boolean includeRetired)
Specified by:
getUsersByName in interface UserDAO
See Also:
UserService.getUsersByName(java.lang.String, java.lang.String, boolean)

getPrivilegeByUuid

public Privilege getPrivilegeByUuid(java.lang.String uuid)
Description copied from interface: UserDAO
Auto generated method comment

Specified by:
getPrivilegeByUuid in interface UserDAO
Returns:
See Also:
UserDAO.getPrivilegeByUuid(java.lang.String)

getRoleByUuid

public Role getRoleByUuid(java.lang.String uuid)
Description copied from interface: UserDAO
Auto generated method comment

Specified by:
getRoleByUuid in interface UserDAO
Returns:
See Also:
UserDAO.getRoleByUuid(java.lang.String)

getUserByUuid

public User getUserByUuid(java.lang.String uuid)
Description copied from interface: UserDAO
Auto generated method comment

Specified by:
getUserByUuid in interface UserDAO
Returns:
See Also:
UserDAO.getUserByUuid(java.lang.String)

getLoginCredential

public LoginCredential getLoginCredential(User user)
Specified by:
getLoginCredential in interface UserDAO
Returns:
The login credentials for a specified user.
See Also:
UserDAO.getLoginCredential(org.openmrs.User)

getLoginCredentialByUuid

public LoginCredential getLoginCredentialByUuid(java.lang.String uuid)
Description copied from interface: UserDAO
Auto generated method comment

Specified by:
getLoginCredentialByUuid in interface UserDAO
Returns:
See Also:
UserDAO.getLoginCredential(org.openmrs.User)

updateLoginCredential

public void updateLoginCredential(LoginCredential credential)
Description copied from interface: UserDAO
Updates a user's login credentials. Note that there is no createLoginCredential(LoginCredential) method. Login credentials are dependent on a User already existing.

Specified by:
updateLoginCredential in interface UserDAO
See Also:
org.openmrs.api.db.UserDAO#updateLoginCredential(org.openmrs.LoginCredential)

getUsersByPerson

public java.util.List<User> getUsersByPerson(Person person,
                                             boolean includeRetired)
Specified by:
getUsersByPerson in interface UserDAO
See Also:
UserDAO.getUsersByPerson(org.openmrs.Person, boolean)

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change