org.openmrs.api.db
Interface ContextDAO

All Known Implementing Classes:
HibernateContextDAO

public interface ContextDAO

Defines the functions that the Context needs to access the database


Method Summary
 User authenticate(java.lang.String username, java.lang.String password)
          Authenticate user with the given username and password.
 void clearSession()
           
 void closeSession()
          Close session.
 void evictFromSession(java.lang.Object obj)
          Used to clear a cached object out of a session in the middle of a unit of work.
 void flushSession()
           
 User getUserByUuid(java.lang.String uuid)
          Gets a user given the uuid.
 void mergeDefaultRuntimeProperties(java.util.Properties runtimeProperties)
          Merge in the default properties defined for this database connection
 void openSession()
          Open session.
 void shutdown()
          Stops the OpenMRS System Should be called after all activity has ended and application is closing
 void startup(java.util.Properties props)
          Starts the OpenMRS System
 

Method Detail

authenticate

@Transactional(noRollbackFor=ContextAuthenticationException.class)
User authenticate(java.lang.String username,
                                                                    java.lang.String password)
                  throws ContextAuthenticationException
Authenticate user with the given username and password.

Parameters:
username - user's username or systemId
password - user's password
Returns:
a valid user if authentication succeeds
Throws:
ContextAuthenticationException
Expected behavior:
authenticate given username and password, authenticate given systemId and password, authenticate given systemId without hyphen and password, not authenticate given username and incorrect password, not authenticate given systemId and incorrect password, not authenticate given incorrect username, not authenticate given incorrect systemId, not authenticate given null login, not authenticate given empty login, not authenticate given null password when password in database is null, not authenticate given non null password when password in database is null, not authenticate when password in database is empty, give identical error messages between username and password mismatch, lockout user after eight failed attempts, authenticateWithCorrectHashedPassword, authenticateWithIncorrectHashedPassword, set uuid on user property when authentication fails with valid user, pass regression test for 1580, throw a ContextAuthenticationException if username is an empty string, should throw a ContextAuthenticationException if username is white space

getUserByUuid

@Transactional(readOnly=true)
User getUserByUuid(java.lang.String uuid)
                   throws ContextAuthenticationException
Gets a user given the uuid. Privilege checks are not done here because this is used by the Context.getAuthenticatedUser() method.

Parameters:
uuid - uuid of user to fetch
Returns:
the User from the database
Throws:
ContextAuthenticationException

openSession

void openSession()
Open session.


closeSession

void closeSession()
Close session.


clearSession

@Transactional
void clearSession()
See Also:
Context.clearSession()

flushSession

@Transactional
void flushSession()
See Also:
Context.flushSession()

evictFromSession

void evictFromSession(java.lang.Object obj)
Used to clear a cached object out of a session in the middle of a unit of work. Future updates to this object will not be saved. Future gets of this object will not fetch this cached copy

Parameters:
obj - The object to evict/remove from the session
See Also:
Context.evictFromSession(Object)

startup

@Transactional
void startup(java.util.Properties props)
Starts the OpenMRS System

Should be called prior to any kind of activity

Parameters:
props - Properties

shutdown

void shutdown()
Stops the OpenMRS System Should be called after all activity has ended and application is closing


mergeDefaultRuntimeProperties

void mergeDefaultRuntimeProperties(java.util.Properties runtimeProperties)
Merge in the default properties defined for this database connection

Parameters:
runtimeProperties - The current user specific runtime properties

OpenMRS-1.7.x

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