Interface UserManager
-
public interface UserManager
This type contains methods to manage aUser
instances. Note that the methods of aUserManager
instance that require aUser
parameter are allowed to assume that such a {User} instance has been obtained through the methods of the sameUserManager
instance. If this is not the case, then an implementation may throw an unchecked exception to indicate a programming error.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addNewsletter(User user, MailingList mailingList, String displayOption)
Add a newsletter to the specified user.User
create()
Create aUser
instance.void
delete(User user)
Removes the givenUser
.User
get(String idString)
Gets a user instance from the given identifier string.List<Group>
getGroups(User user)
Retrieves all groups for a given user.List<NewsletterSubscription>
getNewsletters(User user)
Gets the newsletters of the specified user.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 aUser
instance.- Returns:
- a new
User
instance - Throws:
UserManagementException
- when operation fails
-
delete
void delete(User user) throws UserManagementException
Removes the givenUser
.- Parameters:
user
- to be deleted.- Throws:
UserManagementException
- when operation fails
-
getUsers
List<User> getUsers() throws UserManagementException
- Returns:
- all users of the
Realm
of this manager - Throws:
UserManagementException
- on error
-
getGroups
List<Group> getGroups(User user) throws UserManagementException
Retrieves all groups for a given user.- Parameters:
user
- theUser
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, 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
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(String idString) throws UserManagementException
Gets a user instance from the given identifier string. This string is to be obtained by calling {@link User#getId()#toString()} on aUser
instance which has been created by aUserManager
instance. This implementation checks that the user still exists in the persistence store.- Parameters:
idString
- the id string to use to create aUser
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)
-
-