org.openmrs.api.db.hibernate
Class HibernateContextDAO

java.lang.Object
  extended by org.openmrs.api.db.hibernate.HibernateContextDAO
All Implemented Interfaces:
ContextDAO

public class HibernateContextDAO
extends java.lang.Object
implements ContextDAO

Hibernate specific implementation of the ContextDAO. These methods should not be used directly, instead, the methods on the static Context file should be used.

See Also:
ContextDAO, Context

Constructor Summary
HibernateContextDAO()
           
 
Method Summary
 User authenticate(java.lang.String login, 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)
          Takes the default properties defined in /metadata/api/hibernate/hibernate.default.properties and merges it into the user-defined runtime properties
 void openSession()
          Open session.
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
          Session factory to use for this DAO.
 void shutdown()
          Stops the OpenMRS System Should be called after all activity has ended and application is closing
 void startup(java.util.Properties properties)
          Starts the OpenMRS System
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateContextDAO

public HibernateContextDAO()
Method Detail

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Session factory to use for this DAO. This is usually injected by spring and its application context.

Parameters:
sessionFactory -

authenticate

public User authenticate(java.lang.String login,
                         java.lang.String password)
                  throws ContextAuthenticationException
Description copied from interface: ContextDAO
Authenticate user with the given username and password.

Specified by:
authenticate in interface ContextDAO
Parameters:
login - user's username or systemId
password - user's password
Returns:
a valid user if authentication succeeds
Throws:
ContextAuthenticationException
See Also:
ContextDAO.authenticate(java.lang.String, java.lang.String)

getUserByUuid

public User getUserByUuid(java.lang.String uuid)
Description copied from interface: ContextDAO
Gets a user given the uuid. Privilege checks are not done here because this is used by the Context.getAuthenticatedUser() method.

Specified by:
getUserByUuid in interface ContextDAO
Parameters:
uuid - uuid of user to fetch
Returns:
the User from the database
See Also:
ContextDAO.getUserByUuid(java.lang.String)

openSession

public void openSession()
Description copied from interface: ContextDAO
Open session.

Specified by:
openSession in interface ContextDAO

closeSession

public void closeSession()
Description copied from interface: ContextDAO
Close session.

Specified by:
closeSession in interface ContextDAO
See Also:
Context.closeSession()

clearSession

public void clearSession()
Specified by:
clearSession in interface ContextDAO
See Also:
ContextDAO.clearSession()

evictFromSession

public void evictFromSession(java.lang.Object obj)
Description copied from interface: ContextDAO
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

Specified by:
evictFromSession in interface ContextDAO
Parameters:
obj - The object to evict/remove from the session
See Also:
ContextDAO.evictFromSession(java.lang.Object)

flushSession

public void flushSession()
Specified by:
flushSession in interface ContextDAO
See Also:
ContextDAO.flushSession()

startup

public void startup(java.util.Properties properties)
Description copied from interface: ContextDAO
Starts the OpenMRS System

Should be called prior to any kind of activity

Specified by:
startup in interface ContextDAO
Parameters:
properties - Properties
See Also:
Context.startup(Properties)

shutdown

public void shutdown()
Description copied from interface: ContextDAO
Stops the OpenMRS System Should be called after all activity has ended and application is closing

Specified by:
shutdown in interface ContextDAO
See Also:
Context.shutdown()

mergeDefaultRuntimeProperties

public void mergeDefaultRuntimeProperties(java.util.Properties runtimeProperties)
Takes the default properties defined in /metadata/api/hibernate/hibernate.default.properties and merges it into the user-defined runtime properties

Specified by:
mergeDefaultRuntimeProperties in interface ContextDAO
Parameters:
runtimeProperties - The current user specific runtime properties
See Also:
ContextDAO.mergeDefaultRuntimeProperties(java.util.Properties)

OpenMRS-1.7.x

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