org.activemath.webapp.user
Class UserStorage

java.lang.Object
  extended by org.activemath.webapp.user.UserStorage

public abstract class UserStorage
extends Object

UserStorage for persistence of user and related objects.


Constructor Summary
UserStorage()
           
 
Method Summary
abstract  void deleteAccount(String userId)
          Destroys the account of the user with the given userId.
abstract  boolean deleteGroup(String userGroupId)
          Destroys the persistent representation of UserGroup.
abstract  void deleteUser(String userId)
          Destroys the persistent representation of User.
abstract  AccountInfo fetchAccount(String userId)
          Fetch the AccountInfo for the given userId from persistence.
abstract  UserGroup fetchGroup(String groupId)
          Fetch a UserGroup object from the persistance store.
abstract  User fetchUser(String userId)
          Fetch a User object from the persistance store.
static UserStorage getInstance()
           
abstract  List<String> listAccounts()
          Returns a list of all registered userId's.
abstract  List<String> listAccountsForGroup(String groupId)
          Returns a list af registered userIds belonging to the supplied groupId.
abstract  List<String> listAccountsMatching(String filterText)
          Returns a list of all userIds matching the filterText (by name, email)
abstract  List<String> listAccountsWithRole(String role)
          Returns a list all userIds where the User has role role.
protected abstract  List<UserGroup> listGroups()
           
abstract  List<String> listGroupsForTutor(String userId)
           
abstract  List<String> listZombieAccounts()
          Returns a list of all userId's that have accounts but no user data
abstract  void store(AccountInfo account)
          Saves AccountInfo to a persistent representation (create/update).
abstract  void store(User user)
          Saves User to a persistent representation (create/update).
abstract  void store(UserGroup userGroup)
          Saves UserGroup to a persistent representation (create/update).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserStorage

public UserStorage()
Method Detail

getInstance

public static UserStorage getInstance()

fetchUser

public abstract User fetchUser(String userId)
Fetch a User object from the persistance store.

Returns:
initialized user object, or null.

store

public abstract void store(User user)
Saves User to a persistent representation (create/update).


deleteUser

public abstract void deleteUser(String userId)
Destroys the persistent representation of User.


fetchAccount

public abstract AccountInfo fetchAccount(String userId)
Fetch the AccountInfo for the given userId from persistence.

Returns:
AccountInfo from persistence, or null.

store

public abstract void store(AccountInfo account)
Saves AccountInfo to a persistent representation (create/update).


deleteAccount

public abstract void deleteAccount(String userId)
Destroys the account of the user with the given userId.


listAccounts

public abstract List<String> listAccounts()
Returns a list of all registered userId's.


listZombieAccounts

public abstract List<String> listZombieAccounts()
Returns a list of all userId's that have accounts but no user data


listAccountsWithRole

public abstract List<String> listAccountsWithRole(String role)
Returns a list all userIds where the User has role role.


listAccountsMatching

public abstract List<String> listAccountsMatching(String filterText)
Returns a list of all userIds matching the filterText (by name, email)


listAccountsForGroup

public abstract List<String> listAccountsForGroup(String groupId)
Returns a list af registered userIds belonging to the supplied groupId. This means that groupId must be in the list of their "potential groups" (AMATH-1679, AMATH-2045).


fetchGroup

public abstract UserGroup fetchGroup(String groupId)
Fetch a UserGroup object from the persistance store.

Parameters:
groupId -
Returns:
initialized UserGroup object, or null.

store

public abstract void store(UserGroup userGroup)
Saves UserGroup to a persistent representation (create/update).


deleteGroup

public abstract boolean deleteGroup(String userGroupId)
Destroys the persistent representation of UserGroup.


listGroups

protected abstract List<UserGroup> listGroups()
Returns:
List of all UserGroup objects available in the persistance store.

listGroupsForTutor

public abstract List<String> listGroupsForTutor(String userId)