com.atlassian.crowd.dao.token
Interface TokenDAO

All Known Implementing Classes:
TokenDAOHibernate, TokenDAOMemory

public interface TokenDAO

Manages persistence of Token


Method Summary
 Token add(Token token)
          Persists a new token.
 Token findByIdentifierHash(String identifierHash)
          Finds token by identifier hash.
 Token findByRandomHash(String randomHash)
          Finds token by random hash.
 Collection<Token> loadAll()
          Used when switching implementations.
 void remove(long directoryId, String name)
          Remove token.
 void remove(Token token)
          Removes a token.
 void removeAll()
          Wipes all tokens from the store.
 void removeAll(long directoryId)
          Remove all tokens associated with the given directory id.
 void removeExpiredTokens(Date currentTime, long maxLifeSeconds)
          Remove all tokens that have expired.
 void saveAll(Collection<Token> tokens)
          Used when switching implementations.
 List<Token> search(EntityQuery<? extends Token> query)
          Searches for token based on criteria.
 Token update(Token token)
           
 

Method Detail

findByRandomHash

Token findByRandomHash(String randomHash)
                       throws ObjectNotFoundException
Finds token by random hash.

Parameters:
randomHash - Random hash.
Returns:
Token.
Throws:
ObjectNotFoundException - if the token identified by the random hash cannot be found.

findByIdentifierHash

Token findByIdentifierHash(String identifierHash)
                           throws ObjectNotFoundException
Finds token by identifier hash.

Parameters:
identifierHash - Identifier hash.
Returns:
Token.
Throws:
ObjectNotFoundException - if the token identified by the identifier hash cannot be found.

add

Token add(Token token)
Persists a new token.

Parameters:
token - Token.
Returns:
The persisted token.

update

Token update(Token token)
             throws ObjectNotFoundException
Parameters:
token - token to update.
Returns:
updates the last accessed date on the token (sets it to now).
Throws:
ObjectNotFoundException

remove

void remove(Token token)
Removes a token.

Parameters:
token - Token.

search

List<Token> search(EntityQuery<? extends Token> query)
Searches for token based on criteria.

Parameters:
query - Query.
Returns:
List of tokens which qualify for the criteria.

remove

void remove(long directoryId,
            String name)
Remove token.

Parameters:
directoryId - Directory id.
name - User or application name.

removeAll

void removeAll(long directoryId)
Remove all tokens associated with the given directory id.

Parameters:
directoryId - Directory id.

removeExpiredTokens

void removeExpiredTokens(Date currentTime,
                         long maxLifeSeconds)
Remove all tokens that have expired.

Parameters:
currentTime - Current date
maxLifeSeconds - Max lifespan for tokens, unless they specific a shorter one.

removeAll

void removeAll()
Wipes all tokens from the store. Called after a successful loadAll() and persist into another store.

Throws:
org.springframework.dao.DataAccessException

loadAll

Collection<Token> loadAll()
Used when switching implementations. Synchronisation is the caller's responsibility; don't allow calls to other methods while this is in progress if you need to guarantee that the data are complete.

Returns:
Collection of all active tokens.
Throws:
org.springframework.dao.DataAccessException - If the tokens could not be retrieved.

saveAll

void saveAll(Collection<Token> tokens)
Used when switching implementations. Synchronization is the caller's reponsibility; don't allow calls to other methods while this is in progress if you need to guarantee that the data are complete.

Parameters:
tokens - all tokens to add.
Throws:
org.springframework.dao.DataAccessException


Copyright © 2013 Atlassian. All Rights Reserved.