org.appfuse.service.impl
Class UserManagerImpl

java.lang.Object
  extended by org.appfuse.service.impl.GenericManagerImpl<org.appfuse.model.User,Long>
      extended by org.appfuse.service.impl.UserManagerImpl
All Implemented Interfaces:
GenericManager<org.appfuse.model.User,Long>, UserManager, UserService

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

Implementation of UserManager interface.

Author:
Matt Raible

Field Summary
 
Fields inherited from class org.appfuse.service.impl.GenericManagerImpl
dao, log
 
Constructor Summary
UserManagerImpl()
           
 
Method Summary
 org.appfuse.model.User getUser(String userId)
          Retrieves a user by userId.
 org.appfuse.model.User getUserByUsername(String username)
          Finds a user by their username.
 List<org.appfuse.model.User> getUsers()
          Retrieves a list of all users.
 void removeUser(String userId)
          Removes a user from the database by their userId
 void removeUser(org.appfuse.model.User user)
          Removes a user from the database
 org.appfuse.model.User saveUser(org.appfuse.model.User user)
          Saves a user's information.
 List<org.appfuse.model.User> search(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 org.appfuse.service.impl.GenericManagerImpl
exists, get, getAll, reindex, reindexAll, remove, 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 org.appfuse.service.GenericManager
exists, get, getAll, reindex, reindexAll, remove, remove, save, search
 

Constructor Detail

UserManagerImpl

public UserManagerImpl()
Method Detail

setPasswordEncoder

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

setUserDao

@Autowired
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 org.appfuse.model.User getUser(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 List<org.appfuse.model.User> getUsers()
Retrieves a list of all users.

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

saveUser

public org.appfuse.model.User saveUser(org.appfuse.model.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(org.appfuse.model.User user)
Removes a user from the database

Specified by:
removeUser in interface UserManager
Parameters:
user - the user to remove

removeUser

public void removeUser(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 org.appfuse.model.User getUserByUsername(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 List<org.appfuse.model.User> search(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 © 2003-2012. All Rights Reserved.