net.ramapuram.thomas.service
Interface UserManager

All Superinterfaces:
GenericManager<User,java.lang.Long>
All Known Implementing Classes:
UserManagerImpl

public interface UserManager
extends GenericManager<User,java.lang.Long>

Business Service Interface to handle communication between web and persistence layer.

Author:
Matt Raible Modified by Dan Kibler

Method Summary
 User getUser(java.lang.String userId)
          Retrieves a user by userId.
 User getUserByUsername(java.lang.String username)
          Finds a user by their username.
 java.util.List<User> getUsers()
          Retrieves a list of all users.
 void removeUser(java.lang.String userId)
          Removes a user from the database by their userId
 User saveUser(User user)
          Saves a user's information.
 java.util.List<User> search(java.lang.String searchTerm)
          Search a user for search terms.
 void setUserDao(UserDao userDao)
          Convenience method for testing - allows you to mock the DAO and set it on an interface.
 
Methods inherited from interface net.ramapuram.thomas.service.GenericManager
exists, get, getAll, remove, save, search
 

Method Detail

setUserDao

void setUserDao(UserDao userDao)
Convenience method for testing - allows you to mock the DAO and set it on an interface.

Parameters:
userDao - the UserDao implementation to use

getUser

User getUser(java.lang.String userId)
Retrieves a user by userId. An exception is thrown if user not found

Parameters:
userId - the identifier for the user
Returns:
User

getUserByUsername

User getUserByUsername(java.lang.String username)
                       throws org.springframework.security.core.userdetails.UsernameNotFoundException
Finds a user by their username.

Parameters:
username - the user's username used to login
Returns:
User a populated user object
Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException - exception thrown when user not found

getUsers

java.util.List<User> getUsers()
Retrieves a list of all users.

Returns:
List

saveUser

User saveUser(User user)
              throws UserExistsException
Saves a user's information.

Parameters:
user - the user's information
Returns:
user the updated user object
Throws:
UserExistsException - thrown when user already exists

removeUser

void removeUser(java.lang.String userId)
Removes a user from the database by their userId

Parameters:
userId - the user's id

search

java.util.List<User> search(java.lang.String searchTerm)
Search a user for search terms.

Parameters:
searchTerm - the search terms.
Returns:
a list of matches, or all if no searchTerm.


Copyright © 2011. All Rights Reserved.