Interface UserDAO
- All Superinterfaces:
- PersistentObjectDAO<User>
- All Known Implementing Classes:
- HibernateUserDAO
This class is a DAO-service for User-objects.
- Version:
- 1.0
- Author:
- Michael Scholz, Marco Meschieri
- 
Field SummaryFields inherited from interface com.logicaldoc.core.PersistentObjectDAOENTITY
- 
Method SummaryModifier and TypeMethodDescriptionvoidcheckPasswordCompliance(User user) Checks if the user's password complies the current quality criteriaintCounts the total number of standard usersintcountGuests(Long tenantId) Counts the total number of guest usersvoiddelete(long userId, UserHistory transaction) This method deletes the user object and insert a new user history entry.findAdminUser(String tenantName) Retrieve the administrator for the given tenant.findByGroup(long groupId) Retrieves the users belonging to a given group.findByLikeUsername(String username) This method finds an User by username.findByName(String name) This method finds an User by name.findByUsername(String username) This method finds an User by its username.findByUsernameAndName(String username, String name) This method finds an User by username and name.findByUsernameIgnoreCase(String username) This method finds an User by its username.findUserSettings(long userId, String namePrefix) Retrieves the settings for a user.Depending on the global setting, it invokes findByUsername or findByUsernameIgnoreCasebooleanisInactive(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.voidstore(User user, UserHistory transaction) This method persists the user object and insert a new user history entry.Methods inherited from interface com.logicaldoc.core.PersistentObjectDAObulkUpdate, delete, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, isMySQL, isOracle, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, store
- 
Method Details- 
countCounts the total number of standard users- Parameters:
- tenantId- identifier of the tenant
- Returns:
- total number of guest users
- Throws:
- PersistenceException- Error in the database
 
- 
countGuestsCounts the total number of guest users- Parameters:
- tenantId- identifier of the tenant
- Returns:
- total number of guest users
- Throws:
- PersistenceException- Error in the database
 
- 
findByUsernameThis method finds an User by its username. The search is case sensitive.- Parameters:
- username- username of wanted User.
- Returns:
- Wanted User or null if user doesn't exist.
- Throws:
- PersistenceException- Error in the data layer
 
- 
findByUsernameIgnoreCaseThis method finds an User by its username. The search is case insensitive.- Parameters:
- username- username of wanted User.
- Returns:
- Wanted User or null if user doesn't exist.
- Throws:
- PersistenceException- Error in the data layer
 
- 
getUserDepending on the global setting, it invokes findByUsername or findByUsernameIgnoreCase- Parameters:
- username- The username of the user
- Returns:
- The found user
- Throws:
- PersistenceException- Error in the data layer
 
- 
findByLikeUsernameThis method finds an User by username.- Parameters:
- username- The username of wanted User.
- Returns:
- Collection of selected users.
- Throws:
- PersistenceException- Error in the database
 
- 
findByNameThis method finds an User by name.- Parameters:
- name- The name of wanted User.
- Returns:
- Collection of selected users.
- Throws:
- PersistenceException- Error in the database
 
- 
findByUsernameAndNameThis method finds an User by username and name.- Parameters:
- username- The username of wanted user
- name- The name of wanted user
- Returns:
- Collection of selected users
- Throws:
- PersistenceException- Error in the database
 
- 
isPasswordExpiredIs password expired.- Parameters:
- username- Username of the User to be validated.
- Returns:
- True if the password is expired
 
- 
isInactiveChecks 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 and then we fallback to the general parameter security.user.maxinactivity- Parameters:
- username- identifier of the user
- Returns:
- the last interaction time
- Throws:
- PersistenceException- Error in the database
 
- 
deleteThis method deletes the user object and insert a new user history entry.- Parameters:
- userId- The id of the user to delete
- transaction- entry to log the event
- Throws:
- PersistenceException- error at database level
 
- 
storeThis method persists the user object and insert a new user history entry.- Parameters:
- user- the user to store
- transaction- entry to log the event
- Throws:
- PersistenceException- error at database level
 
- 
findUserSettingsRetrieves the settings for a user. The settings are stored as Generics of type usersetting.- Parameters:
- userId- Identifier of the user
- namePrefix- Name prefix of the property (optional)
- Returns:
- The map setting_name-generic
- Throws:
- PersistenceException- Error in the database
 
- 
findAdminUserRetrieve 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
 - Parameters:
- tenantName- name of the tenant
- Returns:
- the user to administrate the tenant
- Throws:
- PersistenceException- Error in the database
 
- 
findByGroupRetrieves the users belonging to a given group.- Parameters:
- groupId- Identifier of the group
- Returns:
- the set of groups
- Throws:
- PersistenceException- Error in the database
 
- 
checkPasswordComplianceChecks if the user's password complies the current quality criteria- Parameters:
- user- The user to check
- Throws:
- PasswordWeakException- Raised when the password does not comply with the quality criteria
- PersistenceException- Error in the database
 
 
-