01: package org.contineo.core.security.dao;
02:
03: import java.util.Collection;
04:
05: import org.contineo.core.security.User;
06:
07: /**
08: * This class is a DAO-service for User-objects.
09: *
10: * @author Michael Scholz
11: * @author Marco Meschieri
12: * @version 1.0
13: */
14: public interface UserDAO {
15:
16: /**
17: * This method persists the user object.
18: *
19: * @param user User, which should be stored in a database.
20: * @return True if successful stored in a database.
21: */
22: public boolean store(User user);
23:
24: /**
25: * This method deletes a given user.
26: *
27: * @param username Username of the user to be deleted.
28: * @return True if successful deleted in a database.
29: */
30: public boolean delete(String username);
31:
32: /**
33: * This method finds an User by its primarykey.
34: *
35: * @param username Primarykey of wanted User.
36: * @return Wanted User or null if user doesn't exist.
37: */
38: public User findByPrimaryKey(String username);
39:
40: /**
41: * This method finds an User by username.
42: *
43: * @param username The username of wanted User.
44: * @return Collection of selected users.
45: */
46: public Collection<User> findByUserName(String username);
47:
48: /**
49: * This method finds an User by name.
50: *
51: * @param name The name of wanted User.
52: * @return Collection of selected users.
53: */
54: public Collection<User> findByName(String name);
55:
56: /**
57: * This method finds an User by username and name.
58: *
59: * @param username The username of wanted user.
60: * @param name The name of wanted user.
61: * @return Collection of selected users.
62: */
63: public Collection<User> findByUserNameAndName(String username,
64: String name);
65:
66: /**
67: * This method finds all user.
68: *
69: * @return All users.
70: */
71: public Collection<User> findAll();
72:
73: /**
74: * Validates an username and a password.
75: *
76: * @param username Username of the User to be validate.
77: * @param password Password of the User to be validate.
78: * @return True if User is authenticated.
79: */
80: public boolean validateUser(String username, String password);
81:
82: /**
83: * This method checks the exist of an user.
84: *
85: * @param username Username of the user.
86: */
87: public boolean existsUser(String username);
88: }
|