Package com.logicaldoc.core.security.dao
Class HibernateUserDAO
- java.lang.Object
- 
- com.logicaldoc.core.HibernatePersistentObjectDAO<User>
- 
- com.logicaldoc.core.security.dao.HibernateUserDAO
 
 
- 
- All Implemented Interfaces:
- PersistentObjectDAO<User>,- UserDAO
 
 public class HibernateUserDAO extends HibernatePersistentObjectDAO<User> implements UserDAO Hibernate implementation ofUserDAO- Since:
- 3.0
- Author:
- Marco Meschieri - LogicalDOC
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcount(Long tenantId)Counts the total number of standard usersintcountGuests(Long tenantId)Counts the total number of guest usersbooleandelete(long userId, int code)This method deletes an entity and you can give a deletion codebooleandelete(long userId, UserHistory transaction)This method deletes the user object and insert a new user history entry.UserfindAdminUser(String tenantName)Retrieve the administrator for the given tenant.Set<User>findByGroup(long groupId)Retrieves the users belonging to a given group.UserfindById(long id)This method finds an entity by IDList<User>findByLikeUsername(String username)This method finds an User by username.List<User>findByName(String name)This method finds an User by name.UserfindByUsername(String username)This method finds an User by its username.List<User>findByUsernameAndName(String username, String name)This method finds an User by username and name.UserfindByUsernameIgnoreCase(String username)This method finds an User by its username.Map<String,Generic>findUserSettings(long userId, String namePrefix)Retrieves the settings for a user.UsergetUser(String username)Depending on the global setting, it invokes findByUsername or findByUsernameIgnoreCaseUserHistoryDAOgetUserHistoryDAO()UserListenerManagergetUserListenerManager()static booleanignoreCaseLogin()voidinitialize(User user)Doesn't do anything by defaultbooleanisInactive(String username)Checks if a user is inactive, that is a user without interactions in the last X days after it has last enabled.booleanisPasswordExpired(String username)Is password expired.voidsetConfig(ContextProperties config)voidsetGenericDAO(GenericDAO genericDAO)voidsetPasswordHistoryDAO(PasswordHistoryDAO passwordHistoryDAO)voidsetUserHistoryDAO(UserHistoryDAO userHistoryDAO)voidsetUserListenerManager(UserListenerManager userListenerManager)booleanstore(User user)This method persists the entity objectbooleanstore(User user, UserHistory transaction)This method persists the user object and insert a new user history entry.booleanvalidateUser(String username)Validates an username only (the password content is not inspected).booleanvalidateUser(String username, String password)Validates an username and a password- 
Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, getSessionFactory, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString, setSessionFactory
 - 
Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAObulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString
 
- 
 
- 
- 
- 
Method Detail- 
ignoreCaseLoginpublic static boolean ignoreCaseLogin() 
 - 
findByNamepublic List<User> findByName(String name) Description copied from interface:UserDAOThis method finds an User by name.- Specified by:
- findByNamein interface- UserDAO
- Parameters:
- name- The name of wanted User.
- Returns:
- Collection of selected users.
 
 - 
findByUsernamepublic User findByUsername(String username) Description copied from interface:UserDAOThis method finds an User by its username. The search is case sensitive.- Specified by:
- findByUsernamein interface- UserDAO
- Parameters:
- username- username of wanted User.
- Returns:
- Wanted User or null if user doesn't exist.
 
 - 
findByUsernameIgnoreCasepublic User findByUsernameIgnoreCase(String username) Description copied from interface:UserDAOThis method finds an User by its username. The search is case insensitive.- Specified by:
- findByUsernameIgnoreCasein interface- UserDAO
- Parameters:
- username- username of wanted User.
- Returns:
- Wanted User or null if user doesn't exist.
 
 - 
findByLikeUsernamepublic List<User> findByLikeUsername(String username) Description copied from interface:UserDAOThis method finds an User by username.- Specified by:
- findByLikeUsernamein interface- UserDAO
- Parameters:
- username- The username of wanted User.
- Returns:
- Collection of selected users.
- See Also:
- UserDAO.findByUsername(java.lang.String)
 
 - 
findByUsernameAndNamepublic List<User> findByUsernameAndName(String username, String name) Description copied from interface:UserDAOThis method finds an User by username and name.- Specified by:
- findByUsernameAndNamein interface- UserDAO
- Parameters:
- username- The username of wanted user
- name- The name of wanted user
- Returns:
- Collection of selected users
 
 - 
storepublic boolean store(User user) Description copied from interface:PersistentObjectDAOThis method persists the entity object- Specified by:
- storein interface- PersistentObjectDAO<User>
- Overrides:
- storein class- HibernatePersistentObjectDAO<User>
- Parameters:
- user- entity to be stored
- Returns:
- True if successfully stored in a database
 
 - 
storepublic boolean store(User user, UserHistory transaction) throws PasswordAlreadyUsedException Description copied from interface:UserDAOThis method persists the user object and insert a new user history entry.- Specified by:
- storein interface- UserDAO
- Parameters:
- user- the user to store
- transaction- entry to log the event
- Returns:
- True if successfully stored in a database.
- Throws:
- PasswordAlreadyUsedException
 
 - 
