View Javadoc
1   package org.itracker.persistence.dao;
2   
3   import org.itracker.model.PermissionType;
4   import org.itracker.model.User;
5   
6   import java.util.List;
7   import java.util.Map;
8   import java.util.Set;
9   
10  /**
11   * User Data Access Object interface.
12   *
13   * @author ?
14   * @author Johnny Macchione
15   */
16  public interface UserDAO extends BaseDAO<User> {
17  
18      /**
19       * Finds the users with the given primary key.
20       * <p/>
21       * PENDING: should this method throw a NoSuchEntityException
22       * instead of returning null if the userId doesn't exist ?
23       *
24       * @param userId ID of the user to retrieve
25       * @return user with the given ID or <tt>null</tt> if none exits
26       */
27      User findByPrimaryKey(Integer userId);
28  
29      /**
30       * Finds a user by login.
31       *
32       * @param login login name of the user to find
33       * @return user with the given login or <tt>null</tt> if login is unknown
34       */
35      User findByLogin(String login);
36  
37      /**
38       * Finds all users.
39       *
40       * @return list of all users, in unspecified order
41       */
42      List<User> findAll();
43  
44      /**
45       * Finds all active users.
46       *
47       * @return list of users with a status &gt; 0, in unspecified order
48       */
49      List<User> findActive();
50  
51      /**
52       * Finds users with the given status.
53       *
54       * @param status status code
55       * @return list of users with the given status, in unspecified order
56       */
57      List<User> findByStatus(int status);
58  
59      /**
60       * Finds all super users.
61       *
62       * @return list of super users, in unspecified order
63       */
64      List<User> findSuperUsers();
65  
66      /**
67       * Finds users with the given registration type.
68       *
69       * @return list of users with the given registration type, in unspecified order
70       */
71      List<User> findByRegistrationType(int registrationType);
72  
73      /**
74       * Finds of the given user the set of permission types for all projects
75       * on which the user has permissions.
76       *
77       * @return set of permission types mapped by project id
78       */
79      Map<Integer, Set<PermissionType>> getUsersMapOfProjectsAndPermissionTypes(User user);
80  
81      /**
82       * Finds all users assigned to a project having all of the given permissionTypes.
83       *
84       * @param projectID the project ID
85       * @param permissionTypes array of permission types
86       * @return users having the required permissions
87       */
88  
89      List<User> findUsersForProjectByAllPermissionTypeList(Integer projectID, PermissionType[] permissionTypes);
90  
91      @Deprecated
92      List<User> findUsersForProjectByAllPermissionTypeList(Integer projectID, Integer[] permissionTypes);
93  
94  }