View Javadoc
1   /*
2    * Copyright (c) 2002-2022, City of Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.portal.business.workgroup;
35  
36  import fr.paris.lutece.portal.business.user.AdminUser;
37  import fr.paris.lutece.util.ReferenceList;
38  
39  import java.util.Collection;
40  
41  /**
42   * Interface for AdminWorkgroup DAO
43   */
44  public interface IAdminWorkgroupDAO
45  {
46      /**
47       * Check that the given key points to an existing workgroup
48       *
49       * @param strWorkgroupKey
50       *            The workgroup key
51       * @return true if the workgroup exists, false otherwise
52       */
53      boolean checkExistWorkgroup( String strWorkgroupKey );
54  
55      /**
56       * Delete a record from the table
57       *
58       *
59       * @param strWorkgroupKey
60       *            The workgroup key
61       */
62      void delete( String strWorkgroupKey );
63  
64      /**
65       * Insert a new record in the table.
66       *
67       * @param workgroup
68       *            The workgroup object
69       */
70      void insert( AdminWorkgroup workgroup );
71  
72      /**
73       * Load the data of AdminWorkgroup from the table
74       *
75       * @param strWorkgroupKey
76       *            The workgroup key
77       * @return the instance of the AdminWorkgroup
78       */
79      AdminWorkgroup load( String strWorkgroupKey );
80  
81      /**
82       * Load the list of workgroups
83       *
84       * @return The Collection of the Workgroups
85       */
86      Collection<AdminWorkgroup> selectWorkgroupList( );
87  
88      /**
89       * Update the record identified by the given workgroup key with the given workgroup in the table
90       * 
91       * @param workgroup
92       *            The reference of workgroup to be the new one
93       */
94      void store( AdminWorkgroup workgroup );
95  
96      /**
97       * Is the user member of the workgroup
98       *
99       * @param nIdUser
100      *            The user Id
101      * @param strWorkgroup
102      *            The workgroup key
103      * @return True if the user is in the workgroup, otherwise false
104      */
105     boolean isUserInWorkgroup( int nIdUser, String strWorkgroup );
106 
107     /**
108      * Is the user member of the workgroup
109      *
110      * @param nIdUser
111      *            The user Id
112      * @return True if the user has workgroup
113      */
114     boolean checkUserHasWorkgroup( int nIdUser );
115 
116     /**
117      * Returns the list of all workgroups the user is member
118      *
119      * @param nIdUser
120      *            The user Id
121      * @return The list of all user's workgroups
122      */
123     ReferenceList getUserWorkgroups( int nIdUser );
124 
125     /**
126      * Returns the list of all users for a workgroup
127      *
128      * @param strWorkgroupKey
129      *            The workgroup key
130      * @return The collection of all users of a workgroup
131      */
132     Collection<AdminUser> getUsersListForWorkgroup( String strWorkgroupKey );
133 
134     /**
135      * Remove all users of a workgroup
136      *
137      * @param strWorkgroupKey
138      *            The workgroup key
139      */
140     void deleteAllUsersForWorkgroup( String strWorkgroupKey );
141 
142     /**
143      * Insert a user into a workgroup
144      *
145      * @param user
146      *            The user to insert
147      * @param strWorkgroupKey
148      *            the key workgroup
149      */
150     void insertUserForWorkgroup( AdminUser user, String strWorkgroupKey );
151 
152     /**
153      * Remove an user from a workgroup
154      * 
155      * @param userId
156      *            The user ID
157      * @param strWorkgroupKey
158      *            The workgroup key
159      */
160     void deleteUserFromWorkgroup( int userId, String strWorkgroupKey );
161 
162     /**
163      * Find workgroups from a filter
164      * 
165      * @param awFilter
166      *            the filter
167      * @return the list of workgroups
168      */
169     Collection<AdminWorkgroup> selectWorkgroupsByFilter( AdminWorkgroupFilter awFilter );
170 }