com.atlassian.crowd.dao.token
Class TokenDAOHibernate

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by com.atlassian.crowd.util.persistence.hibernate.HibernateDao
              extended by com.atlassian.crowd.dao.token.TokenDAOHibernate
All Implemented Interfaces:
TokenDAO, org.springframework.beans.factory.InitializingBean

public class TokenDAOHibernate
extends HibernateDao
implements TokenDAO


Field Summary
 
Fields inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
batchFinder, batchProcessor, logger
 
Constructor Summary
TokenDAOHibernate()
           
 
Method Summary
 Token add(Token token)
          Persists a new token.
 Token findByID(long ID)
          Finds token by its id.
 Token findByIdentifierHash(java.lang.String identifierHash)
          Finds token by identifier hash.
 Token findByRandomHash(java.lang.String randomHash)
          Finds token by random hash.
 java.lang.Class getPersistentClass()
          All subclasses of HibernateDAO must implement this method for HibernateDao.load(long) to work correctly
 java.util.Collection<Token> loadAll()
          TokenDAOPersistence.loadAll()
 void remove(long directoryId, java.lang.String name)
          Remove token.
 void remove(Token token)
          Removes a token.
 void removeAccessedBefore(java.util.Date expiryTime)
          Remove all tokens by expiryTime.
 void removeAll()
          TokenDAOPersistence.removeAll()
 void removeAll(long directoryId)
          Remove all tokens associated with the given directory id.
 void saveAll(java.util.Collection<Token> tokens)
          TokenDAOPersistence.saveAll()
 java.util.List<Token> search(EntityQuery query)
          Searches for token based on criteria.
 void setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)
           
 Token update(Token token)
           
 
Methods inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
load, loadReference, remove, save, saveOrUpdate, setBatchFinder, setBatchProcessor, update
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, 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
 

Constructor Detail

TokenDAOHibernate

public TokenDAOHibernate()
Method Detail

findByRandomHash

public Token findByRandomHash(java.lang.String randomHash)
                       throws ObjectNotFoundException
Description copied from interface: TokenDAO
Finds token by random hash.

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

findByIdentifierHash

public Token findByIdentifierHash(java.lang.String identifierHash)
                           throws ObjectNotFoundException
Description copied from interface: TokenDAO
Finds token by identifier hash.

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

add

public Token add(Token token)
Description copied from interface: TokenDAO
Persists a new token.

Specified by:
add in interface TokenDAO
Parameters:
token - Token.
Returns:
The persisted token.

update

public Token update(Token token)
Specified by:
update in interface TokenDAO
Parameters:
token - token to update.
Returns:
updates the last accessed date on the token (sets it to now).

remove

public void remove(Token token)
Description copied from interface: TokenDAO
Removes a token.

Specified by:
remove in interface TokenDAO
Parameters:
token - Token.

search

public java.util.List<Token> search(EntityQuery query)
Description copied from interface: TokenDAO
Searches for token based on criteria.

Specified by:
search in interface TokenDAO
Parameters:
query - Query.
Returns:
List of tokens which qualify for the criteria.

findByID

public Token findByID(long ID)
               throws ObjectNotFoundException
Description copied from interface: TokenDAO
Finds token by its id.

Specified by:
findByID in interface TokenDAO
Parameters:
ID - id.
Returns:
Token.
Throws:
ObjectNotFoundException - if the Token cannot be found.

remove

public void remove(long directoryId,
                   java.lang.String name)
Description copied from interface: TokenDAO
Remove token.

Specified by:
remove in interface TokenDAO
Parameters:
directoryId - Directory id.
name - User or application name.

removeAll

public void removeAll(long directoryId)
Description copied from interface: TokenDAO
Remove all tokens associated with the given directory id.

Specified by:
removeAll in interface TokenDAO
Parameters:
directoryId - Directory id.

getPersistentClass

public java.lang.Class getPersistentClass()
Description copied from class: HibernateDao
All subclasses of HibernateDAO must implement this method for HibernateDao.load(long) to work correctly

Specified by:
getPersistentClass in class HibernateDao
Returns:
Class

loadAll

public java.util.Collection<Token> loadAll()
TokenDAOPersistence.loadAll()

Specified by:
loadAll in interface TokenDAO
Returns:
Collection of all active tokens.

saveAll

public void saveAll(java.util.Collection<Token> tokens)
TokenDAOPersistence.saveAll()

Specified by:
saveAll in interface TokenDAO
Parameters:
tokens - all tokens to add.

removeAll

public void removeAll()
TokenDAOPersistence.removeAll()

Specified by:
removeAll in interface TokenDAO

removeAccessedBefore

public void removeAccessedBefore(java.util.Date expiryTime)
Description copied from interface: TokenDAO
Remove all tokens by expiryTime.

Specified by:
removeAccessedBefore in interface TokenDAO
Parameters:
expiryTime - Expiry time.

setHqlQueryTranslater

public void setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)


Copyright © 2012 Atlassian. All Rights Reserved.