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
-
-
Constructor Summary
Constructors Constructor Description HibernateAccessTokenDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
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 name-
Methods 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 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
-
-
-
-
Method Detail
-
findByTokenId
@NotNull public @NotNull Optional<MutableAccessToken> findByTokenId(String tokenId)
- Specified by:
findByTokenId
in interfaceAccessTokenDao
- Returns:
- Optional with token if exists, otherwise
Optional.empty()
-
findByUserName
@NotNull public @NotNull List<MutableAccessToken> findByUserName(String userName)
Description copied from interface:AccessTokenDao
Get all user's tokens- Specified by:
findByUserName
in interfaceAccessTokenDao
- Returns:
- tokens
-
deleteByUserName
public void deleteByUserName(String userName)
Description copied from interface:AccessTokenDao
Delete all user's tokens- Specified by:
deleteByUserName
in interfaceAccessTokenDao
-
countByUserName
public long countByUserName(String userName)
- 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
public long scrollTokensForExport(@NotNull @NotNull Consumer<MutableAccessToken> consumer)
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:
-
-