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