org.riotfamily.riot.security.session
Class RiotUserDaoWrapper

java.lang.Object
  extended by org.riotfamily.riot.security.session.RiotUserDaoWrapper
All Implemented Interfaces:
RiotDao, RiotUserDao

public class RiotUserDaoWrapper
extends Object
implements RiotUserDao

Wrapper that invokes UserHolder.updateUser(String, RiotUser) whenever a user is updated or deleted.

Since:
6.5
Author:
Felix Gnass [fgnass at neteye dot de]

Constructor Summary
RiotUserDaoWrapper(RiotUserDao userDao)
           
 
Method Summary
 void delete(Object entity, Object parent)
          Deletes the given entity.
 RiotUser findUserByCredentials(String username, String password)
           
 RiotUser findUserById(String userId)
           
 Class<?> getEntityClass()
          Returns the class that is accessed by the DAO.
 int getListSize(Object parent, ListParams params)
          Returns the total number of entities.
 String getObjectId(Object entity)
          Returns the id of the given entity.
 Collection<?> list(Object parent, ListParams params)
          Returns a list of entities.
 Object load(String id)
          Returns the entity with the given id.
 Object merge(Object entity)
          Re-attaches the given entity.
 void save(Object entity, Object parent)
          Saves the given entity.
 void update(Object entity)
          Updates the given entity.
 void updatePassword(RiotUser user, String newPassword)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RiotUserDaoWrapper

public RiotUserDaoWrapper(RiotUserDao userDao)
Method Detail

findUserByCredentials

public RiotUser findUserByCredentials(String username,
                                      String password)
Specified by:
findUserByCredentials in interface RiotUserDao

findUserById

public RiotUser findUserById(String userId)
Specified by:
findUserById in interface RiotUserDao

updatePassword

public void updatePassword(RiotUser user,
                           String newPassword)
Specified by:
updatePassword in interface RiotUserDao

getEntityClass

public Class<?> getEntityClass()
Description copied from interface: RiotDao
Returns the class that is accessed by the DAO.

Specified by:
getEntityClass in interface RiotDao

getListSize

public int getListSize(Object parent,
                       ListParams params)
                throws DataAccessException
Description copied from interface: RiotDao
Returns the total number of entities.

Specified by:
getListSize in interface RiotDao
Throws:
DataAccessException

list

public Collection<?> list(Object parent,
                          ListParams params)
                   throws DataAccessException
Description copied from interface: RiotDao
Returns a list of entities.

Specified by:
list in interface RiotDao
Throws:
DataAccessException

getObjectId

public String getObjectId(Object entity)
Description copied from interface: RiotDao
Returns the id of the given entity. Implementors will most likely need to perform a type conversion in order to return a String representation. The returned String must be parseable by the load() method.

Specified by:
getObjectId in interface RiotDao

load

public Object load(String id)
            throws DataAccessException
Description copied from interface: RiotDao
Returns the entity with the given id.

Specified by:
load in interface RiotDao
Throws:
DataAccessException

save

public void save(Object entity,
                 Object parent)
          throws DataAccessException
Description copied from interface: RiotDao
Saves the given entity.

Specified by:
save in interface RiotDao
Throws:
DataAccessException

merge

public Object merge(Object entity)
Description copied from interface: RiotDao
Re-attaches the given entity. This method is invoked before an object that has been loaded in a previous request is modified. Implementors can use this method to perform modification checks or to re-attach the object to a persistence context.

Specified by:
merge in interface RiotDao

update

public void update(Object entity)
Description copied from interface: RiotDao
Updates the given entity. This method is invoked after an object has been modified. Session-based implementations (like Hibernate or JPA) will usually do nothing in this method, as changes are automatically written to the database when an object has been modified within a transaction.

Specified by:
update in interface RiotDao

delete

public void delete(Object entity,
                   Object parent)
Description copied from interface: RiotDao
Deletes the given entity.

Specified by:
delete in interface RiotDao