public class ExpirableUserTokenDaoHibernate extends HibernateDao<InternalExpirableUserToken> implements ExpirableUserTokenDao
ExpirableUserTokenDao
batchFinder, batchProcessor, logger, statelessSessionBatchProcessor, timeSource
sessionFactory
Constructor and Description |
---|
ExpirableUserTokenDaoHibernate() |
Modifier and Type | Method and Description |
---|---|
ExpirableUserToken |
add(ExpirableUserToken token)
Persist the given token
|
Optional<ExpirableUserToken> |
findByToken(String token)
Find the token with the given random hash
|
Optional<ExpirableUserToken> |
findToken(long directoryId,
String username)
Returns token for given user.
|
Class<InternalExpirableUserToken> |
getPersistentClass()
All subclasses of HibernateDao must implement this method for
HibernateDao.load(Serializable) to work
correctly. |
boolean |
removeByDirectoryAndUsername(long directoryId,
String username)
Remove all the tokens matching the username and directory id
|
boolean |
removeByToken(String token)
Removes the token with the given random hash
|
boolean |
removeExpiredTokens(Date cutoffDate)
Remove all the tokens whose expiry date is older than the given cutoff date
|
createDeleteQuery, createDeleteQuery, createQuery, createQuery, executeHQLQuery, 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
setSessionFactory, withStatelessSession
public ExpirableUserToken add(ExpirableUserToken token) throws ObjectAlreadyExistsException
ExpirableUserTokenDao
add
in interface ExpirableUserTokenDao
token
- a tokenObjectAlreadyExistsException
- if a token with the same random hash already existspublic Optional<ExpirableUserToken> findByToken(String token)
ExpirableUserTokenDao
findByToken
in interface ExpirableUserTokenDao
token
- a random hashpublic boolean removeByToken(String token)
ExpirableUserTokenDao
removeByToken
in interface ExpirableUserTokenDao
token
- a random hashpublic boolean removeExpiredTokens(Date cutoffDate)
ExpirableUserTokenDao
removeExpiredTokens
in interface ExpirableUserTokenDao
cutoffDate
- a datepublic boolean removeByDirectoryAndUsername(long directoryId, String username)
ExpirableUserTokenDao
removeByDirectoryAndUsername
in interface ExpirableUserTokenDao
directoryId
- directory where the user livesusername
- username to remove tokens forpublic Optional<ExpirableUserToken> findToken(long directoryId, String username)
ExpirableUserTokenDao
findToken
in interface ExpirableUserTokenDao
public Class<InternalExpirableUserToken> getPersistentClass()
HibernateDao
HibernateDao.load(Serializable)
to work
correctly.getPersistentClass
in class HibernateDao<InternalExpirableUserToken>
Copyright © 2020 Atlassian. All rights reserved.