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, timeSource
Fields 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.boolean
removeByDirectoryAndUsername
(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType) Remove all the tokens matching the username and directory idboolean
removeByToken
(String token) Removes the token with the given random hashboolean
removeExpiredTokens
(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, update
Methods inherited from class com.atlassian.crowd.util.persistence.hibernate.StatelessDao
setSessionFactory, withStatelessSession
-
Constructor Details
-
ExpirableUserTokenDaoHibernate
public ExpirableUserTokenDaoHibernate()
-
-
Method Details
-
add
Description copied from interface:ExpirableUserTokenDao
Persist the given token- Specified by:
add
in 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:ExpirableUserTokenDao
Find the token with the given random hash- Specified by:
findByToken
in interfaceExpirableUserTokenDao
- Parameters:
token
- a random hash- Returns:
- the token that was found, or none
-
removeByToken
Description copied from interface:ExpirableUserTokenDao
Removes the token with the given random hash- Specified by:
removeByToken
in interfaceExpirableUserTokenDao
- Parameters:
token
- a random hash- Returns:
- true if a token was deleted, false otherwise
-
removeExpiredTokens
Description copied from interface:ExpirableUserTokenDao
Remove all the tokens whose expiry date is older than the given cutoff date- Specified by:
removeExpiredTokens
in 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:ExpirableUserTokenDao
Remove all the tokens matching the username and directory id- Specified by:
removeByDirectoryAndUsername
in 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:ExpirableUserTokenDao
Returns all tokens for a given user.- Specified by:
findAllTokens
in 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:HibernateDao
All subclasses of HibernateDao must implement this method forHibernateDao.load(Serializable)
to work correctly.- Specified by:
getPersistentClass
in classHibernateDao<InternalExpirableUserToken>
- Returns:
- the entity class for this DAO
-