View Javadoc

1   package org.itracker.persistence.dao;
2   
3   import java.util.List;
4   import java.util.Map;
5   import java.util.Set;
6   
7   import org.itracker.model.PermissionType;
8   import org.itracker.model.User;
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       * 
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       * @param registrationType 
70       * @return list of users with the given registration type, in unspecified order
71       */
72      List<User> findByRegistrationType(int registrationType);
73      
74      /**
75       * Finds of the given user the set of permission types for all projects 
76       * on which the user has permissions. 
77       * 
78       * @param user 
79       * @param sourceRequest 
80       * @return set of permission types mapped by project id
81       */
82      Map<Integer, Set<PermissionType>> getUsersMapOfProjectsAndPermissionTypes(User user);
83  
84      List<User> findUsersForProjectByAllPermissionTypeList(Integer projectID, Integer[] permissionTypes);
85  
86  }