br.com.arsmachina.authentication.dao.hibernate
Class UserDAOImpl

java.lang.Object
  extended by br.com.arsmachina.dao.hibernate.GenericDAOImpl<br.com.arsmachina.authentication.entity.User,Integer>
      extended by br.com.arsmachina.authentication.dao.hibernate.UserDAOImpl
All Implemented Interfaces:
br.com.arsmachina.authentication.dao.UserDAO, br.com.arsmachina.dao.DAO<br.com.arsmachina.authentication.entity.User,Integer>, br.com.arsmachina.dao.ReadableDAO<br.com.arsmachina.authentication.entity.User,Integer>, br.com.arsmachina.dao.WriteableDAO<br.com.arsmachina.authentication.entity.User,Integer>

public class UserDAOImpl
extends br.com.arsmachina.dao.hibernate.GenericDAOImpl<br.com.arsmachina.authentication.entity.User,Integer>
implements br.com.arsmachina.authentication.dao.UserDAO

UserDAO implementation using Hibernate

Author:
Thiago H. de Paula Figueiredo

Constructor Summary
UserDAOImpl(org.hibernate.SessionFactory sessionFactory, br.com.arsmachina.authentication.controller.PasswordEncrypter passwordEncrypter)
          Single constructor of this class.
 
Method Summary
 br.com.arsmachina.authentication.entity.User findByLogin(String login)
          Finds an user by its login.
 br.com.arsmachina.authentication.entity.User findByLoginAndPassword(String login, String password)
          Finds the user with a given login and password.
<T extends br.com.arsmachina.authentication.entity.Role>
List<br.com.arsmachina.authentication.entity.User>
findByRole(Class<T> roleClass)
           
 br.com.arsmachina.dao.SortCriterion[] getDefaultSortCriteria()
          Returns Constants.ASCENDING_NAME_SORT_CRITERIA.
 boolean hasUserWithLogin(String login)
           
 
Methods inherited from class br.com.arsmachina.dao.hibernate.GenericDAOImpl
addSortCriteria, addSortCriteria, countAll, createCriteria, createCriteria, createCriteria, createExample, delete, delete, evict, findAll, findAll, findByExample, findById, findByIds, getClassMetadata, getEntityClass, getPrimaryKeyPropertyName, getSession, getSessionFactory, isPersistent, reattach, refresh, save, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface br.com.arsmachina.dao.ReadableDAO
countAll, findAll, findAll, findByExample, findById, findByIds, reattach, refresh
 
Methods inherited from interface br.com.arsmachina.dao.WriteableDAO
delete, delete, evict, isPersistent, save, update
 

Constructor Detail

UserDAOImpl

public UserDAOImpl(org.hibernate.SessionFactory sessionFactory,
                   br.com.arsmachina.authentication.controller.PasswordEncrypter passwordEncrypter)
Single constructor of this class.

Parameters:
sessionFactory - a SessionFactory. It cannot be null.
passwordEncrypter - a PasswordEncrypter. It cannot be null.
Method Detail

findByLoginAndPassword

public br.com.arsmachina.authentication.entity.User findByLoginAndPassword(String login,
                                                                           String password)
Finds the user with a given login and password. The login search is case-insensitive.

Specified by:
findByLoginAndPassword in interface br.com.arsmachina.authentication.dao.UserDAO
See Also:
UserDAO.findByLoginAndPassword(java.lang.String, java.lang.String)

findByLogin

public br.com.arsmachina.authentication.entity.User findByLogin(String login)
Finds an user by its login. The search is case-insensitive.

Specified by:
findByLogin in interface br.com.arsmachina.authentication.dao.UserDAO
See Also:
UserDAO.findByLogin(java.lang.String)

findByRole

public <T extends br.com.arsmachina.authentication.entity.Role> List<br.com.arsmachina.authentication.entity.User> findByRole(Class<T> roleClass)
Specified by:
findByRole in interface br.com.arsmachina.authentication.dao.UserDAO

getDefaultSortCriteria

public br.com.arsmachina.dao.SortCriterion[] getDefaultSortCriteria()
Returns Constants.ASCENDING_NAME_SORT_CRITERIA.

Specified by:
getDefaultSortCriteria in interface br.com.arsmachina.dao.ReadableDAO<br.com.arsmachina.authentication.entity.User,Integer>
Overrides:
getDefaultSortCriteria in class br.com.arsmachina.dao.hibernate.GenericDAOImpl<br.com.arsmachina.authentication.entity.User,Integer>
See Also:
GenericDAOImpl.getDefaultSortCriteria()

hasUserWithLogin

public boolean hasUserWithLogin(String login)
Specified by:
hasUserWithLogin in interface br.com.arsmachina.authentication.dao.UserDAO


Copyright © 2008-2009 Thiago H. de Paula Figueiredo. All Rights Reserved.