nl.gx.webmanager.services.usermanager
Interface UserManager


public interface UserManager

This type contains methods to manage a User instances.

Note that the methods of a UserManager instance that require a User parameter are allowed to assume that such a {User} instance has been obtained through the methods of the same UserManager instance. If this is not the case, then an implementation may throw an unchecked exception to indicate a programming error.


Method Summary
 void addNewsletter(User user, MailingList mailingList, java.lang.String displayOption)
          Add a newsletter to the specified user.
 User create()
          Create a User instance.
 void delete(User user)
          Removes the given User.
 User get(java.lang.String idString)
          Gets a user instance from the given identifier string.
 java.util.List<Group> getGroups(User user)
          Retrieves all groups for a given user.
 java.util.List<NewsletterSubscription> getNewsletters(User user)
          Gets the newsletters of the specified user.
 java.util.List<User> getUsers()
           
 void removeNewsletter(User user, NewsletterSubscription newsletterSubscription)
          Delete a newsletter of the specified user.
 void updateNewsletter(User user, NewsletterSubscription newsletterSubscription)
          Update a newsletter of the specified user.
 

Method Detail

create

User create()
            throws UserManagementException
Create a User instance.

Returns:
a new User instance
Throws:
UserManagementException - when operation fails

delete

void delete(User user)
            throws UserManagementException
Removes the given User.

Parameters:
user - to be deleted.
Throws:
UserManagementException - when operation fails

getUsers

java.util.List<User> getUsers()
                              throws UserManagementException
Returns:
all users of the Realm of this manager
Throws:
UserManagementException - on error

getGroups

java.util.List<Group> getGroups(User user)
                                throws UserManagementException
Retrieves all groups for a given user.

Parameters:
user - the User to get the groups for
Returns:
a list of Group instances in the given user
Throws:
UserManagementException - on error

addNewsletter

void addNewsletter(User user,
                   MailingList mailingList,
                   java.lang.String displayOption)
                   throws UserManagementException
Add a newsletter to the specified user.

Parameters:
user -
mailingList -
displayOption -
Throws:
UserManagementException

updateNewsletter

void updateNewsletter(User user,
                      NewsletterSubscription newsletterSubscription)
                      throws UserManagementException
Update a newsletter of the specified user.

Parameters:
user -
newsletterSubscription -
Throws:
UserManagementException

removeNewsletter

void removeNewsletter(User user,
                      NewsletterSubscription newsletterSubscription)
                      throws UserManagementException
Delete a newsletter of the specified user.

Parameters:
user -
newsletterSubscription -
Throws:
UserManagementException

getNewsletters

java.util.List<NewsletterSubscription> getNewsletters(User user)
                                                      throws UserManagementException
Gets the newsletters of the specified user.

Parameters:
user -
Returns:
newsletters of the specified user
Throws:
UserManagementException

get

User get(java.lang.String idString)
         throws UserManagementException
Gets a user instance from the given identifier string. This string is to be obtained by calling User#getId()#toString() on a User instance which has been created by a UserManager instance. This implementation checks that the user still exists in the persistence store.

Parameters:
idString - the id string to use to create a User instance
Returns:
a User instance which can be used with the methods of this manager
Throws:
UserManagementException - on error (e.g., the user has been deleted or belongs to another realm)


Copyright © 2007-2011 GX Software BV. All Rights Reserved.