net.sf.sail.webapp.service
Interface UserService

All Known Implementing Classes:
UserServiceImpl, UserServiceImpl

public interface UserService

Represents the set of operations on a user.

Version:
$Id$
Author:
Cynick Young, Laurel Williams

Method Summary
 User addSdsUserToUser(Long id)
          Creates and adds a SdsUser to existing User
 SdsUser createSdsUser(MutableUserDetails userDetails)
          Instantiates a SdsUser object and populates its firstname and lastname using the provided MutableUserDetails and returns it
 User createUser(MutableUserDetails userDetails)
          Given a MutableUserDetails object with a unique name, creates a remote SDS user and also inserts the object into the local db.
 List<String> retrieveAllUsernames()
          Returns all usernames from persistent data store.
 List<User> retrieveAllUsers()
          Gets all users from persistent data store.
 List<User> retrieveByField(String field, String type, Object term, String classVar)
          Retrieves Users by a given field (eg username, gender), search type (eg =, like) search term (user provided) and classVar (eg teacher or studentUserDetails)
 List<User> retrieveByFields(String[] fields, String[] values, String classVar)
          Given an array of fields and an array of values and classVar, retrieves a list of Users
 User retrieveById(Long userId)
          Retrieves User domain object using unique userId
 User retrieveByResetPasswordKey(String resetPasswordKey)
          Get the User object given the reset password key
 User retrieveUser(org.springframework.security.userdetails.UserDetails userDetails)
          Retrieve user with the given user details.
 List<User> retrieveUserByEmailAddress(String emailAddress)
          Retrieve users with the given emailAddress
 User retrieveUserByUsername(String username)
          Retrieve user with the give username
 List<User> retrieveUsersByUsername(String username)
          Retrieve users with a similar username as the one provided Does a LIKE comparison
 void updateUser(User user)
          Updates the existing MutableUserDetails object
 User updateUserPassword(User user, String newPassword)
          Encodes a new password and updates a user in the persistent data store.
 

Method Detail

createUser

User createUser(MutableUserDetails userDetails)
                throws DuplicateUsernameException,
                       HttpStatusCodeException
Given a MutableUserDetails object with a unique name, creates a remote SDS user and also inserts the object into the local db. If username is not unique throws a DuplicateUsernameException.

Parameters:
userDetails - A user object.
Returns:
A reference to a User object
Throws:
DuplicateUsernameException - If username is not unique.
HttpStatusCodeException - If any unexpected status code is returned from the SDS while creating the user.

retrieveUser

User retrieveUser(org.springframework.security.userdetails.UserDetails userDetails)
Retrieve user with the given user details.

Parameters:
userDetails - that has valid authentication credentials
Returns:
User associated with the given user details

retrieveUserByUsername

User retrieveUserByUsername(String username)
Retrieve user with the give username

Parameters:
username -
Returns:
User associated with the given username

retrieveUsersByUsername

List<User> retrieveUsersByUsername(String username)
Retrieve users with a similar username as the one provided Does a LIKE comparison

Parameters:
username -
Returns:
User associated with the given username

retrieveUserByEmailAddress

List<User> retrieveUserByEmailAddress(String emailAddress)
Retrieve users with the given emailAddress

Parameters:
emailAddress -
Returns:
Users associated with the given emailaddress

updateUserPassword

User updateUserPassword(User user,
                        String newPassword)
Encodes a new password and updates a user in the persistent data store.

Parameters:
user - The user that you want to update
newPassword - The UN-ENCODED new password that you want to put in place for this user
Returns:
The user with the newly encoded password.

retrieveAllUsers

List<User> retrieveAllUsers()
Gets all users from persistent data store. Note: this is server-intensive. Consider using retrieveAllUsernames() instead

Returns:
a Set of all users.

retrieveAllUsernames

List<String> retrieveAllUsernames()
Returns all usernames from persistent data store.

Returns:

retrieveById

User retrieveById(Long userId)
                  throws ObjectNotFoundException
Retrieves User domain object using unique userId

Parameters:
userId - Long userId to use for lookup
Returns:
User the User object with the given userId
Throws:
ObjectNotFoundException - when userId cannot be used to find the existing user

createSdsUser

SdsUser createSdsUser(MutableUserDetails userDetails)
Instantiates a SdsUser object and populates its firstname and lastname using the provided MutableUserDetails and returns it

Parameters:
userDetails - used to retrieve firstnamd and lastname
Returns:
new SdsUser object with firstname and lastname set

updateUser

void updateUser(User user)
Updates the existing MutableUserDetails object

Parameters:
userDetails -

addSdsUserToUser

User addSdsUserToUser(Long id)
Creates and adds a SdsUser to existing User

Parameters:
User - user

retrieveByField

List<User> retrieveByField(String field,
                           String type,
                           Object term,
                           String classVar)
Retrieves Users by a given field (eg username, gender), search type (eg =, like) search term (user provided) and classVar (eg teacher or studentUserDetails)


retrieveByFields

List<User> retrieveByFields(String[] fields,
                            String[] values,
                            String classVar)
Given an array of fields and an array of values and classVar, retrieves a list of Users

Parameters:
fields - an array of field names
values - an array of values, the index of a value must line up with the index in the field array e.g. fields[0] = "firstname" fields[1] = "lastname" values[0] = "Spongebob" values[1] = "Squarepants"
classVar - 'studentUserDetails' or 'teacherUserDetails'
Returns:
a list of Users that have matching values for the given fields

retrieveByResetPasswordKey

User retrieveByResetPasswordKey(String resetPasswordKey)
Get the User object given the reset password key

Parameters:
resetPasswordKey - an alphanumeric string
Returns:
a User object or null if there is no user with the given reset password key


Copyright © 2012. All Rights Reserved.