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.exception.RiceIllegalArgumentException; | |
20 | import org.kuali.rice.core.api.mo.common.Attributes; | |
21 | import org.kuali.rice.core.util.jaxb.ImmutableListAdapter; | |
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 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
54 | List<Group> getGroupsForPrincipal(@WebParam(name="principalId") String principalId) throws RiceIllegalArgumentException; | |
55 | ||
56 | ||
57 | /** | |
58 | * Get all the groups within a namespace for a given principal. | |
59 | * | |
60 | * <p> | |
61 | * This will include all groups directly assigned as well as those inferred | |
62 | * by the fact that they are members of higher level groups, and filtered by Group namespace. | |
63 | * </p> | |
64 | * | |
65 | * @param principalId The id of the Principal | |
66 | * @param namespaceCode The namespace code of the desired Groups to return | |
67 | * @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 | |
68 | * non-existant principalId is supplied. | |
69 | */ | |
70 | @WebMethod(operationName = "getGroupsForPrincipalByNamespace") | |
71 | @WebResult(name = "groupsForPrincipal") | |
72 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
73 | List<Group> getGroupsForPrincipalByNamespace(@WebParam(name="principalId") String principalId, @WebParam(name="namespaceCode") String namespaceCode) throws RiceIllegalArgumentException; | |
74 | ||
75 | /** | |
76 | * Query for groups based on the given search criteria which is a Map of group field names to values. | |
77 | * | |
78 | * <p> | |
79 | * This method returns it's results as a List of group ids that match the given search criteria. | |
80 | * </p> | |
81 | * | |
82 | * @param searchCriteria Map<String, String> of search criteria | |
83 | * @return a list of groupId Strings in which the given criteria match Group properties. An empty list is returned if an invalid or | |
84 | * non-existent criteria is supplied. | |
85 | */ | |
86 | @WebMethod(operationName = "lookupGroupIds") | |
87 | @WebResult(name = "lookupGroupIds") | |
88 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
89 | List<String> lookupGroupIds(@WebParam(name="searchCriteria") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> searchCriteria); | |
90 | ||
91 | /** | |
92 | * Query for groups based on the given search criteria which is a Map of group field names to values. | |
93 | * | |
94 | * <p>This method returns it's results as a List of Group objects that match the given search criteria. | |
95 | */ | |
96 | ||
97 | /** | |
98 | * Query for groups based on the given search criteria which is a Map of group field names to values. | |
99 | * | |
100 | * <p> | |
101 | * This method returns it's results as a List of Groups that match the given search criteria. | |
102 | * </p> | |
103 | * | |
104 | * @param searchCriteria Map<String, String> of search criteria | |
105 | * @return a list of Group objects in which the given criteria match Group properties. An empty list is returned if an invalid or | |
106 | * non-existent criteria is supplied. | |
107 | */ | |
108 | @WebMethod(operationName = "lookupGroups") | |
109 | @WebResult(name = "lookupGroup") | |
110 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
111 | List<? extends Group> lookupGroups(@WebParam(name="searchCriteria") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> searchCriteria); | |
112 | ||
113 | /** | |
114 | * Lookup a Group based on the passed in id. | |
115 | * | |
116 | * | |
117 | * @param groupId String that matches the desired Groups id | |
118 | * @return a Group with the given id value. A null reference is returned if an invalid or | |
119 | * non-existant id is supplied. | |
120 | */ | |
121 | @WebMethod(operationName = "getGroup") | |
122 | @WebResult(name = "group") | |
123 | Group getGroup(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
124 | ||
125 | /** | |
126 | * Lookup a Group based on the passed in namespace and name. | |
127 | * | |
128 | * | |
129 | * @param namespaceCode String that matches the desired Group's namespaceCode | |
130 | * @param groupName String that matches the desired Group's name | |
131 | * @return a Group with the given namespace and name values. A null reference is returned if an invalid or | |
132 | * non-existant id is supplied. | |
133 | */ | |
134 | @WebMethod(operationName = "getGroupByName") | |
135 | @WebResult(name = "group") | |
136 | Group getGroupByName(@WebParam(name="namespaceCode") String namespaceCode, @WebParam(name="groupName") String groupName) throws RiceIllegalArgumentException; | |
137 | ||
138 | /** | |
139 | * Gets all groups for the given collection of group ids. | |
140 | * | |
141 | * <p>The result is a Map containing the group id as the key and the Group as the value.</p> | |
142 | * | |
143 | * @param groupIds Collection that matches the desired Groups' id | |
144 | * @return a Map of Groups with the given id values. An empty Map is returned if an invalid or | |
145 | * non-existant id is supplied. | |
146 | */ | |
147 | @WebMethod(operationName = "getGroups") | |
148 | @WebResult(name = "groups") | |
149 | @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) | |
150 | Map<String, Group> getGroups(@WebParam(name="groupIds") Collection<String> groupIds); | |
151 | ||
152 | ||
153 | /** | |
154 | * Check whether the give principal is a member of the group. | |
155 | * | |
156 | * <p>Will return true if the principal is a member of the group or a group assigned to this group.</p> | |
157 | * | |
158 | * @param principalId Id of the principal | |
159 | * @param groupId Id string of group | |
160 | * @return true if principal is a member of the group or a member of a group assigned to the the group. | |
161 | */ | |
162 | @WebMethod(operationName = "isMemberOfGroup") | |
163 | @WebResult(name = "isMember") | |
164 | boolean isMemberOfGroup(@WebParam(name="principalId") String principalId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
165 | ||
166 | /** | |
167 | * Check whether the give principal is a member of the group. | |
168 | * | |
169 | * <p>This will not recurse into contained groups. | |
170 | */ | |
171 | /** | |
172 | * Check whether the give principal is a member of the group. | |
173 | * | |
174 | * <p>This method does not recurse into contained groups.</p> | |
175 | * | |
176 | * @param principalId Id of the principal | |
177 | * @param groupId Id string of group | |
178 | * @return true if principal is a direct member of the group. | |
179 | */ | |
180 | @WebMethod(operationName = "isDirectMemberOfGroup") | |
181 | @WebResult(name = "isDirectMember") | |
182 | boolean isDirectMemberOfGroup(@WebParam(name="principalId") String principalId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
183 | ||
184 | /** | |
185 | * Get all the groups for the given principal. Recurses into parent groups | |
186 | * to provide a comprehensive list. | |
187 | * | |
188 | * <p> | |
189 | * This returns id for all groups for a given principal id. | |
190 | * </p> | |
191 | * | |
192 | * @param principalId Id of a Principal | |
193 | * @return a list of Group Ids in which the principal is a member of. | |
194 | */ | |
195 | @WebMethod(operationName = "getGroupIdsForPrincipal") | |
196 | @WebResult(name = "groupIdsForPrincipal") | |
197 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
198 | List<String> getGroupIdsForPrincipal(@WebParam(name="principalId") String principalId) throws RiceIllegalArgumentException; | |
199 | ||
200 | /** | |
201 | * Get all the groups for the given principal. Recurses into parent groups | |
202 | * to provide a comprehensive list. This is limited to the passed in Group's namespace. | |
203 | * | |
204 | * <p> | |
205 | * This returns id for all groups for a given principal id, limited to specific Group namespace. | |
206 | * </p> | |
207 | * | |
208 | * @param principalId Id of a Principal | |
209 | * @param namespaceCode Namspace code to limit group results to | |
210 | * @return a list of Group Ids in which the principal is a member of, limited to the passed in namespace. | |
211 | */ | |
212 | @WebMethod(operationName = "getGroupIdsForPrincipalByNamespace") | |
213 | @WebResult(name = "groupIdsForPrincipal") | |
214 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
215 | List<String> getGroupIdsForPrincipalByNamespace(@WebParam(name="principalId") String principalId, @WebParam(name="namespaceCode") String namespaceCode) throws RiceIllegalArgumentException; | |
216 | ||
217 | ||
218 | /** | |
219 | * Get all the groups for the given principal. Does not recurse into parent groups. | |
220 | * | |
221 | * <p> | |
222 | * This returns id for all groups for a given principal id. | |
223 | * </p> | |
224 | * | |
225 | * @param principalId Id of a Principal | |
226 | * @return a list of Group Ids in which the principal is directly a member of. | |
227 | */ | |
228 | @WebMethod(operationName = "getDirectGroupIdsForPrincipal") | |
229 | @WebResult(name = "directGroupIdsForPrincipal") | |
230 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
231 | List<String> getDirectGroupIdsForPrincipal(@WebParam(name="principalId") String principalId) throws RiceIllegalArgumentException; | |
232 | ||
233 | ||
234 | /** | |
235 | * Check whether the group identified by groupMemberId is a member of the group | |
236 | * identified by groupId. This will recurse through all groups. | |
237 | * | |
238 | * <p>Will return true if the group is a member of the group or a group assigned to this group.</p> | |
239 | * | |
240 | * @param groupMemberId Id of the principal | |
241 | * @param groupId Id string of group | |
242 | * @return true if group is a member of the group or a member of a group assigned to the the group. | |
243 | */ | |
244 | @WebMethod(operationName = "isGroupMemberOfGroup") | |
245 | @WebResult(name = "isMember") | |
246 | boolean isGroupMemberOfGroup(@WebParam(name="groupMemberId") String groupMemberId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
247 | ||
248 | /** | |
249 | * Checks if the group with the given id is active. Returns true if it is, false otherwise. | |
250 | */ | |
251 | //boolean isGroupActive( @WebParam(name="groupId") String groupId ); | |
252 | ||
253 | ||
254 | /** | |
255 | * Returns all principal ids that are members of the given group id. Recurses into contained groups for | |
256 | * comprehensive list. | |
257 | * | |
258 | * <p>Will return a list of all principal ids for members this group.</p> | |
259 | * | |
260 | * @param groupId Id string of group | |
261 | * @return List of principal ids | |
262 | */ | |
263 | @WebMethod(operationName = "getMemberPrincipalIds") | |
264 | @WebResult(name = "memberPrincipalIds") | |
265 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
266 | List<String> getMemberPrincipalIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
267 | ||
268 | ||
269 | /** | |
270 | * Returns all principal ids that are direct members of the given group id. | |
271 | * | |
272 | * <p>Will return a list of all principal ids for direct members this group.</p> | |
273 | * | |
274 | * @param groupId Id string of group | |
275 | * @return List of direct member principal ids. | |
276 | */ | |
277 | @WebMethod(operationName = "getDirectMemberPrincipalIds") | |
278 | @WebResult(name = "directMemberPrincipalIds") | |
279 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
280 | List<String> getDirectMemberPrincipalIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
281 | ||
282 | ||
283 | /** | |
284 | * Returns all group ids that are members of the given group id. Recurses into contained groups for | |
285 | * a comprehensive list. | |
286 | * | |
287 | * <p>Will return a list of all group ids for members this group.</p> | |
288 | * | |
289 | * @param groupId Id string of group | |
290 | * @return List of group ids | |
291 | */ | |
292 | @WebMethod(operationName = "getMemberGroupIds") | |
293 | @WebResult(name = "memberGroupIds") | |
294 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
295 | List<String> getMemberGroupIds( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException; | |
296 | ||
297 | ||
298 | /** | |
299 | * Returns all group ids that are direct members of the given group id. | |
300 | * | |
301 | * <p>Will return a list of all group ids for direct members this group.</p> | |
302 | * | |
303 | * @param groupId Id string of group | |
304 | * @return List of direct member group ids. | |
305 | */ | |
306 | @WebMethod(operationName = "getDirectMemberOfGroup") | |
307 | @WebResult(name = "directMemberGroupIds") | |
308 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
309 | List<String> getDirectMemberGroupIds( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException; | |
310 | ||
311 | ||
312 | /** | |
313 | * Returns all parent groups ids that the given group id is a member of. Recurses parent groups for | |
314 | * a comprehensive list. | |
315 | * | |
316 | * <p>Will return a list of all group ids that the given group id is a member of.</p> | |
317 | * | |
318 | * @param groupId Id string of group | |
319 | * @return List of parent group ids. | |
320 | */ | |
321 | @WebMethod(operationName = "getParentGroupIds") | |
322 | @WebResult(name = "parentGroupIds") | |
323 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
324 | List<String> getParentGroupIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
325 | ||
326 | ||
327 | /** | |
328 | * Returns all parent groups ids that the given group id is a member of. | |
329 | * | |
330 | * <p>Will return a list of all group ids that the given group id is a member of.</p> | |
331 | * | |
332 | * @param groupId Id string of group | |
333 | * @return List of parent group ids. | |
334 | */ | |
335 | @WebMethod(operationName = "getDirectParentGroupIds") | |
336 | @WebResult(name = "directParentGroupIds") | |
337 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
338 | List<String> getDirectParentGroupIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | |
339 | ||
340 | /** | |
341 | * Get all the attributes of the given group. | |
342 | */ | |
343 | @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) | |
344 | Attributes getAttributes( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException; | |
345 | ||
346 | ||
347 | /** | |
348 | * Get all GroupMembers all the groups with a given group id. | |
349 | * | |
350 | * <p> | |
351 | * The collection of GroupMembers will contain members for a the group in no defined order. | |
352 | * </p> | |
353 | * | |
354 | * @param groupIds Id of group | |
355 | * @return Collection of GroupMembers. | |
356 | */ | |
357 | @WebMethod(operationName = "getMembersOfGroup") | |
358 | @WebResult(name = "members") | |
359 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
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 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
377 | List<GroupMember> getMembers( @WebParam(name="groupIds") List<String> groupIds ) throws RiceIllegalArgumentException; | |
378 | ||
379 | ||
380 | /** | |
381 | * Get the Person objects for the person type members of the group. | |
382 | * | |
383 | * <p> | |
384 | * Only Persons that are direct group members are returned. | |
385 | * </p> | |
386 | * | |
387 | * @param groupId Id of groups | |
388 | * @return Collection of Person objects who are members of the group. | |
389 | */ | |
390 | /* @WebMethod(operationName = "getPersonMembersOfGroup") | |
391 | @WebResult(name = "personMembersOfGroup") | |
392 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
393 | Collection<Person> getPersonMembersOfGroup( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException; | |
394 | ||
395 | ||
396 | *//** | |
397 | * Get the Group objects for the group type members of the group. | |
398 | * | |
399 | * <p> | |
400 | * Only Groups that are direct group members are returned. | |
401 | * </p> | |
402 | * | |
403 | * @param groupId Id of groups | |
404 | * @return Collection of Group objects who are members of the group. | |
405 | *//* | |
406 | @WebMethod(operationName = "getGroupMembersOfGroup") | |
407 | @WebResult(name = "groupMembersOfGroup") | |
408 | @XmlJavaTypeAdapter(value = ImmutableListAdapter.class) | |
409 | Collection<Group> getGroupMembersOfGroup( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException;*/ | |
410 | } |