Package com.atlassian.bamboo.accesstoken
Class HibernateAccessTokenDao
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<MutableAccessToken>
com.atlassian.bamboo.accesstoken.HibernateAccessTokenDao
- All Implemented Interfaces:
AccessTokenDao
,BambooObjectDao<MutableAccessToken>
,org.springframework.beans.factory.InitializingBean
public class HibernateAccessTokenDao
extends BambooHibernateObjectDao<MutableAccessToken>
implements AccessTokenDao
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
countByUserName
(String userName) long
countTokensWithPermission
(@NotNull AccessTokenPermission accessTokenPermission) Count number of access tokens with given permissionvoid
deleteByUserName
(String userName) Delete all user's tokens@NotNull Optional<MutableAccessToken>
findByTokenId
(String tokenId) @NotNull List<MutableAccessToken>
findByUserName
(String userName) Get all user's tokenslong
scrollTokensForExport
(@NotNull Consumer<MutableAccessToken> consumer) Scroll through all AccessToken records and pass them to consumerboolean
tokenWithNameAndUserNameExists
(@NotNull String userName, @NotNull String tokenName) Check if user has token with nameMethods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
convertSearchTermToLikeExpression, countAll, countWithRestriction, delete, deleteAll, executeCountQuery, findAll, findById, merge, save, saveAll
Methods inherited from class com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
getCacheAwareHibernateTemplate
Methods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactory
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectDao
countAll, countWithRestriction, delete, deleteAll, findAll, findById, merge, save, saveAll
-
Constructor Details
-
HibernateAccessTokenDao
public HibernateAccessTokenDao()
-
-
Method Details
-
findByTokenId
- Specified by:
findByTokenId
in interfaceAccessTokenDao
- Returns:
- Optional with token if exists, otherwise
Optional.empty()
-
findByUserName
Description copied from interface:AccessTokenDao
Get all user's tokens- Specified by:
findByUserName
in interfaceAccessTokenDao
- Returns:
- tokens
-
deleteByUserName
Description copied from interface:AccessTokenDao
Delete all user's tokens- Specified by:
deleteByUserName
in interfaceAccessTokenDao
-
countByUserName
- Specified by:
countByUserName
in interfaceAccessTokenDao
- Returns:
- number of user's tokens
-
tokenWithNameAndUserNameExists
public boolean tokenWithNameAndUserNameExists(@NotNull @NotNull String userName, @NotNull @NotNull String tokenName) Description copied from interface:AccessTokenDao
Check if user has token with name- Specified by:
tokenWithNameAndUserNameExists
in interfaceAccessTokenDao
- Returns:
- true if token for user name and token name already exists
-
scrollTokensForExport
Description copied from interface:AccessTokenDao
Scroll through all AccessToken records and pass them to consumer- Specified by:
scrollTokensForExport
in interfaceAccessTokenDao
-
countTokensWithPermission
public long countTokensWithPermission(@NotNull @NotNull AccessTokenPermission accessTokenPermission) Description copied from interface:AccessTokenDao
Count number of access tokens with given permission- Specified by:
countTokensWithPermission
in interfaceAccessTokenDao
- Returns:
-