validateUserpublic boolean validateUser(String username, String password) Description copied from interface:UserDAOValidates an username and a password- Specified by:
- validateUserin interface- UserDAO
- Parameters:
- username- Username of the User to be validated
- password- Password of the User to be validated
- Returns:
- True if User is valid and authenticated.
- See Also:
- UserDAO.validateUser(java.lang.String, java.lang.String)
 
 - 
validateUserpublic boolean validateUser(String username) Description copied from interface:UserDAOValidates an username only (the password content is not inspected).- Specified by:
- validateUserin interface- UserDAO
- Parameters:
- username- Username of the User to be validated.
- Returns:
- True if User is valid.
 
 - 
isPasswordExpiredpublic boolean isPasswordExpired(String username) Description copied from interface:UserDAOIs password expired.- Specified by:
- isPasswordExpiredin interface- UserDAO
- Parameters:
- username- Username of the User to be validated.
- Returns:
- True if the password is expired
 
 - 
isInactivepublic boolean isInactive(String username) Description copied from interface:UserDAOChecks if a user is inactive, that is a user without interactions in the last X days after it has last enabled. We look at theUser.getMaxInactivity()first en then we fallback to the general parameter security.user.maxinactivity- Specified by:
- isInactivein interface- UserDAO
- Parameters:
- username- identifier of the user
- Returns:
- the last interaction time
 
 - 
countpublic int count(Long tenantId) Description copied from interface:UserDAOCounts the total number of standard users
 - 
countGuestspublic int countGuests(Long tenantId) Description copied from interface:UserDAOCounts the total number of guest users- Specified by:
- countGuestsin interface- UserDAO
- Parameters:
- tenantId- identifier of the tenant
- Returns:
- total number of guest users
 
 - 
deletepublic boolean delete(long userId, int code)Description copied from interface:PersistentObjectDAOThis method deletes an entity and you can give a deletion code- Specified by:
- deletein interface- PersistentObjectDAO<User>
- Overrides:
- deletein class- HibernatePersistentObjectDAO<User>
- Parameters:
- userId- ID of the entity which should be deleted
- code- Deletion code
- Returns:
- if the record has been successfully deleted
 
 - 
deletepublic boolean delete(long userId, UserHistory transaction)Description copied from interface:UserDAOThis method deletes the user object and insert a new user history entry.
 - 
getUserHistoryDAOpublic UserHistoryDAO getUserHistoryDAO() 
 - 
setUserHistoryDAOpublic void setUserHistoryDAO(UserHistoryDAO userHistoryDAO) 
 - 
setUserListenerManagerpublic void setUserListenerManager(UserListenerManager userListenerManager) 
 - 
getUserListenerManagerpublic UserListenerManager getUserListenerManager() 
 - 
initializepublic void initialize(User user) Description copied from class:HibernatePersistentObjectDAODoesn't do anything by default- Specified by:
- initializein interface- PersistentObjectDAO<User>
- Overrides:
- initializein class- HibernatePersistentObjectDAO<User>
- Parameters:
- user- The entity to be initialised
 
 - 
findUserSettingspublic Map<String,Generic> findUserSettings(long userId, String namePrefix) Description copied from interface:UserDAORetrieves the settings for a user. The settings are stored as Generics of type usersetting.- Specified by:
- findUserSettingsin interface- UserDAO
- Parameters:
- userId- Identifier of the user
- namePrefix- Name prefix of the property (optional)
- Returns:
- The map setting_name-generic
 
 - 
setGenericDAOpublic void setGenericDAO(GenericDAO genericDAO) 
 - 
findAdminUserpublic User findAdminUser(String tenantName) Description copied from interface:UserDAORetrieve the administrator for the given tenant. The general rule is that the administrator's username is:- admin if the tenant is default
- adminTenantname in all other cases
 - Specified by:
- findAdminUserin interface- UserDAO
- Parameters:
- tenantName- name of the tenant
- Returns:
- the user to administrate the tenant
 
 - 
findByGrouppublic Set<User> findByGroup(long groupId) Description copied from interface:UserDAORetrieves the users belonging to a given group.- Specified by:
- findByGroupin interface- UserDAO
- Parameters:
- groupId- Identifier of the group
- Returns:
- the set of groups
 
 - 
findByIdpublic User findById(long id) throws PersistenceException Description copied from interface:PersistentObjectDAOThis method finds an entity by ID- Specified by:
- findByIdin interface- PersistentObjectDAO<User>
- Overrides:
- findByIdin class- HibernatePersistentObjectDAO<User>
- Parameters:
- id- ID of the entity
- Returns:
- Entity with given ID
- Throws:
- PersistenceException- raised in case of errors in the database
 
 - 
getUserpublic User getUser(String username) Description copied from interface:UserDAODepending on the global setting, it invokes findByUsername or findByUsernameIgnoreCase
 - 
setPasswordHistoryDAOpublic void setPasswordHistoryDAO(PasswordHistoryDAO passwordHistoryDAO) 
 - 
setConfigpublic void setConfig(ContextProperties config) 
 
- 
 
-