Package com.atlassian.crowd.dao.token
Class ExpirableUserTokenDaoHibernate
java.lang.Object
com.atlassian.crowd.util.persistence.hibernate.StatelessDao
com.atlassian.crowd.util.persistence.hibernate.HibernateDao<InternalExpirableUserToken>
com.atlassian.crowd.dao.token.ExpirableUserTokenDaoHibernate
- All Implemented Interfaces:
ExpirableUserTokenDao
public class ExpirableUserTokenDaoHibernate
extends HibernateDao<InternalExpirableUserToken>
implements ExpirableUserTokenDao
Hibernate backed implementation of
ExpirableUserTokenDao- Since:
- v2.8
-
Field Summary
Fields inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
batchFinder, batchProcessor, logger, statelessSessionBatchProcessor, timeSourceFields inherited from class com.atlassian.crowd.util.persistence.hibernate.StatelessDao
sessionFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(ExpirableUserToken token) Persist the given tokenfindAllTokens(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType) Returns all tokens for a given user.findByToken(String token) Find the token with the given random hashAll subclasses of HibernateDao must implement this method forHibernateDao.load(Serializable)to work correctly.booleanremoveByDirectoryAndUsername(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType) Remove all the tokens matching the username and directory idbooleanremoveByToken(String token) Removes the token with the given random hashbooleanremoveExpiredTokens(Date cutoffDate) Remove all the tokens whose expiry date is older than the given cutoff dateMethods inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
createDeleteQuery, createDeleteQuery, createQuery, createQuery, executeHQLQuery, findAllInternal, findByProperties, findByPropertiesOptional, findByProperty, findByProperty, findByPropertyOptional, findByPropertyOrThrow, getCountByProperties, load, load, loadOptional, loadReference, loadReference, remove, removeByIdIfPresent, save, saveOrUpdate, session, setBatchFinder, setBatchProcessor, setClock, setStatelessSessionBatchProcessor, toPredicates, updateMethods inherited from class com.atlassian.crowd.util.persistence.hibernate.StatelessDao
setSessionFactory, withStatelessSession
-
Constructor Details
-
ExpirableUserTokenDaoHibernate
public ExpirableUserTokenDaoHibernate()
-
-
Method Details
-
add
Description copied from interface:ExpirableUserTokenDaoPersist the given token- Specified by:
addin interfaceExpirableUserTokenDao- Parameters:
token- a token- Returns:
- the persisted token
- Throws:
ObjectAlreadyExistsException- if a token with the same random hash already exists
-
findByToken
Description copied from interface:ExpirableUserTokenDaoFind the token with the given random hash- Specified by:
findByTokenin interfaceExpirableUserTokenDao- Parameters:
token- a random hash- Returns:
- the token that was found, or none
-
removeByToken
Description copied from interface:ExpirableUserTokenDaoRemoves the token with the given random hash- Specified by:
removeByTokenin interfaceExpirableUserTokenDao- Parameters:
token- a random hash- Returns:
- true if a token was deleted, false otherwise
-
removeExpiredTokens
Description copied from interface:ExpirableUserTokenDaoRemove all the tokens whose expiry date is older than the given cutoff date- Specified by:
removeExpiredTokensin interfaceExpirableUserTokenDao- Parameters:
cutoffDate- a date- Returns:
- true if some tokens were deleted, false otherwise
-
removeByDirectoryAndUsername
public boolean removeByDirectoryAndUsername(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType) Description copied from interface:ExpirableUserTokenDaoRemove all the tokens matching the username and directory id- Specified by:
removeByDirectoryAndUsernamein interfaceExpirableUserTokenDao- Parameters:
directoryId- directory where the user livesusername- username to remove tokens forexpirableUserTokenType- token type- Returns:
- true if some tokens were deleted, false otherwise
-
findAllTokens
public Set<ExpirableUserToken> findAllTokens(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType) Description copied from interface:ExpirableUserTokenDaoReturns all tokens for a given user.- Specified by:
findAllTokensin interfaceExpirableUserTokenDao- Parameters:
directoryId- user's directory IDusername- username of the userexpirableUserTokenType- token type- Returns:
- set of all tokens belonging to the user, or empty set if no tokens
-
getPersistentClass
Description copied from class:HibernateDaoAll subclasses of HibernateDao must implement this method forHibernateDao.load(Serializable)to work correctly.- Specified by:
getPersistentClassin classHibernateDao<InternalExpirableUserToken>- Returns:
- the entity class for this DAO
-