Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
GroupService |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2006-2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | package org.kuali.rice.kim.api.group; | |
18 | ||
19 | import org.kuali.rice.core.api.criteria.QueryByCriteria; | |
20 | import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; | |
21 | import org.kuali.rice.core.api.mo.common.Attributes; | |
22 | import org.kuali.rice.core.util.jaxb.MapStringStringAdapter; | |
23 | import org.kuali.rice.kim.util.KimConstants; | |
24 | ||
25 | import javax.jws.WebMethod; | |
26 | import javax.jws.WebParam; | |
27 | import javax.jws.WebResult; | |
28 | import javax.jws.WebService; | |
29 | import javax.jws.soap.SOAPBinding; | |
30 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | |
31 | import java.util.Collection; | |
32 | import java.util.List; | |
33 | import java.util.Map; | |
34 | ||
35 | @WebService(name = "GroupService", targetNamespace = KimConstants.Namespaces.KIM_NAMESPACE_2_0) | |
36 | @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) | |
37 | public interface GroupService { | |
38 | ||
39 | /** | |
40 | * Get all the groups for a given principal. | |
41 | * | |
42 | * <p> | |
43 | * This will include all groups directly assigned as well as those inferred | |
44 | * by the fact that they are members of higher level groups. | |
45 | * </p> | |
46 | * | |
47 | * @param principalId The id of the Principal | |
48 | * @return a list of Group objects in which the given Principal is a member of. An empty list is returned if an invalid or | |
49 | * non-existant principalId is supplied. | |
50 | */ | |
51 | @WebMethod(operationName = "getGroupsForPrincipal") | |
52 | @WebResult(name = "groupsForPrincipal") | |
53 | List<Group> getGroupsForPrincipal(@WebParam(name="principalId") String principalId) throws RiceIllegalArgumentException; | |
54 | ||
55 | ||
56 | /** | |
57 | * Get all the groups within a namespace for a given principal. | |
58 | * | |
59 | * <p> | |
60 | * This will include all groups directly assigned as well as those inferred | |
61 | * by the fact that they are members of higher level groups, and filtered by Group namespace. | |
62 | * </p> | |
63 | * | |
64 | * @param principalId The id of the Principal | |
65 | * @param namespaceCode The namespace code of the desired Groups to return | |
66 | * @return a list of Group objects in which the given Principal is a member of, filtered by Group namespace. An empty list is returned if an invalid or | |
67 | * non-existant principalId is supplied. | |
68 | */ | |
69 | @WebMethod(operationName = "getGroupsForPrincipalByNamespace") | |
70 | @WebResult(name = "groupsForPrincipal") | |
71 | List<Group> getGroupsForPrincipalByNamespace(@WebParam(name="principalId") String principalId, @WebParam(name="namespaceCode") String namespaceCode) throws RiceIllegalArgumentException; | |
72 | ||
73 | /** | |
74 | * Query for groups based on the given search criteria which is a Map of group field names to values. | |
75 | * | |
76 | * <p> | |
77 | * This method returns it's results as a List of group ids that match the given search criteria. | |
78 | * </p> | |
79 | * | |
80 | * @param queryByCriteria the criteria. Cannot be null. | |
81 | * @return a list of groupId Strings in which the given criteria match Group properties. An empty list is returned if an invalid or | |
82 | * non-existent criteria is supplied. | |
83 | */ | |
84 | @WebMethod(operationName = "findGroupIds") | |
85 | @WebResult(name = "findGroupIds") | |
86 | List<String> findGroupIds(@WebParam(name = "query") QueryByCriteria queryByCriteria); | |
87 | ||
88 | /** | |
89 | * Query for groups based on the given search criteria which is a Map of group field names to values. | |
90 | * | |
91 | * <p>This method returns it's results as a List of Group objects that match the given search criteria. | |
92 | */ | |
93 | ||
94 | /** | |
95 | * Query for groups based on the given search criteria which is a Map of group field names to values. | |
96 | * | |
97 | * <p> | |
98 | * This method returns it's results as a List of Groups that match the given search criteria. | |
99 | * </p> | |
100 | * | |
101 | * @param queryByCriteria the criteria. Cannot be null. | |
102 | * @return a list of Group objects in which the given criteria match Group properties. An empty list is returned if an invalid or | |
103 | * non-existent criteria is supplied. | |
104 | */ | |
105 | @WebMethod(operationName = "findGroups") | |
106 | @WebResult(name = "findGroup") | |
107 | GroupQueryResults findGroups(@WebParam(name = "query") QueryByCriteria queryByCriteria); | |
108 | ||
109 | /** | |
110 | * Query for group members based on the given search criteria which is a Map of group member field names to values. | |
111 | * | |
112 | * <p> | |
113 | * This method returns it's results as a List of GroupMemberss that match the given search criteria. | |
114 | * </p> | |
115 | * | |
116 | * @param queryByCriteria the criteria. Cannot be null. | |
117 | * @return a list of GroupMember objects in which the given criteria match Group properties. An empty list is returned if an invalid or | |
118 | * non-existent criteria is supplied. | |
119 | */ | |
120 | @WebMethod(operationName = "findGroupMembers") | |
121 | @WebResult(name = "findGroupMember") | |
122 | GroupMemberQueryResults findGroupMembers(@WebParam(name = "query") QueryByCriteria queryByCriteria); | |
123 | /** | |
124 | * Lookup a Group based on the passed in id. | |
125 | * | |
126 | * | |
127 | * @param groupId String that matches the desired Groups id | |
128 | * @return a Group with the given id value. A null reference is returned if an invalid or | |
129 | * non-existant id is supplied. | |
130 | */ | |
131 | @WebMethod(operationName = "getGroup") | |
132 | @WebResult(name = "group") | |
133 | Group getGroup(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
134 | ||
135 | /** | |
136 | * Lookup a Group based on the passed in namespace and name. | |
137 | * | |
138 | * | |
139 | * @param namespaceCode String that matches the desired Group's namespaceCode | |
140 | * @param groupName String that matches the desired Group's name | |
141 | * @return a Group with the given namespace and name values. A null reference is returned if an invalid or | |
142 | * non-existant id is supplied. | |
143 | */ | |
144 | @WebMethod(operationName = "getGroupByName") | |
145 | @WebResult(name = "group") | |
146 | Group getGroupByName(@WebParam(name="namespaceCode") String namespaceCode, @WebParam(name="groupName") String groupName) throws RiceIllegalArgumentException; | |
147 | ||
148 | /** | |
149 | * Gets all groups for the given collection of group ids. | |
150 | * | |
151 | * <p>The result is a Map containing the group id as the key and the Group as the value.</p> | |
152 | * | |
153 | * @param groupIds Collection that matches the desired Groups' id | |
154 | * @return a Map of Groups with the given id values. An empty Map is returned if an invalid or | |
155 | * non-existant id is supplied. | |
156 | */ | |
157 | @WebMethod(operationName = "getGroups") | |
158 | @WebResult(name = "groups") | |
159 | @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) | |
160 | Map<String, Group> getGroups(@WebParam(name="groupIds") Collection<String> groupIds); | |
161 | ||
162 | ||
163 | /** | |
164 | * Check whether the give principal is a member of the group. | |
165 | * | |
166 | * <p>Will return true if the principal is a member of the group or a group assigned to this group.</p> | |
167 | * | |
168 | * @param principalId Id of the principal | |
169 | * @param groupId Id string of group | |
170 | * @return true if principal is a member of the group or a member of a group assigned to the the group. | |
171 | */ | |
172 | @WebMethod(operationName = "isMemberOfGroup") | |
173 | @WebResult(name = "isMember") | |
174 | boolean isMemberOfGroup(@WebParam(name="principalId") String principalId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
175 | ||
176 | /** | |
177 | * Check whether the give principal is a member of the group. | |
178 | * | |
179 | * <p>This will not recurse into contained groups. | |
180 | */ | |
181 | /** | |
182 | * Check whether the give principal is a member of the group. | |
183 | * | |
184 | * <p>This method does not recurse into contained groups.</p> | |
185 | * | |
186 | * @param principalId Id of the principal | |
187 | * @param groupId Id string of group | |
188 | * @return true if principal is a direct member of the group. | |
189 | */ | |
190 | @WebMethod(operationName = "isDirectMemberOfGroup") | |
191 | @WebResult(name = "isDirectMember") | |
192 | boolean isDirectMemberOfGroup(@WebParam(name="principalId") String principalId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
193 | ||
194 | /** | |
195 | * Get all the groups for the given principal. Recurses into parent groups | |
196 | * to provide a comprehensive list. | |
197 | * | |
198 | * <p> | |
199 | * This returns id for all groups for a given principal id. | |
200 | * </p> | |
201 | * | |
202 | * @param principalId Id of a Principal | |
203 | * @return a list of Group Ids in which the principal is a member of. | |
204 | */ | |
205 | @WebMethod(operationName = "getGroupIdsForPrincipal") | |
206 | @WebResult(name = "groupIdsForPrincipal") | |
207 | List<String> getGroupIdsForPrincipal(@WebParam(name="principalId") String principalId) throws RiceIllegalArgumentException; | |
208 | ||
209 | /** | |
210 | * Get all the groups for the given principal. Recurses into parent groups | |
211 | * to provide a comprehensive list. This is limited to the passed in Group's namespace. | |
212 | * | |
213 | * <p> | |
214 | * This returns id for all groups for a given principal id, limited to specific Group namespace. | |
215 | * </p> | |
216 | * | |
217 | * @param principalId Id of a Principal | |
218 | * @param namespaceCode Namspace code to limit group results to | |
219 | * @return a list of Group Ids in which the principal is a member of, limited to the passed in namespace. | |
220 | */ | |
221 | @WebMethod(operationName = "getGroupIdsForPrincipalByNamespace") | |
222 | @WebResult(name = "groupIdsForPrincipal") | |
223 | List<String> getGroupIdsForPrincipalByNamespace(@WebParam(name="principalId") String principalId, @WebParam(name="namespaceCode") String namespaceCode) throws RiceIllegalArgumentException; | |
224 | ||
225 | ||
226 | /** | |
227 | * Get all the groups for the given principal. Does not recurse into parent groups. | |
228 | * | |
229 | * <p> | |
230 | * This returns id for all groups for a given principal id. | |
231 | * </p> | |
232 | * | |
233 | * @param principalId Id of a Principal | |
234 | * @return a list of Group Ids in which the principal is directly a member of. | |
235 | */ | |
236 | @WebMethod(operationName = "getDirectGroupIdsForPrincipal") | |
237 | @WebResult(name = "directGroupIdsForPrincipal") | |
238 | List<String> getDirectGroupIdsForPrincipal(@WebParam(name="principalId") String principalId) throws RiceIllegalArgumentException; | |
239 | ||
240 | ||
241 | /** | |
242 | * Check whether the group identified by groupMemberId is a member of the group | |
243 | * identified by groupId. This will recurse through all groups. | |
244 | * | |
245 | * <p>Will return true if the group is a member of the group or a group assigned to this group.</p> | |
246 | * | |
247 | * @param groupMemberId Id of the principal | |
248 | * @param groupId Id string of group | |
249 | * @return true if group is a member of the group or a member of a group assigned to the the group. | |
250 | */ | |
251 | @WebMethod(operationName = "isGroupMemberOfGroup") | |
252 | @WebResult(name = "isMember") | |
253 | boolean isGroupMemberOfGroup(@WebParam(name="groupMemberId") String groupMemberId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
254 | ||
255 | /** | |
256 | * Checks if the group with the given id is active. Returns true if it is, false otherwise. | |
257 | */ | |
258 | //boolean isGroupActive( @WebParam(name="groupId") String groupId ); | |
259 | ||
260 | ||
261 | /** | |
262 | * Returns all principal ids that are members of the given group id. Recurses into contained groups for | |
263 | * comprehensive list. | |
264 | * | |
265 | * <p>Will return a list of all principal ids for members this group.</p> | |
266 | * | |
267 | * @param groupId Id string of group | |
268 | * @return List of principal ids | |
269 | */ | |
270 | @WebMethod(operationName = "getMemberPrincipalIds") | |
271 | @WebResult(name = "memberPrincipalIds") | |
272 | List<String> getMemberPrincipalIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
273 | ||
274 | ||
275 | /** | |
276 | * Returns all principal ids that are direct members of the given group id. | |
277 | * | |
278 | * <p>Will return a list of all principal ids for direct members this group.</p> | |
279 | * | |
280 | * @param groupId Id string of group | |
281 | * @return List of direct member principal ids. | |
282 | */ | |
283 | @WebMethod(operationName = "getDirectMemberPrincipalIds") | |
284 | @WebResult(name = "directMemberPrincipalIds") | |
285 | List<String> getDirectMemberPrincipalIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
286 | ||
287 | ||
288 | /** | |
289 | * Returns all group ids that are members of the given group id. Recurses into contained groups for | |
290 | * a comprehensive list. | |
291 | * | |
292 | * <p>Will return a list of all group ids for members this group.</p> | |
293 | * | |
294 | * @param groupId Id string of group | |
295 | * @return List of group ids | |
296 | */ | |
297 | @WebMethod(operationName = "getMemberGroupIds") | |
298 | @WebResult(name = "memberGroupIds") | |
299 | List<String> getMemberGroupIds( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException; | |
300 | ||
301 | ||
302 | /** | |
303 | * Returns all group ids that are direct members of the given group id. | |
304 | * | |
305 | * <p>Will return a list of all group ids for direct members this group.</p> | |
306 | * | |
307 | * @param groupId Id string of group | |
308 | * @return List of direct member group ids. | |
309 | */ | |
310 | @WebMethod(operationName = "getDirectMemberOfGroup") | |
311 | @WebResult(name = "directMemberGroupIds") | |
312 | List<String> getDirectMemberGroupIds( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException; | |
313 | ||
314 | ||
315 | /** | |
316 | * Returns all parent groups ids that the given group id is a member of. Recurses parent groups for | |
317 | * a comprehensive list. | |
318 | * | |
319 | * <p>Will return a list of all group ids that the given group id is a member of.</p> | |
320 | * | |
321 | * @param groupId Id string of group | |
322 | * @return List of parent group ids. | |
323 | */ | |
324 | @WebMethod(operationName = "getParentGroupIds") | |
325 | @WebResult(name = "parentGroupIds") | |
326 | List<String> getParentGroupIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
327 | ||
328 | ||
329 | /** | |
330 | * Returns all parent groups ids that the given group id is a member of. | |
331 | * | |
332 | * <p>Will return a list of all group ids that the given group id is a member of.</p> | |
333 | * | |
334 | * @param groupId Id string of group | |
335 | * @return List of parent group ids. | |
336 | */ | |
337 | @WebMethod(operationName = "getDirectParentGroupIds") | |
338 | @WebResult(name = "directParentGroupIds") | |
339 | List<String> getDirectParentGroupIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
340 | ||
341 | /** | |
342 | * Get all the attributes of the given group. | |
343 | */ | |
344 | @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) | |
345 | Attributes getAttributes( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException; | |
346 | ||
347 | ||
348 | /** | |
349 | * Get all GroupMembers all the groups with a given group id. | |
350 | * | |
351 | * <p> | |
352 | * The collection of GroupMembers will contain members for a the group in no defined order. | |
353 | * </p> | |
354 | * | |
355 | * @param groupIds Id of group | |
356 | * @return Collection of GroupMembers. | |
357 | */ | |
358 | @WebMethod(operationName = "getMembersOfGroup") | |
359 | @WebResult(name = "members") | |
360 | List<GroupMember> getMembersOfGroup( @WebParam(name="groupId") String groupIds ) throws RiceIllegalArgumentException; | |
361 | ||
362 | ||
363 | /** | |
364 | * Get all GroupMembers all the groups with the given group ids. | |
365 | * | |
366 | * <p> | |
367 | * The collection of GroupMembers will contain members for all the groups in no defined order. | |
368 | * The values returned may or may not be grouped by group id. | |
369 | * </p> | |
370 | * | |
371 | * @param groupIds Ids of groups | |
372 | * @return Collection of GroupMembers. | |
373 | */ | |
374 | @WebMethod(operationName = "getMembers") | |
375 | @WebResult(name = "members") | |
376 | List<GroupMember> getMembers( @WebParam(name="groupIds") List<String> groupIds ) throws RiceIllegalArgumentException; | |
377 | ||
378 | ||
379 | /** | |
380 | * Get the Person objects for the person type members of the group. | |
381 | * | |
382 | * <p> | |
383 | * Only Persons that are direct group members are returned. | |
384 | * </p> | |
385 | * | |
386 | * @param groupId Id of groups | |
387 | * @return Collection of Person objects who are members of the group. | |
388 | */ | |
389 | /* @WebMethod(operationName = "getPersonMembersOfGroup") | |
390 | @WebResult(name = "personMembersOfGroup") | |
391 | Collection<Person> getPersonMembersOfGroup( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException; | |
392 | ||
393 | ||
394 | *//** | |
395 | * Get the Group objects for the group type members of the group. | |
396 | * | |
397 | * <p> | |
398 | * Only Groups that are direct group members are returned. | |
399 | * </p> | |
400 | * | |
401 | * @param groupId Id of groups | |
402 | * @return Collection of Group objects who are members of the group. | |
403 | *//* | |
404 | @WebMethod(operationName = "getGroupMembersOfGroup") | |
405 | @WebResult(name = "groupMembersOfGroup") | |
406 | Collection<Group> getGroupMembersOfGroup( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException;*/ | |
407 | } |