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.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcountByUserName(String userName) longcountTokensWithPermission(@NotNull AccessTokenPermission accessTokenPermission) Count number of access tokens with given permissionvoiddeleteByUserName(String userName) Delete all user's tokens@NotNull Optional<MutableAccessToken> findByTokenId(String tokenId) @NotNull List<MutableAccessToken> findByUserName(String userName) Get all user's tokenslongscrollTokensForExport(@NotNull Consumer<MutableAccessToken> consumer) Scroll through all AccessToken records and pass them to consumerbooleantokenWithNameAndUserNameExists(@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, findAll, findById, merge, save, saveAllMethods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactoryMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
Constructor Details
-
HibernateAccessTokenDao
public HibernateAccessTokenDao()
-
-
Method Details
-
findByTokenId
- Specified by:
findByTokenIdin interfaceAccessTokenDao- Parameters:
tokenId-- Returns:
- Optional with token if exists, otherwise
Optional.empty()
-
findByUserName
Description copied from interface:AccessTokenDaoGet all user's tokens- Specified by:
findByUserNamein interfaceAccessTokenDao- Parameters:
userName-- Returns:
- tokens
-
deleteByUserName
Description copied from interface:AccessTokenDaoDelete all user's tokens- Specified by:
deleteByUserNamein interfaceAccessTokenDao- Parameters:
userName-
-
countByUserName
- Specified by:
countByUserNamein interfaceAccessTokenDao- Parameters:
userName-- Returns:
- number of user's tokens
-
tokenWithNameAndUserNameExists
public boolean tokenWithNameAndUserNameExists(@NotNull @NotNull String userName, @NotNull @NotNull String tokenName) Description copied from interface:AccessTokenDaoCheck if user has token with name- Specified by:
tokenWithNameAndUserNameExistsin interfaceAccessTokenDao- Parameters:
userName-tokenName-- Returns:
- true if token for user name and token name already exists
-
scrollTokensForExport
Description copied from interface:AccessTokenDaoScroll through all AccessToken records and pass them to consumer- Specified by:
scrollTokensForExportin interfaceAccessTokenDao
-
countTokensWithPermission
public long countTokensWithPermission(@NotNull @NotNull AccessTokenPermission accessTokenPermission) Description copied from interface:AccessTokenDaoCount number of access tokens with given permission- Specified by:
countTokensWithPermissionin interfaceAccessTokenDao- Parameters:
accessTokenPermission-- Returns:
-