View Javadoc

1   package net.ramapuram.thomas.dao;
2   
3   import net.ramapuram.thomas.model.User;
4   import org.springframework.security.core.userdetails.UserDetails;
5   import org.springframework.security.core.userdetails.UsernameNotFoundException;
6   import org.springframework.transaction.annotation.Propagation;
7   import org.springframework.transaction.annotation.Transactional;
8   
9   import java.util.List;
10  
11  /**
12   * User Data Access Object (GenericDao) interface.
13   *
14   * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
15   */
16  public interface UserDao extends GenericDao<User, Long> {
17  
18      /**
19       * Gets users information based on login name.
20       * @param username the user's username
21       * @return userDetails populated userDetails object
22       * @throws org.springframework.security.core.userdetails.UsernameNotFoundException thrown when user not
23       * found in database
24       */
25      @Transactional
26      UserDetails loadUserByUsername(String username) throws UsernameNotFoundException;
27  
28      /**
29       * Gets a list of users ordered by the uppercase version of their username.
30       *
31       * @return List populated list of users
32       */
33      List<User> getUsers();
34  
35      /**
36       * Saves a user's information.
37       * @param user the object to be saved
38       * @return the persisted User object
39       */
40      User saveUser(User user);
41  
42      /**
43       * Retrieves the password in DB for a user
44       * @param username the user's username
45       * @return the password in DB, if the user is already persisted
46       */
47      @Transactional(propagation = Propagation.NOT_SUPPORTED)
48      String getUserPassword(String username);
49      
50  }