001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kim.api.group;
017
018import org.joda.time.DateTime;
019import org.kuali.rice.core.api.criteria.QueryByCriteria;
020import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
021import org.kuali.rice.core.api.util.jaxb.DateTimeAdapter;
022import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
023import org.kuali.rice.kim.api.KimConstants;
024import org.kuali.rice.kim.api.role.Role;
025import org.springframework.cache.annotation.CacheEvict;
026import org.springframework.cache.annotation.Cacheable;
027import javax.jws.WebMethod;
028import javax.jws.WebParam;
029import javax.jws.WebResult;
030import javax.jws.WebService;
031import javax.jws.soap.SOAPBinding;
032import javax.xml.bind.annotation.XmlElement;
033import javax.xml.bind.annotation.XmlElementWrapper;
034import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
035import java.util.Collection;
036import java.util.List;
037import java.util.Map;
038/**
039 *
040 * This service provides operations for checking group membership, querying for group data,
041 * creating and updating groups.
042 *
043 * <p>A group is a collection of principals.  It's membership consists of direct principal
044 * assignment and/or nested group membership.  All groups are uniquely identified by a namespace
045 * code plus a name.
046 *
047 * <p>As mentioned previously, groups support nested group membership.  A principal or group is
048 * considered to be a "member" of a group if it is either directly assigned to the group or
049 * indirectly assigned (via a nested group membership).  A principal or group is said to be a
050 * "direct" member of another group only if it is directly assigned as a member of the group,
051 * and not via a nested group assignment.
052 *
053 * @author Kuali Rice Team (rice.collab@kuali.org)
054 *
055 */
056
057@WebService(name = "groupService", targetNamespace = KimConstants.Namespaces.KIM_NAMESPACE_2_0)
058@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
059public interface GroupService {
060
061    /**
062     * Get all the groups for a given principal.
063     *
064     * <p>
065     * This will include all groups directly assigned as well as those inferred
066     * by the fact that they are members of higher level groups.
067     * </p>
068     *
069     * @param principalId The id of the Principal
070     * @return a list of Group objects in which the given Principal is a member of.  An empty list is returned if an invalid or
071     *         non-existant principalId is supplied.
072     * @throws RiceIllegalArgumentException if the principalId is null or blank
073     */
074    @WebMethod(operationName = "getGroupsByPrincipalId")
075    @XmlElementWrapper(name = "groups", required = true)
076    @XmlElement(name = "group", required = false)
077    @WebResult(name = "groups")
078    @Cacheable(value= GroupMember.Cache.NAME, key="'principalId=' + #p0")
079    List<Group> getGroupsByPrincipalId(@WebParam(name = "principalId") String principalId) throws RiceIllegalArgumentException;
080
081
082    /**
083     * Get all the groups within a namespace for a given principal.
084     *
085     * <p>
086     * This will include all groups directly assigned as well as those inferred
087     * by the fact that they are members of higher level groups, and filtered by Group namespace.
088     * </p>
089     *
090     * @param principalId The id of the Principal
091     * @param namespaceCode The namespace code of the desired Groups to return
092     * @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
093     *         non-existant principalId is supplied.
094     * @throws RiceIllegalArgumentException if the principalId, namespaceCode is null or blank
095     */
096    @WebMethod(operationName = "getGroupsByPrincipalIdAndNamespaceCode")
097    @XmlElementWrapper(name = "groups", required = true)
098    @XmlElement(name = "group", required = false)
099    @WebResult(name = "groups")
100    @Cacheable(value= GroupMember.Cache.NAME, key="'principalId=' + #p0 + '|' + 'namespaceCode=' + #p1")
101    List<Group> getGroupsByPrincipalIdAndNamespaceCode(@WebParam(name = "principalId") String principalId,
102            @WebParam(name = "namespaceCode") String namespaceCode) throws RiceIllegalArgumentException;
103
104    /**
105     * Query for groups based on the given search criteria which is a Map of group field names to values.
106     *
107     * <p>
108     * This method returns it's results as a List of group ids that match the given search criteria.
109     * </p>
110     *
111     * @param queryByCriteria the criteria.  Cannot be null.
112     * @return a list of groupId Strings in which the given criteria match Group properties.  An empty list is returned if an invalid or
113     *         non-existent criteria is supplied.
114     * @throws RiceIllegalArgumentException if the queryByCriteria is null
115     */
116    @WebMethod(operationName = "findGroupIds")
117    @XmlElementWrapper(name = "groupIds", required = true)
118    @XmlElement(name = "groupId", required = false)
119    @WebResult(name = "groupIds")
120    List<String> findGroupIds(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
121
122    /**
123     * Query for groups based on the given search criteria which is a Map of group field names to values.
124     *
125     * <p>
126     * This method returns it's results as a List of Groups that match the given search criteria.
127     * </p>
128     *
129     * @param queryByCriteria the criteria.  Cannot be null.
130     * @return a list of Group objects in which the given criteria match Group properties.  An empty list is returned if an invalid or
131     *         non-existent criteria is supplied.
132     * @throws RiceIllegalArgumentException if the queryByCriteria is null
133     */
134    @WebMethod(operationName = "findGroups")
135    @WebResult(name = "results")
136    GroupQueryResults findGroups(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
137
138    /**
139     * Query for group members based on the given search criteria which is a Map of group member field names to values.
140     *
141     * <p>
142     * This method returns it's results as a List of GroupMemberss that match the given search criteria.
143     * </p>
144     *
145     * @param queryByCriteria the criteria.  Cannot be null.
146     * @return a list of GroupMember objects in which the given criteria match Group properties.  An empty list is returned if an invalid or
147     *         non-existent criteria is supplied.
148     * @throws RiceIllegalArgumentException if the queryByCriteria is null
149     */
150    @WebMethod(operationName = "findGroupMembers")
151    @WebResult(name = "results")
152    GroupMemberQueryResults findGroupMembers(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
153    /**
154     * Lookup a Group based on the passed in id.
155     *
156     *
157     * @param id String that matches the desired Groups id
158     * @return a Group with the given id value.  A null reference is returned if an invalid or
159     *         non-existant id is supplied.
160     * @throws RiceIllegalArgumentException if the groupId is null or blank
161     */
162    @WebMethod(operationName = "getGroup")
163    @WebResult(name = "group")
164    @Cacheable(value= Group.Cache.NAME, key="'id=' + #p0")
165    Group getGroup(@WebParam(name="id") String id) throws RiceIllegalArgumentException;
166
167    /**
168     * Lookup a Group based on the passed in namespace and name.
169     *
170     *
171     * @param namespaceCode String that matches the desired Group's namespaceCode
172     * @param groupName     String that matches the desired Group's name
173     * @return a Group with the given namespace and name values.  A null reference is returned if an invalid or
174     *         non-existant id is supplied.
175     * @throws RiceIllegalArgumentException if the namespaceCode, groupName is null or blank
176     */
177    @WebMethod(operationName = "getGroupByNamespaceCodeAndName")
178    @WebResult(name = "group")
179    @Cacheable(value= Group.Cache.NAME, key="'namespaceCode=' + #p0 + '|' + 'groupName=' + #p1")
180    Group getGroupByNamespaceCodeAndName(@WebParam(name = "namespaceCode") String namespaceCode,
181            @WebParam(name = "groupName") String groupName) throws RiceIllegalArgumentException;
182
183    /**
184     * Gets all groups for the given collection of group ids.
185     *
186     * <p>The result is a Map containing the group id as the key and the Group as the value.</p>
187     *
188     * @param ids Collection that matches the desired Groups' id
189     * @return a Map of Groups with the given id values.  An empty Map is returned if an invalid or
190     *         non-existant id is supplied.
191     * @throws RiceIllegalArgumentException if the groupIds null or empty
192     */
193    @WebMethod(operationName = "getGroups")
194    @XmlElementWrapper(name = "groups", required = true)
195    @XmlElement(name = "group", required = false)
196    @WebResult(name = "groups")
197    @Cacheable(value= Group.Cache.NAME, key="'ids=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0)")
198    List<Group> getGroups(@WebParam(name="ids") Collection<String> ids) throws RiceIllegalArgumentException;
199
200
201    /**
202     * Check whether the give principal is a member of the group.
203     *
204     * <p>Will return true if the principal is a member of the group or a group assigned to this group.</p>
205     *
206     * @param principalId Id of the principal
207     * @param groupId     Id string of group
208     * @return true if principal is a member of the group or a member of a group assigned to the the group.
209     * @throws RiceIllegalArgumentException if the principalId, groupId is null or blank
210     */
211    @WebMethod(operationName = "isMemberOfGroup")
212    @WebResult(name = "isMember")
213    @Cacheable(value= GroupMember.Cache.NAME, key="'{isMemberOfGroup}' + 'principalId=' + #p0 + '|' + 'groupId=' + #p1")
214        boolean isMemberOfGroup(@WebParam(name="principalId") String principalId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException;
215
216        /**
217         * Check whether the give principal is a member of the group.
218         *
219         * <p>This will not recurse into contained groups.
220         */
221    /**
222     * Check whether the give principal is a member of the group.
223     *
224     * <p>This method does not recurse into contained groups.</p>
225     *
226     * @param principalId Id of the principal
227     * @param groupId     Id string of group
228     * @return true if principal is a direct member of the group.
229     * @throws RiceIllegalArgumentException if the principalId, groupId is null or blank
230     */
231    @WebMethod(operationName = "isDirectMemberOfGroup")
232    @WebResult(name = "isDirectMember")
233    @Cacheable(value= GroupMember.Cache.NAME, key="'{isDirectMemberOfGroup}' + 'principalId=' + #p0 + '|' + 'groupId=' + #p1")
234        boolean isDirectMemberOfGroup(@WebParam(name="principalId") String principalId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException;
235
236    /**
237     * Get all the groups for the given principal.  Recurses into parent groups
238     * to provide a comprehensive list.
239     *
240     * <p>
241     * This returns id for all groups for a given principal id.
242     * </p>
243     *
244     * @param principalId Id of a Principal
245     * @return a list of Group Ids in which the principal is a member of.
246     * @throws RiceIllegalArgumentException if the principalId is null or blank
247     */
248    @WebMethod(operationName = "getGroupIdsByPrincipalId")
249    @XmlElementWrapper(name = "groupIds", required = true)
250    @XmlElement(name = "groupId", required = false)
251    @WebResult(name = "groupIds")
252    @Cacheable(value= GroupMember.Cache.NAME, key="'{getGroupIdsByPrincipalId}' + 'principalId=' + #p0")
253        List<String> getGroupIdsByPrincipalId(@WebParam(name = "principalId") String principalId) throws RiceIllegalArgumentException;
254
255    /**
256     * Get all the groups for the given principal.  Recurses into parent groups
257     * to provide a comprehensive list.  This is limited to the passed in Group's namespace.
258     *
259     * <p>
260     * This returns id for all groups for a given principal id, limited to specific Group namespace.
261     * </p>
262     *
263     * @param principalId Id of a Principal
264     * @param namespaceCode Namspace code to limit group results to
265     * @return a list of Group Ids in which the principal is a member of, limited to the passed in namespace.
266     * @throws RiceIllegalArgumentException if the principalId, namespaceCode is null or blank
267     */
268    @WebMethod(operationName = "getGroupIdsByPrincipalIdAndNamespaceCode")
269    @XmlElementWrapper(name = "groupIds", required = true)
270    @XmlElement(name = "groupId", required = false)
271    @WebResult(name = "groupIds")
272    @Cacheable(value= GroupMember.Cache.NAME, key="'{getGroupIdsByPrincipalIdAndNamespaceCode}' + 'principalId=' + #p0 + '|' + 'namespaceCode=' + #p1")
273        List<String> getGroupIdsByPrincipalIdAndNamespaceCode(@WebParam(name = "principalId") String principalId,
274            @WebParam(name = "namespaceCode") String namespaceCode) throws RiceIllegalArgumentException;
275
276
277    /**
278     * Get all the groups for the given principal.  Does not recurse into parent groups.
279     *
280     * <p>
281     * This returns id for all groups for a given principal id.
282     * </p>
283     *
284     * @param principalId Id of a Principal
285     * @return a list of Group Ids in which the principal is directly a member of.
286     * @throws RiceIllegalArgumentException if the principalId is null or blank
287     */
288    @WebMethod(operationName = "getDirectGroupIdsByPrincipalId")
289    @XmlElementWrapper(name = "groupIds", required = true)
290    @XmlElement(name = "groupId", required = false)
291    @WebResult(name = "groupIds")
292    @Cacheable(value= GroupMember.Cache.NAME, key="'{getDirectGroupIdsByPrincipalId}' + 'principalId=' + #p0")
293    List<String> getDirectGroupIdsByPrincipalId(@WebParam(name = "principalId") String principalId) throws RiceIllegalArgumentException;
294
295
296    /**
297     * Check whether the group identified by groupMemberId is a member of the group
298     * identified by groupId.  This will recurse through all groups.
299     *
300     * <p>Will return true if the group is a member of the group or a group assigned to this group.</p>
301     *
302     * @param groupMemberId Id of the principal
303     * @param groupId     Id string of group
304     * @return true if group is a member of the group or a member of a group assigned to the the group.
305     * @throws RiceIllegalArgumentException if the groupMemberId, groupId is null or blank
306     */
307    @WebMethod(operationName = "isGroupMemberOfGroup")
308    @WebResult(name = "isMember")
309    @Cacheable(value= GroupMember.Cache.NAME, key="'{isGroupMemberOfGroup}' + 'groupMemberId=' + #p0 + '|' + 'groupId=' + #p1")
310    boolean isGroupMemberOfGroup(@WebParam(name="groupMemberId") String groupMemberId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException;
311
312
313
314    /**
315     * Returns all principal ids that are members of the given group id.  Recurses into contained groups for
316     * comprehensive list.
317     *
318     * <p>Will return a list of all principal ids for members this group.</p>
319     *
320     * @param groupId     Id string of group
321     * @return List of principal ids
322     * @throws RiceIllegalArgumentException if the groupId is null or blank
323     */
324    @WebMethod(operationName = "getMemberPrincipalIds")
325    @XmlElementWrapper(name = "principalIds", required = true)
326    @XmlElement(name = "principalId", required = false)
327    @WebResult(name = "principalIds")
328    @Cacheable(value= GroupMember.Cache.NAME, key="'{getMemberPrincipalIds}' + 'groupId=' + #p0")
329        List<String> getMemberPrincipalIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException;
330
331
332    /**
333     * Returns all principal ids that are direct members of the given group id.
334     *
335     * <p>Will return a list of all principal ids for direct members this group.</p>
336     *
337     * @param groupId     Id string of group
338     * @return List of direct member principal ids.
339     * @throws RiceIllegalArgumentException if the groupId is null or blank
340     */
341    @WebMethod(operationName = "getDirectMemberPrincipalIds")
342    @XmlElementWrapper(name = "principalIds", required = true)
343    @XmlElement(name = "principalId", required = false)
344    @WebResult(name = "principalIds")
345    @Cacheable(value= GroupMember.Cache.NAME, key="'{getDirectMemberPrincipalIds}' + 'groupId=' + #p0")
346        List<String> getDirectMemberPrincipalIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException;
347
348
349    /**
350     * Returns all group ids that are members of the given group id.  Recurses into contained groups for
351     * a comprehensive list.
352     *
353     * <p>Will return a list of all group ids for members this group.</p>
354     *
355     * @param groupId     Id string of group
356     * @return List of group ids
357     * @throws RiceIllegalArgumentException if the groupId is null or blank
358     */
359    @WebMethod(operationName = "getMemberGroupIds")
360    @XmlElementWrapper(name = "groupIds", required = true)
361    @XmlElement(name = "groupId", required = false)
362    @WebResult(name = "groupIds")
363    @Cacheable(value= GroupMember.Cache.NAME, key="'{getMemberGroupIds}' + 'groupId=' + #p0")
364        List<String> getMemberGroupIds( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException;
365
366
367    /**
368     * Returns all group ids that are direct members of the given group id.
369     *
370     * <p>Will return a list of all group ids for direct members this group.</p>
371     *
372     * @param groupId     Id string of group
373     * @return List of direct member group ids.
374     * @throws RiceIllegalArgumentException if the groupId is null or blank
375     */
376    @WebMethod(operationName = "getDirectMemberOfGroup")
377    @XmlElementWrapper(name = "groupIds", required = true)
378    @XmlElement(name = "groupId", required = false)
379    @WebResult(name = "groupIds")
380    @Cacheable(value= GroupMember.Cache.NAME, key="'{getDirectMemberGroupIds}' + 'groupId=' + #p0")
381        List<String> getDirectMemberGroupIds( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException;
382
383
384    /**
385     * Returns all parent groups ids that the given group id is a member of. Recurses parent groups for
386     * a comprehensive list.
387     *
388     * <p>Will return a list of all group ids that the given group id is a member of.</p>
389     *
390     * @param groupId     Id string of group
391     * @return List of parent group ids.
392     * @throws RiceIllegalArgumentException if the groupId is null or blank
393     */
394    @WebMethod(operationName = "getParentGroupIds")
395    @XmlElementWrapper(name = "groupIds", required = true)
396    @XmlElement(name = "groupId", required = false)
397    @WebResult(name = "groupIds")
398    @Cacheable(value= GroupMember.Cache.NAME, key="'{getParentGroupIds}' + 'groupId=' + #p0")
399    List<String> getParentGroupIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException;
400
401
402    /**
403     * Returns all parent groups ids that the given group id is a member of.
404     *
405     * <p>Will return a list of all group ids that the given group id is a member of.</p>
406     *
407     * @param groupId     Id string of group
408     * @return List of parent group ids.
409     * @throws RiceIllegalArgumentException if the groupId is null or blank
410     */
411    @WebMethod(operationName = "getDirectParentGroupIds")
412    @XmlElementWrapper(name = "groupIds", required = true)
413    @XmlElement(name = "groupId", required = false)
414    @WebResult(name = "groupIds")
415    @Cacheable(value= GroupMember.Cache.NAME, key="'{getDirectParentGroupIds}' + 'groupId=' + #p0")
416    List<String> getDirectParentGroupIds(@WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException;
417
418        /**
419         * Get all the attributes of the given group.
420     * @throws RiceIllegalArgumentException if the groupId is null or blank
421         */
422    @WebMethod(operationName = "getAttributes")
423    @WebResult(name = "attributes")
424    @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
425    @Cacheable(value= Group.Cache.NAME, key="'{getAttributes}' + 'groupId=' + #p0")
426    Map<String, String> getAttributes( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException;
427
428
429    /**
430     * Get all GroupMembers all the groups with a given group id.
431     *
432     * <p>
433     * The collection of GroupMembers will contain members for a the group in no defined order.
434     * </p>
435     *
436     * @param groupId     Id of group
437     * @return Collection of GroupMembers.
438     * @throws RiceIllegalArgumentException if the groupId is null or blank
439     */
440    @WebMethod(operationName = "getMembersOfGroup")
441    @XmlElementWrapper(name = "members", required = true)
442    @XmlElement(name = "member", required = false)
443    @WebResult(name = "members")
444    @Cacheable(value= GroupMember.Cache.NAME, key="'groupId=' + #p0")
445        List<GroupMember> getMembersOfGroup( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException;
446
447    /**
448     * Get all GroupMembers all the groups with a given group id and asOfDate.
449     *
450     * <p>
451     * The collection of GroupMembers will contain members for a the group in no defined order. That were members at the specified time.
452     * </p>
453     *
454     * @param groupId     Id of group
455     * @param asOfDate    Date for historical record
456     * @return Collection of GroupMembers.
457     * @throws RiceIllegalArgumentException if the groupId is null or blank
458     */
459    @WebMethod(operationName = "getMembersOfGroupWithDate")
460    @XmlElementWrapper(name = "members", required = true)
461    @XmlElement(name = "member", required = false)
462    @WebResult(name = "members")
463    @Cacheable(value= GroupMember.Cache.NAME, key="'groupId=' + #p0 + '|' + 'asOfDate=' + #p1")
464    List<GroupMember> getMembersOfGroupWithDate( @WebParam(name="groupId") String groupId,
465            @XmlJavaTypeAdapter(value = DateTimeAdapter.class) @WebParam(name="asOfDate")DateTime asOfDate )
466            throws RiceIllegalArgumentException;
467
468
469    /**
470     * Get all GroupMembers all the groups with the given group ids.
471     *
472     * <p>
473     * The collection of GroupMembers will contain members for all the groups in no defined order.
474     * The values returned may or may not be grouped by group id.
475     * </p>
476     *
477     * @param groupIds     Ids of groups
478     * @return Collection of GroupMembers.
479     * @throws RiceIllegalArgumentException if the groupIds is null or empty
480     */
481    @WebMethod(operationName = "getMembers")
482    @XmlElementWrapper(name = "members", required = true)
483    @XmlElement(name = "member", required = false)
484    @WebResult(name = "members")
485    @Cacheable(value= GroupMember.Cache.NAME, key="'groupIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0)")
486        List<GroupMember> getMembers( @WebParam(name="groupIds") List<String> groupIds ) throws RiceIllegalArgumentException;
487
488
489    /**
490     * Creates a new group using the given Group.
491     *
492     * <p>
493     * This will attempt to create a new Group
494     * </p>
495     *
496     * @param group The new group to be created
497     * @return a the Group that has been created.
498     * @throws RiceIllegalArgumentException if the group is null
499     */
500    @WebMethod(operationName = "createGroup")
501    @WebResult(name = "group")
502    @CacheEvict(value={Group.Cache.NAME, GroupMember.Cache.NAME}, allEntries = true)
503        Group createGroup(@WebParam(name="group") Group group) throws RiceIllegalArgumentException;
504
505    /**
506     * Updates an existing group using the given Group.
507     *
508     * <p>
509     * This will attempt to update an existing Group.  For this to return without exceptions, the passed in Group
510     * must have it's Id set and be a valid group that already exists.
511     * </p>
512     *
513     * @param group The group to be updated
514     * @return a the Group that has been updated.
515     * @throws RiceIllegalArgumentException if the group is null
516     */
517    @WebMethod(operationName = "updateGroup")
518    @WebResult(name = "group")
519    @CacheEvict(value={Group.Cache.NAME, GroupMember.Cache.NAME}, allEntries = true)
520        Group updateGroup(@WebParam(name="group") Group group) throws RiceIllegalArgumentException;
521
522        /**
523     * Updates a group using the given Group.
524     *
525     * <p>
526     * This will attempt to update an existing group with data from the passed in group.  If the passed in groupId and the group.id values are different
527     * this method will inactivate the old group and create a new group with the same members with the passed in groups properties.
528     * </p>
529     *
530     * @param groupId Id of the Group to be updated
531     * @param group   Group object to use for update
532     * @return a the Group that has been updated.
533     * @throws RiceIllegalArgumentException if the group is null or the groupId is null or blank
534     */
535    @WebMethod(operationName = "updateGroupWithId")
536    @WebResult(name = "group")
537    @CacheEvict(value={Group.Cache.NAME, GroupMember.Cache.NAME}, allEntries = true)
538    Group updateGroup(@WebParam(name="groupId") String groupId, @WebParam(name="group") Group group) throws RiceIllegalArgumentException;
539
540    /**
541     * Creates a new group using the given GroupMember.
542     *
543     * <p>
544     * This will attempt to create a new GroupMember
545     * </p>
546     *
547     * @param groupMember The new groupMember to be created
548     * @return a the GroupMember that has been created.
549     * @throws RiceIllegalArgumentException if the group is null
550     */
551    @WebMethod(operationName = "createGroupMember")
552    @WebResult(name = "groupMember")
553    @CacheEvict(value={GroupMember.Cache.NAME, Role.Cache.NAME}, allEntries = true)
554        GroupMember createGroupMember(@WebParam(name="groupMember") GroupMember groupMember) throws RiceIllegalArgumentException;
555
556    /**
557     * Updates an existing group using the given GroupMember.
558     *
559     * <p>
560     * This will attempt to update an existing GroupMember.  For this to return without exceptions, the passed in
561     * GroupMember must have it's Id set and be a valid groupMember that already exists.
562     * </p>
563     *
564     * @param groupMember The groupMember to be updated
565     * @return a the GroupMember that has been updated.
566     * @throws RiceIllegalArgumentException if the groupMember is null
567     */
568    @WebMethod(operationName = "updateGroupMember")
569    @WebResult(name = "groupMember")
570    @CacheEvict(value={GroupMember.Cache.NAME, Role.Cache.NAME}, allEntries = true)
571        GroupMember updateGroupMember(@WebParam(name="groupMember") GroupMember groupMember) throws RiceIllegalArgumentException;
572
573    /**
574     * Adds the group with the id supplied in childId as a member of the group with the id supplied in parentId.
575     *
576     * @param childId Id of the Group to be added to the members of Parent
577     * @param parentId  Id of the Group object to add the member to
578     * @return true if the member was added successfully.
579     * @throws RiceIllegalArgumentException if the childId, parentId is null or blank
580     */
581    @WebMethod(operationName = "addGroupToGroup")
582    @WebResult(name = "addedToGroup")
583    @CacheEvict(value={GroupMember.Cache.NAME, Role.Cache.NAME}, allEntries = true)
584    boolean addGroupToGroup(@WebParam(name="childId") String childId, @WebParam(name="parentId") String parentId) throws RiceIllegalArgumentException;
585
586    /**
587     * Removes the group with the id supplied in childId from the group with the id supplied in parentId.
588     *
589     * @param childId Id of the Group to be removed from the members of Parent
590     * @param parentId  Id of the Group object to remove the member from
591     * @return true if the member was removed successfully.
592     * @throws RiceIllegalArgumentException if the childId, parentId is null or blank
593     */
594    @WebMethod(operationName = "removeGroupFromGroup")
595    @WebResult(name = "removedFromGroup")
596    @CacheEvict(value={GroupMember.Cache.NAME, Role.Cache.NAME}, allEntries = true)
597    boolean removeGroupFromGroup(@WebParam(name="childId") String childId, @WebParam(name="parentId") String parentId) throws RiceIllegalArgumentException;
598
599    /**
600     * Add the principal with the given principalId as a member of the group with the given groupId.
601     *
602     * @param principalId Id of the Principal to be added to the members of the Parent Group
603     * @param groupId  Id of the Group object to add the member to
604     * @return true if the member was added successfully.
605     * @throws RiceIllegalArgumentException if the principalId, groupId is null or blank
606     */
607    @WebMethod(operationName = "addPrincipalToGroup")
608    @WebResult(name = "addedToGroup")
609    @CacheEvict(value={GroupMember.Cache.NAME, Role.Cache.NAME}, allEntries = true)
610    boolean addPrincipalToGroup(@WebParam(name="principalId") String principalId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException;
611
612    /**
613     * Removes the member principal with the given principalId from the group with the given groupId.
614     *
615     * @param principalId Id of the Principal to be removed from the members of the Parent Group
616     * @param groupId  Id of the Group object to remove the member from
617     * @return true if the member was removed successfully.
618     * @throws RiceIllegalArgumentException if the principalId, groupId is null or blank
619     */
620    @WebMethod(operationName = "removePrincipalFromGroup")
621    @WebResult(name = "removedFromGroup")
622    @CacheEvict(value={GroupMember.Cache.NAME, Role.Cache.NAME}, allEntries = true)
623    boolean removePrincipalFromGroup(@WebParam(name="principalId") String principalId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException;
624
625    /**
626     * Removes all members from the group with the given groupId.
627     *
628     * @param groupId  Id of the Group object to remove the members from
629     * @throws RiceIllegalArgumentException if the groupId is null or blank
630     */
631    @WebMethod(operationName = "removeAllMembers")
632    @CacheEvict(value={GroupMember.Cache.NAME, Role.Cache.NAME}, allEntries = true)
633    void removeAllMembers( @WebParam(name="groupId") String groupId ) throws RiceIllegalArgumentException;
634
635
636    @WebMethod(operationName = "isGroupMemberOfGroupWithDate")
637    @WebResult(name = "isMember")
638    boolean isGroupMemberOfGroupWithDate(String groupMemberId, String groupId,
639            @XmlJavaTypeAdapter(value = DateTimeAdapter.class) @WebParam(name="asOfDate") DateTime asOfDate) throws RiceIllegalArgumentException;
640
641    @WebMethod(operationName = "isMemberOfGroupWithDate")
642    @WebResult(name = "isMember")
643    boolean isMemberOfGroupWithDate(String principalId, String groupId,
644            @XmlJavaTypeAdapter(value = DateTimeAdapter.class) @WebParam(name="asOfDate") DateTime asOfDate) throws RiceIllegalArgumentException;
645
646    @WebMethod(operationName = "getDirectMemberGroupIdsWithDate")
647    @XmlElementWrapper(name = "directMembers", required = true)
648    @XmlElement(name = "directMember", required = false)
649    @WebResult(name = "directMembers")
650    List<String> getDirectMemberGroupIdsWithDate(String groupId) throws RiceIllegalArgumentException;
651
652    @WebMethod(operationName = "getDirectParentGroupIdsWithDate")
653    @XmlElementWrapper(name = "directParents", required = true)
654    @XmlElement(name = "directParent", required = false)
655    @WebResult(name = "directParents")
656    List<String> getDirectParentGroupIdsWithDate(String groupId,
657            @XmlJavaTypeAdapter(value = DateTimeAdapter.class) @WebParam(name="asOfDate") DateTime asOfDate) throws RiceIllegalArgumentException;
658
659    @WebMethod(operationName = "getMembersWithDate")
660    @XmlElementWrapper(name = "members", required = true)
661    @XmlElement(name = "member", required = false)
662    @WebResult(name = "members")
663    List<GroupMember> getMembersWithDate(List<String> groupIds,
664            @XmlJavaTypeAdapter(value = DateTimeAdapter.class) @WebParam(name="asOfDate") DateTime asOfDate) throws RiceIllegalArgumentException;
665
666    /**
667    *  Returns the list of group members who are currently active and futureActive .
668    * @param groupId Id of the Group object to get the members from
669    * @return list of group members
670    */
671    @WebMethod(operationName ="getCurrentAndFutureMembers")
672    List<GroupMember> getCurrentAndFutureMembers(@WebParam(name="groupId")String groupId);
673}