public interface ContextDAO
Modifier and Type | Method and Description |
---|---|
User |
authenticate(String username,
String password)
Authenticate user with the given username and password.
|
void |
clearEntireCache()
Evicts data from all cache regions.
|
void |
clearSession() |
void |
closeSession()
Close session.
|
User |
createUser(User user,
String password,
List<String> roleNames)
Creates a new user.
|
void |
evictAllEntities(Class<?> entityClass)
Evicts all entity data of a particular class from the given region.
|
void |
evictEntity(OpenmrsObject object)
Evicts the entity data for a particular entity instance.
|
void |
evictFromSession(Object obj)
Used to clear a cached object out of a session in the middle of a unit of work.
|
void |
flushSession() |
Connection |
getDatabaseConnection() |
User |
getUserByUsername(String username)
Gets a user given the username.
|
User |
getUserByUuid(String uuid)
Gets a user given the uuid.
|
void |
mergeDefaultRuntimeProperties(Properties runtimeProperties)
Merge in the default properties defined for this database connection
|
void |
openSession()
Open session.
|
void |
refreshEntity(Object obj)
Used to re-read the state of the given instance from the underlying database.
|
void |
setupSearchIndex()
Updates the search index if necessary.
|
void |
shutdown()
Stops the OpenMRS System Should be called after all activity has ended and application is
closing
|
void |
startup(Properties props)
Starts the OpenMRS System
Should be called prior to any kind of activity
|
void |
updateSearchIndex() |
Future<?> |
updateSearchIndexAsync() |
void |
updateSearchIndexForObject(Object object) |
void |
updateSearchIndexForType(Class<?> type) |
User authenticate(String username, String password) throws ContextAuthenticationException
username
- user's username or systemIdpassword
- user's passwordContextAuthenticationException
- Should authenticate given username and password
Should authenticate given systemId and password
Should authenticate given systemId without hyphen and password
Should not authenticate given username and incorrect password
Should not authenticate given systemId and incorrect password
Should not authenticate given incorrect username
Should not authenticate given incorrect systemId
Should not authenticate given null login
Should not authenticate given empty login
Should not authenticate given null password when password in database is null
Should not authenticate given non null password when password in database is null
Should not authenticate when password in database is empty
Should give identical error messages between username and password mismatch
Should lockout user after eight failed attempts
Should authenticateWithCorrectHashedPassword
Should authenticateWithIncorrectHashedPassword
Should set uuid on user property when authentication fails with valid user
Should pass regression test for 1580
Should throw a ContextAuthenticationException if username is an empty string
Should throw a ContextAuthenticationException if username is white spaceUser getUserByUuid(String uuid) throws ContextAuthenticationException
Context.getAuthenticatedUser()
method.uuid
- uuid of user to fetchContextAuthenticationException
User getUserByUsername(String username)
Context.getAuthenticatedUser()
or Context.authenticate(org.openmrs.api.context.Credentials)
methods.username
- The username of the user to fetchUser createUser(User user, String password, List<String> roleNames) throws Exception
user
- A new user to be created.password
- The password for the new user.roleNames
- A list of role names to add to the user.Exception
void openSession()
void closeSession()
void clearSession()
Context.clearSession()
void flushSession()
Context.flushSession()
void evictFromSession(Object obj)
obj
- The object to evict/remove from the sessionContext.evictFromSession(Object)
void evictEntity(OpenmrsObject object)
object
- entity instance to evict from the DB cacheContext.evictEntity(OpenmrsObject)
void evictAllEntities(Class<?> entityClass)
entityClass
- entity class to evict from the DB cacheContext.evictAllEntities(Class)
void clearEntireCache()
Context.clearEntireCache()
void refreshEntity(Object obj)
obj
- The object to refresh from the database in the sessionContext.refreshEntity(Object)
void startup(Properties props)
Should be called prior to any kind of activity
props
- Propertiesvoid shutdown()
void mergeDefaultRuntimeProperties(Properties runtimeProperties)
runtimeProperties
- The current user specific runtime propertiesvoid setupSearchIndex()
The update is triggered if OpenmrsConstants.GP_SEARCH_INDEX_VERSION
is blank
or the value does not match OpenmrsConstants.SEARCH_INDEX_VERSION
.
void updateSearchIndex()
Context.updateSearchIndex()
Future<?> updateSearchIndexAsync()
Context.updateSearchIndexAsync()
void updateSearchIndexForObject(Object object)
void updateSearchIndexForType(Class<?> type)
Context.updateSearchIndexForType(Class)
Connection getDatabaseConnection()
Copyright © 2024 OpenMRS Inc.. All rights reserved.