magoffin.matt.ma2.dao.hbm
Class HibernateUserDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by magoffin.matt.dao.hbm.GenericHibernateDao<User,java.lang.Long>
              extended by magoffin.matt.ma2.dao.hbm.HibernateUserDao
All Implemented Interfaces:
magoffin.matt.dao.BatchableDao<User>, magoffin.matt.dao.GenericDao<User,java.lang.Long>, UserDao, org.springframework.beans.factory.InitializingBean

public class HibernateUserDao
extends magoffin.matt.dao.hbm.GenericHibernateDao<User,java.lang.Long>
implements UserDao

Hibernate implementation of UserDao.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
Matt Magoffin (spamsqr@msqr.us)

Nested Class Summary
 
Nested classes/interfaces inherited from class magoffin.matt.dao.hbm.GenericHibernateDao
magoffin.matt.dao.hbm.GenericHibernateDao.UpdateMode
 
Nested classes/interfaces inherited from interface magoffin.matt.dao.BatchableDao
magoffin.matt.dao.BatchableDao.BatchCallback<T>, magoffin.matt.dao.BatchableDao.BatchCallbackResult, magoffin.matt.dao.BatchableDao.BatchMode, magoffin.matt.dao.BatchableDao.BatchOptions, magoffin.matt.dao.BatchableDao.BatchResult
 
Field Summary
static java.lang.String QUERY_USER_BY_EMAIL
          Find a user by its email.
static java.lang.String QUERY_USER_BY_KEY
          Find a user by its key.
static java.lang.String QUERY_USER_BY_LOGIN
          Find a user by its username.
static java.lang.String QUERY_USERS_BY_ACCESS_LEVEL
          Find users by access level.
static java.lang.String QUERY_USERS_UNCONFIRMED_FOR_LONG_TIME
          Find users not confirmed in a long time.
 
Fields inherited from class magoffin.matt.dao.hbm.GenericHibernateDao
DEFAULT_BATCH_FLUSH_COUNT, log
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Fields inherited from interface magoffin.matt.ma2.dao.UserDao
BATCH_NAME_INDEX
 
Constructor Summary
HibernateUserDao()
          Default constructor.
 
Method Summary
 magoffin.matt.dao.BatchableDao.BatchResult batchProcess(magoffin.matt.dao.BatchableDao.BatchCallback<User> callback, magoffin.matt.dao.BatchableDao.BatchOptions options)
           
 java.util.List<User> deleteUnconfirmedRegistrations(int minDaysOld)
          Delete registered users that are unconfirmed and created longer than the specified number of days ago.
 java.util.List<User> findUsersForAccess(java.lang.Integer accessLevel)
          Find all users for a given access level.
protected  java.lang.Long getPrimaryKey(User domainObject)
           
 User getUserByEmail(java.lang.String email)
          Get a user by an email.
 User getUserByKey(java.lang.String key)
          Get a user by anonymous key.
 User getUserByLogin(java.lang.String login)
          Get a user by a login name.
 
Methods inherited from class magoffin.matt.dao.hbm.GenericHibernateDao
delete, executeLiveCriteriaBatchCallback, executeNamedQueryBatchCallback, executeStatelessCriteriaBatchCallback, findByNamedQuery, findByNamedQuery, findByNamedQuery, findByNamedQuery, findByNamedQuery, get, getBatchFlushCount, getType, getUpdateMode, save, setBatchFlushCount, setUpdateMode, store, update
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, closeSessionIfNecessary, 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
 
Methods inherited from interface magoffin.matt.dao.GenericDao
delete, get, store
 

Field Detail

QUERY_USER_BY_LOGIN

public static final java.lang.String QUERY_USER_BY_LOGIN
Find a user by its username.

See Also:
Constant Field Values

QUERY_USER_BY_EMAIL

public static final java.lang.String QUERY_USER_BY_EMAIL
Find a user by its email.

See Also:
Constant Field Values

QUERY_USER_BY_KEY

public static final java.lang.String QUERY_USER_BY_KEY
Find a user by its key.

See Also:
Constant Field Values

QUERY_USERS_BY_ACCESS_LEVEL

public static final java.lang.String QUERY_USERS_BY_ACCESS_LEVEL
Find users by access level.

See Also:
Constant Field Values

QUERY_USERS_UNCONFIRMED_FOR_LONG_TIME

public static final java.lang.String QUERY_USERS_UNCONFIRMED_FOR_LONG_TIME
Find users not confirmed in a long time.

See Also:
Constant Field Values
Constructor Detail

HibernateUserDao

public HibernateUserDao()
Default constructor.

Method Detail

getPrimaryKey

protected java.lang.Long getPrimaryKey(User domainObject)
Specified by:
getPrimaryKey in class magoffin.matt.dao.hbm.GenericHibernateDao<User,java.lang.Long>

findUsersForAccess

public java.util.List<User> findUsersForAccess(java.lang.Integer accessLevel)
Description copied from interface: UserDao
Find all users for a given access level.

Specified by:
findUsersForAccess in interface UserDao
Parameters:
accessLevel - the access level
Returns:
the access level

getUserByEmail

public User getUserByEmail(java.lang.String email)
Description copied from interface: UserDao
Get a user by an email.

Specified by:
getUserByEmail in interface UserDao
Parameters:
email - the email
Returns:
the user, or null if not found

getUserByLogin

public User getUserByLogin(java.lang.String login)
Description copied from interface: UserDao
Get a user by a login name.

Specified by:
getUserByLogin in interface UserDao
Parameters:
login - the login name
Returns:
the user, or null if not found

batchProcess

public magoffin.matt.dao.BatchableDao.BatchResult batchProcess(magoffin.matt.dao.BatchableDao.BatchCallback<User> callback,
                                                               magoffin.matt.dao.BatchableDao.BatchOptions options)
Specified by:
batchProcess in interface magoffin.matt.dao.BatchableDao<User>

getUserByKey

public User getUserByKey(java.lang.String key)
Description copied from interface: UserDao
Get a user by anonymous key.

Specified by:
getUserByKey in interface UserDao
Parameters:
key - the user key
Returns:
the user, or null if not found

deleteUnconfirmedRegistrations

public java.util.List<User> deleteUnconfirmedRegistrations(int minDaysOld)
Description copied from interface: UserDao
Delete registered users that are unconfirmed and created longer than the specified number of days ago.

Specified by:
deleteUnconfirmedRegistrations in interface UserDao
Parameters:
minDaysOld - the minimum number of days old from the current time the registration must be in order to delete
Returns:
the users that were deleted