org.wamblee.usermgt.hibernate
Class HibernateUserSet

java.lang.Object
  extended by org.wamblee.usermgt.AbstractUserSet
      extended by org.wamblee.usermgt.hibernate.HibernateUserSet
All Implemented Interfaces:
UserSet

public class HibernateUserSet
extends AbstractUserSet

User set backed by the database.

Author:
Erik Brakkee

Constructor Summary
HibernateUserSet(Cache<java.lang.String,User> aCache, NameValidator aPasswordValidator, MessageDigester aPasswordEncoder)
          Constructs a user set backed by the database.
 
Method Summary
 boolean add(User aUser)
          Adds a user.
 boolean contains(User aUser)
          Checks if a user exists.
 User find(java.lang.String aName)
          Finds user.
 java.util.Set<User> list()
          Lists the current users.
 java.util.Set<User> list(Group aGroup)
          Lists the users belonging to a particular group.
 boolean remove(User aUser)
          Removes a user.
 void setSessionFactory(org.hibernate.SessionFactory aFactory)
          Sets the session factory.
 int size()
           
 void userModified(User aUser)
          Must be called whenever a user object has been modified to notify the user set.
 
Methods inherited from class org.wamblee.usermgt.AbstractUserSet
createUser, setPasswordInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateUserSet

public HibernateUserSet(Cache<java.lang.String,User> aCache,
                        NameValidator aPasswordValidator,
                        MessageDigester aPasswordEncoder)
Constructs a user set backed by the database.

Parameters:
aCache - User cache to use.
Method Detail

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory aFactory)
Sets the session factory.

Parameters:
aFactory - Session factory.

userModified

public void userModified(User aUser)
Description copied from interface: UserSet
Must be called whenever a user object has been modified to notify the user set.

Parameters:
aUser - Modified user.

find

public User find(java.lang.String aName)
Description copied from interface: UserSet
Finds user.

Parameters:
aName - Username.
Returns:
User or null if not found.

contains

public boolean contains(User aUser)
Description copied from interface: UserSet
Checks if a user exists.

Parameters:
aUser - User.
Returns:
True iff the user exists.

add

public boolean add(User aUser)
Description copied from interface: UserSet
Adds a user. If the user already exists, the user details are updated with that of the specified user object.

Parameters:
aUser - User to add.

remove

public boolean remove(User aUser)
Description copied from interface: UserSet
Removes a user. If the user does not exist, nothing happens.


list

public java.util.Set<User> list()
Description copied from interface: UserSet
Lists the current users.

Returns:
Users.

list

public java.util.Set<User> list(Group aGroup)
Description copied from interface: UserSet
Lists the users belonging to a particular group.

Parameters:
aGroup - Group.
Returns:
Groups.

size

public int size()
Returns:
The number of users.


Copyright © 2010. All Rights Reserved.