1 /*
2 * Created on Jun 20, 2006
3 *
4 */
5 package org.musicontroller.security;
6
7 import java.util.List;
8
9 /**
10 * Specifies the methods a Dao must implement to be used for
11 * loading and storing User-objects.
12 * The UserDetailsDao class will use tht implementation of this Dao
13 * to load User-objects from a database, or whatever method is used to persist
14 * Users.
15 * @author Arjan Verstoep
16 * @version $Id: UserDao.java,v 1.1 2010/03/16 18:55:42 varienaja Exp $
17 * @see DaoUserDetailsService
18 */
19 public interface UserDao {
20
21 /**
22 * Get a User by specifying its loginname
23 * @param loginname The loginname.
24 * @return The User that has this loginname, or null if there is no such User.
25 */
26 public IUser getUserByLoginname(String loginname);
27
28 /**
29 * Get a User by specifying its id.
30 * @param id The id.
31 * @return The User that has this id, or null of there is no such User.
32 */
33 public IUser getUserById(long id);
34
35 /**
36 * Get a Particpant by specifying its loginname ans encrypted password
37 * @param loginname The loginname
38 * @param password The encrypted password
39 * @return The User that has this loginname and password, or null if there is no such User.
40 */
41 public IUser findUserByNamePassword(String loginname, String password);
42
43 /**
44 * List all Users.
45 * @return All User-objects that exist, ordered by loginname.
46 */
47 public List<IUser> listUsers();
48
49 /**
50 * List Users by specifying a certain loginname
51 * @param loginname The loginname.
52 * @return A List of all Users that have this loginname (can be 0 or 1).
53 */
54 public List<IUser> findUserByLoginname(String loginname);
55
56 /**
57 * Persists a User-object.
58 * @param user The User to persist.
59 */
60 public void save(IUser user);
61
62 /**
63 * Deletes a User-object.
64 * @param user The User to purge from persistent storage.
65 */
66 public void delete(IUser user);
67
68 /**
69 * @return A list of all roles.
70 */
71 public List<Role> listRoles();
72
73 }