net.ramapuram.thomas.service.impl
Class UserManagerImpl

java.lang.Object
  extended by net.ramapuram.thomas.service.impl.GenericManagerImpl<User,java.lang.Long>
      extended by net.ramapuram.thomas.service.impl.UserManagerImpl
All Implemented Interfaces:
GenericManager<User,java.lang.Long>, UserManager, UserService

@Service(value="userManager")
public class UserManagerImpl
extends GenericManagerImpl<User,java.lang.Long>
implements UserManager, UserService

Implementation of UserManager interface.

Author:
Matt Raible

Field Summary
 
Fields inherited from class net.ramapuram.thomas.service.impl.GenericManagerImpl
dao, log
 
Constructor Summary
UserManagerImpl()
           
 
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 setPasswordEncoder(org.springframework.security.authentication.encoding.PasswordEncoder passwordEncoder)
           
 void setUserDao(UserDao userDao)
          Convenience method for testing - allows you to mock the DAO and set it on an interface.
 
Methods inherited from class net.ramapuram.thomas.service.impl.GenericManagerImpl
exists, get, getAll, remove, save, search
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.ramapuram.thomas.service.GenericManager
exists, get, getAll, remove, save, search
 

Constructor Detail

UserManagerImpl

public UserManagerImpl()
Method Detail

setPasswordEncoder

public void setPasswordEncoder(org.springframework.security.authentication.encoding.PasswordEncoder passwordEncoder)

setUserDao

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

Specified by:
setUserDao in interface UserManager
Parameters:
userDao - the UserDao implementation to use

getUser

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

Specified by:
getUser in interface UserManager
Specified by:
getUser in interface UserService
Parameters:
userId - the identifier for the user
Returns:
User

getUsers

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

Specified by:
getUsers in interface UserManager
Specified by:
getUsers in interface UserService
Returns:
List

saveUser

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

Specified by:
saveUser in interface UserManager
Specified by:
saveUser in interface UserService
Parameters:
user - the user's information
Returns:
user the updated user object
Throws:
UserExistsException - thrown when user already exists

removeUser

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

Specified by:
removeUser in interface UserManager
Specified by:
removeUser in interface UserService
Parameters:
userId - the user's id

getUserByUsername

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

Specified by:
getUserByUsername in interface UserManager
Specified by:
getUserByUsername in interface UserService
Parameters:
username - the login name of the human
Returns:
User the populated user object
Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException - thrown when username not found

search

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

Specified by:
search in interface UserManager
Parameters:
searchTerm - the search terms.
Returns:
a list of matches, or all if no searchTerm.


Copyright © 2011. All Rights Reserved.