View Javadoc

1   /**
2    * Copyright 2005-2012 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  package org.kuali.rice.kim.api.role;
17  
18  import org.kuali.rice.core.api.criteria.QueryByCriteria;
19  import org.kuali.rice.core.api.delegation.DelegationType;
20  import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
21  import org.kuali.rice.core.api.exception.RiceIllegalStateException;
22  import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
23  import org.kuali.rice.kim.api.KimApiConstants;
24  import org.kuali.rice.kim.api.common.delegate.DelegateMember;
25  import org.kuali.rice.kim.api.common.delegate.DelegateType;
26  import org.kuali.rice.kim.api.permission.Permission;
27  import org.kuali.rice.kim.api.responsibility.Responsibility;
28  import org.springframework.cache.annotation.CacheEvict;
29  import org.springframework.cache.annotation.Cacheable;
30  
31  import javax.jws.WebMethod;
32  import javax.jws.WebParam;
33  import javax.jws.WebResult;
34  import javax.jws.WebService;
35  import javax.jws.soap.SOAPBinding;
36  import javax.xml.bind.annotation.XmlElement;
37  import javax.xml.bind.annotation.XmlElementWrapper;
38  import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
39  import java.util.Collection;
40  import java.util.List;
41  import java.util.Map;
42  import java.util.Set;
43  
44  /**
45   *
46   * This service provides operations for querying role and role qualification
47   * data.
48   *
49   * <p>A role is where permissions and responsibilities are granted.  Roles have
50   * a membership consisting of principals, groups or even other roles.  By
51   * being assigned as members of a role, the associated principals will be
52   * granted all permissions and responsibilities that have been granted to the
53   * role.
54   *
55   * <p>Each membership assignment on the role can have a qualification which
56   * defines extra information about that particular member of the role.  For
57   * example, one may have the role of "Dean" but that can be further qualified
58   * by the school they are the dean of, such as "Dean of Computer Science".
59   * Authorization checks that are then done in the permission service can pass
60   * qualifiers as part of the operation if they want to restrict the subset of
61   * the role against which the check is made.
62   *
63   * @author Kuali Rice Team (rice.collab@kuali.org)
64   *
65   */
66  @WebService(name = "roleService", targetNamespace = KimApiConstants.Namespaces.KIM_NAMESPACE_2_0 )
67  @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
68  public interface RoleService {
69      /**
70       * This will create a {@link org.kuali.rice.kim.api.role.Role} exactly like the role passed in.
71       *
72       * @param role the role to create
73       * @return the newly created object.  will never be null.
74       * @throws RiceIllegalArgumentException if the role passed in is null
75       * @throws RiceIllegalStateException if the role is already existing in the system
76       */
77      @WebMethod(operationName="createRole")
78      @WebResult(name = "role")
79      @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME,  Role.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME}, allEntries = true)
80      Role createRole(@WebParam(name = "role") Role role)
81              throws RiceIllegalArgumentException, RiceIllegalStateException;
82  
83      /**
84       * This will update a {@link Role}.
85       *
86       * @param role the role to update
87       * @throws RiceIllegalArgumentException if the role is null
88       * @throws RiceIllegalStateException if the role does not exist in the system
89       */
90      @WebMethod(operationName="updateRole")
91      @WebResult(name = "role")
92      @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, Role.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME}, allEntries = true)
93      Role updateRole(@WebParam(name = "role") Role role)
94              throws RiceIllegalArgumentException, RiceIllegalStateException;
95  
96  	/**
97  	 * Get the KIM Role object with the given ID.
98  	 *
99       * @param id the id of the role.
100      * @return the role with the given id or null if role doesn't exist.
101      * @throws RiceIllegalArgumentException if roleId is null or Blank
102 	 */
103     @WebMethod(operationName = "getRole")
104     @WebResult(name = "role")
105     @Cacheable(value= Role.Cache.NAME, key="'id=' + #p0")
106     Role getRole(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
107 
108 	/**
109 	 * Get the KIM Role objects for the role IDs in the given List.
110      *
111      * @param ids the ids of the roles.
112      * @return a list of roles with the given ids or null if no roles are found.
113      * @throws RiceIllegalArgumentException if ids is null or Blank
114 	 */
115     @WebMethod(operationName = "getRoles")
116     @XmlElementWrapper(name = "roles", required = true)
117     @XmlElement(name = "role", required = false)
118     @WebResult(name = "roles")
119     @Cacheable(value= Role.Cache.NAME, key="'ids=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0)")
120 	List<Role> getRoles( @WebParam(name="ids") List<String> ids ) throws RiceIllegalArgumentException;
121 
122 	/** Get the KIM Role object with the unique combination of namespace, component,
123 	 * and role name.
124 	 *
125      * @param namespaceCode the namespace code of the role.
126      * @param name the name of the role.
127      * @return a role with the given namespace code and name or null if role does not exist.
128      * @throws RiceIllegalArgumentException if namespaceCode or name is null or blank.
129 	 */
130     @WebMethod(operationName = "getRoleByNamespaceCodeAndName")
131     @WebResult(name = "role")
132     @Cacheable(value=Role.Cache.NAME, key="'namespaceCode=' + #p0 + '|' + 'name=' + #p1")
133     Role getRoleByNamespaceCodeAndName(@WebParam(name = "namespaceCode") String namespaceCode,
134             @WebParam(name = "name") String name) throws RiceIllegalArgumentException;
135 
136 	/**
137 	 * Return the Role ID for the given unique combination of namespace,
138 	 * component and role name.
139      *
140      * @param namespaceCode the namespace code of the role.
141      * @param name the name of the role.
142      * @return a role id for a role with the given namespace code and name or null if role does not exist.
143      * @throws RiceIllegalArgumentException if namespaceCode or name is null or blank.
144 	 */
145     @WebMethod(operationName = "getRoleIdByNamespaceCodeAndName")
146     @WebResult(name = "roleId")
147     @Cacheable(value=Role.Cache.NAME, key="'{getRoleIdByNamespaceCodeAndName}' + 'namespaceCode=' + #p0 + '|' + 'name=' + #p1")
148 	String getRoleIdByNamespaceCodeAndName(@WebParam(name = "namespaceCode") String namespaceCode,
149             @WebParam(name = "name") String name) throws RiceIllegalArgumentException;
150 
151 	/**
152 	 * Checks whether the role with the given role ID is active.
153 	 *
154 	 * @param id the unique id of a role.
155 	 * @return true if the role with the given id is active.
156      * @throws RiceIllegalArgumentException if id is null or blank.
157 	 */
158     @WebMethod(operationName = "isRoleActive")
159     @WebResult(name = "isRoleActive")
160     @Cacheable(value=Role.Cache.NAME, key="'{isRoleActive}' + 'id=' + #p0")
161     boolean isRoleActive( @WebParam(name="id") String id ) throws RiceIllegalArgumentException;
162 
163     /**
164      * Returns a list of role qualifiers that the given principal has without taking into consideration
165      * that the principal may be a member via an assigned group or role.  Use in situations where
166      * you are only interested in the qualifiers that are directly assigned to the principal.
167      *
168      * @param principalId the principalId to
169      * @param roleIds the namespace code of the role.
170      * @param qualification the qualifications for the roleIds.
171      * @return a map of role qualifiers for the given principalId, roleIds and qualifications or an empty map if none found.
172      * @throws RiceIllegalArgumentException if principalId is null or blank or roleIds is null.
173      */
174     @WebMethod(operationName = "getRoleQualifersForPrincipalByRoleIds")
175     @XmlElementWrapper(name = "attributes", required = true)
176     @XmlElement(name = "attribute", required = false)
177     @WebResult(name = "attributes")
178     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
179     List<Map<String, String>> getRoleQualifersForPrincipalByRoleIds(@WebParam(name = "principalId") String principalId,
180             @WebParam(name = "roleIds") List<String> roleIds, @WebParam(name = "qualification") @XmlJavaTypeAdapter(
181             value = MapStringStringAdapter.class) Map<String, String> qualification)
182             throws RiceIllegalArgumentException;
183 
184     /**
185      * Returns a list of role qualifiers that the given principal has without taking into consideration
186      * that the principal may be a member via an assigned group or role.  Use in situations where
187      * you are only interested in the qualifiers that are directly assigned to the principal.
188      *
189      * @param principalId the principalId to
190      * @param namespaceCode the namespace code of the role.
191      * @param roleName the name of the role.
192      * @param qualification the qualifications for the roleIds.
193      * @return a map of role qualifiers for the given parameters or an empty map if none found.
194      * @throws RiceIllegalArgumentException if principalId, namespaceCode, or roleName is null or blank.
195      */
196     @WebMethod(operationName = "getRoleQualifersForPrincipalByNamespaceAndRolename")
197     @XmlElementWrapper(name = "attributes", required = true)
198     @XmlElement(name = "attribute", required = false)
199     @WebResult(name = "attributes")
200     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
201     List<Map<String, String>> getRoleQualifersForPrincipalByNamespaceAndRolename(
202             @WebParam(name = "principalId") String principalId, @WebParam(name = "namespaceCode") String namespaceCode,
203             @WebParam(name = "roleName") String roleName, @WebParam(name = "qualification") @XmlJavaTypeAdapter(
204             value = MapStringStringAdapter.class) Map<String, String> qualification)
205             throws RiceIllegalArgumentException;
206 
207     /**
208      * Returns a list of role qualifiers that the given principal.  If the principal's membership
209      * is via a group or role, that group or role's qualifier on the given role is returned.
210      *
211      * @param principalId the principalId to
212      * @param namespaceCode the namespace code of the role.
213      * @param roleName the name of the role.
214      * @param qualification the qualifications for the roleIds.
215      * @return a map of nested role qualifiers for the given parameters or an empty map if none found.
216      * @throws RiceIllegalArgumentException if principalId, namespaceCode, or roleName is null or blank.
217      */
218     @WebMethod(operationName = "getNestedRoleQualifersForPrincipalByNamespaceAndRolename")
219     @XmlElementWrapper(name = "attributes", required = true)
220     @XmlElement(name = "attribute", required = false)
221     @WebResult(name = "attributes")
222     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
223 	List<Map<String, String>> getNestedRoleQualifersForPrincipalByNamespaceAndRolename(
224             @WebParam(name = "principalId") String principalId, @WebParam(name = "namespaceCode") String namespaceCode,
225             @WebParam(name = "roleName") String roleName, @WebParam(name = "qualification") @XmlJavaTypeAdapter(
226             value = MapStringStringAdapter.class) Map<String, String> qualification)
227             throws RiceIllegalArgumentException;
228 
229     /**
230      * Returns a list of role qualifiers that the given principal.  If the principal's membership
231      * is via a group or role, that group or role's qualifier on the given role is returned.
232      *
233      * @param principalId the principalId to
234      * @param roleIds the namespace code of the role.
235      * @param qualification the qualifications for the roleIds.
236      * @return a map of role qualifiers for the given roleIds and qualifications or an empty map if none found.
237      * @throws RiceIllegalArgumentException if principalId, namespaceCode, or roleName is null or blank.
238      */
239     @WebMethod(operationName = "getNestedRoleQualifiersForPrincipalByRoleIds")
240     @XmlElementWrapper(name = "attributes", required = true)
241     @XmlElement(name = "attribute", required = false)
242     @WebResult(name = "attributes")
243     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
244 	List<Map<String, String>> getNestedRoleQualifiersForPrincipalByRoleIds(
245             @WebParam(name = "principalId") String principalId, @WebParam(name = "roleIds") List<String> roleIds,
246             @WebParam(name = "qualification") @XmlJavaTypeAdapter(
247                     value = MapStringStringAdapter.class) Map<String, String> qualification)
248             throws RiceIllegalArgumentException;
249 
250 
251     // --------------------
252     // Role Membership Checks
253     // --------------------
254 
255     /**
256      * Get all the role members (groups and principals) associated with the given list of roles
257      * where their role membership/assignment matches the given qualification.  The list of RoleMemberships returned
258      * will only contain group and principal members.  Any nested role members will be resolved and flattened into
259      * the principals and groups that are members of that nested role (assuming qualifications match).
260      *
261      * The return object will have each membership relationship along with the delegations
262      *
263      * @param roleIds a list of role Ids.
264      * @param qualification the qualifications for the roleIds.
265      * @return a list of role members for the given roleIds and qualifications or an empty list if none found.
266      * @throws RiceIllegalArgumentException if roleIds is null.
267      */
268     @WebMethod(operationName = "getRoleMembers")
269     @XmlElementWrapper(name = "roleMemberships", required = true)
270     @XmlElement(name = "roleMembership", required = false)
271     @WebResult(name = "roleMemberships")
272     @Cacheable(value= RoleMember.Cache.NAME,
273                key="'roleIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0) + '|' + 'qualification=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).mapKey(#p1)",
274                condition="!T(org.kuali.rice.kim.api.cache.KimCacheUtils).isDynamicRoleMembership(#p0)" )
275     List<RoleMembership> getRoleMembers(
276                 @WebParam(name="roleIds")
277                 List<String> roleIds,
278                 @WebParam(name="qualification")
279                 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
280                 Map<String, String> qualification )
281             throws RiceIllegalArgumentException;
282 
283     /**
284 	 * This method gets all the members, then traverses down into members of type role and group to obtain the nested principal ids
285 	 *
286      * @param namespaceCode the namespace code of the role.
287      * @param roleName the name of the role
288      * @param qualification the qualifications for the roleIds.
289      * @return a list of role member principalIds for the given roleIds and qualifications, or an empty list if none found.
290      * @throws RiceIllegalArgumentException if namespaceCode, or roleName is null or blank.
291 	 */
292     @WebMethod(operationName = "getRoleMemberPrincipalIds")
293     @XmlElementWrapper(name = "principalIds", required = true)
294     @XmlElement(name = "principalId", required = false)
295     @WebResult(name = "principalIds")
296     @Cacheable(value= RoleMember.Cache.NAME,
297                key="'namespaceCode=' + #p0 + '|' + 'roleName=' + #p1 + '|' + 'qualification=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).mapKey(#p2)",
298                condition="!T(org.kuali.rice.kim.api.cache.KimCacheUtils).isDynamicMembshipRoleByNamespaceAndName(#p0, #p1)" )
299     Collection<String> getRoleMemberPrincipalIds(@WebParam(name="namespaceCode") String namespaceCode,
300                 @WebParam(name="roleName") String roleName,
301                 @WebParam(name="qualification")
302                 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
303                 Map<String, String> qualification)
304             throws RiceIllegalArgumentException;
305 
306     /**
307      * Returns whether the given principal has any of the passed role IDs with the given qualification.
308      *
309      * @param principalId the principal Id to check.
310      * @param roleIds the list of role ids.
311      * @param qualification the qualifications for the roleIds.
312      * @return true if the principal is assigned the one of the given roleIds with the passed in qualifications.
313      * @throws RiceIllegalArgumentException if roleIds is null or principalId is null or blank.
314      */
315     @WebMethod(operationName = "principalHasRole")
316     @WebResult(name = "principalHasRole")
317     @Cacheable(value= RoleMember.Cache.NAME,
318                key="'{principalHasRole}' + 'principalId=' + #p0 + '|' + 'roleIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p1) + '|' + 'qualification=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).mapKey(#p2) + '|' + 'checkDelegations=true'",
319                condition="!T(org.kuali.rice.kim.api.cache.KimCacheUtils).isDynamicRoleMembership(#p1)" )
320     boolean principalHasRole( @WebParam(name="principalId") String principalId,
321             @WebParam(name="roleIds") List<String> roleIds,
322             @WebParam(name="qualification") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification )
323             throws RiceIllegalArgumentException;
324     
325     /**
326      * Returns whether the given principal has any of the passed role IDs with the given qualification.
327      *
328      * @param principalId the principal Id to check.
329      * @param roleIds the list of role ids.
330      * @param qualification the qualifications for the roleIds.
331      * @param checkDelegations whether delegations should be checked or not
332      * @return true if the principal is assigned the one of the given roleIds with the passed in qualifications.
333      * @throws RiceIllegalArgumentException if roleIds is null or principalId is null or blank.
334      * @since 2.1.1
335      */
336     @WebMethod(operationName = "principalHasRoleCheckDelegation")
337     @WebResult(name = "principalHasRoleCheckDelegation")
338     @Cacheable(value= RoleMember.Cache.NAME,
339                key="'{principalHasRole}' + 'principalId=' + #p0 + '|' + 'roleIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p1) + '|' + 'qualification=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).mapKey(#p2) + '|' + 'checkDelegations=' + #p3",
340                condition="!T(org.kuali.rice.kim.api.cache.KimCacheUtils).isDynamicRoleMembership(#p1)" )
341     boolean principalHasRole( @WebParam(name="principalId") String principalId,
342             @WebParam(name="roleIds") List<String> roleIds,
343             @WebParam(name="qualification") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification, boolean checkDelegations)
344             throws RiceIllegalArgumentException;
345 
346     /**
347      * Returns the subset of the given principal ID list which has the given role and qualification.
348      * This is designed to be used by lookups of people by their roles.
349      *
350      * @param principalIds the principal Ids to check.
351      * @param roleNamespaceCode the namespaceCode of the role.
352      * @param roleName the name of the role.
353      * @param qualification the qualifications for the roleIds.
354      * @return list of principalIds that is the subset of list passed in with the given role and qualifications or an empty list.
355      * @throws RiceIllegalArgumentException if principalIds is null or the roleNamespaceCode or roleName is null or blank.
356      */
357     @WebMethod(operationName = "getPrincipalIdSubListWithRole")
358     @XmlElementWrapper(name = "principalIds", required = true)
359     @XmlElement(name = "principalId", required = false)
360     @WebResult(name = "principalIds")
361     @Cacheable(value= RoleMember.Cache.NAME,
362                key="'getPrincipalIdSubListWithRole' + 'principalIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0) + '|' + 'roleNamespaceCode=' + #p1 + '|' + 'roleName=' + #p2 + '|' + 'qualification=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).mapKey(#p3)",
363             condition="!T(org.kuali.rice.kim.api.cache.KimCacheUtils).isDynamicMembshipRoleByNamespaceAndName(#p1, #p2)" )
364             List<String> getPrincipalIdSubListWithRole( @WebParam(name="principalIds") List<String> principalIds,
365             @WebParam(name="roleNamespaceCode") String roleNamespaceCode,
366             @WebParam(name="roleName") String roleName,
367             @WebParam(name="qualification") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualification )
368             throws RiceIllegalArgumentException;
369 
370     /**
371 	 *
372 	 * This method gets search results for role lookup
373      *
374      * @param queryByCriteria the qualifications for the roleIds.
375      * @return query results.  will never return null.
376      * @throws RiceIllegalArgumentException if queryByCriteria is null.
377 	 */
378     @WebMethod(operationName = "getRolesSearchResults")
379     @WebResult(name = "results")
380 	RoleQueryResults findRoles(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
381 
382 
383 
384     /**
385      * Gets all direct members of the roles that have ids within the given list
386      * of role ids.  This method does not recurse into any nested roles.
387      *
388      *  <p>The resulting List of role membership will contain membership for
389      *  all the roles with the specified ids.  The list is not guaranteed to be
390      *  in any particular order and may have membership info for the
391      *  different roles interleaved with each other.
392      *
393      * @param roleIds a list of  role Ids.
394      * @return list of RoleMembership that contains membership for the specified roleIds or empty list if none found.
395      * @throws RiceIllegalArgumentException if roleIds is null.
396      */
397     @WebMethod(operationName = "getFirstLevelRoleMembers")
398     @XmlElementWrapper(name = "roleMemberships", required = true)
399     @XmlElement(name = "roleMembership", required = false)
400     @WebResult(name = "roleMemberships")
401     @Cacheable(value=RoleMembership.Cache.NAME, key="'roleIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0)")
402 	List<RoleMembership> getFirstLevelRoleMembers(
403                 @WebParam(name="roleIds") List<String> roleIds) throws RiceIllegalArgumentException;
404 
405 	/**
406 	 * Gets role member information based on the given search criteria.
407      *
408      * @param queryByCriteria the qualifications for the roleIds.
409      * @return query results.  will never return null.
410      * @throws RiceIllegalArgumentException if queryByCriteria is null.
411 	 */
412     @WebMethod(operationName = "findRoleMemberships")
413     @WebResult(name = "results")
414 	RoleMembershipQueryResults findRoleMemberships(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
415 
416 	/**
417 	 * Gets a list of Roles that the given member belongs to.
418      *
419      * @param memberType the role member type.
420      * @param memberId the role member id (principalId, roleId, groupId).
421      * @return list of RoleMembership that contains membership for the specified roleIds or an empty list if none found.
422      * @throws RiceIllegalArgumentException if memberType or memberId is null or blank.
423 	 */
424     @WebMethod(operationName = "getMemberParentRoleIds")
425     @XmlElementWrapper(name = "roleIds", required = true)
426     @XmlElement(name = "roleId", required = false)
427     @WebResult(name = "roleIds")
428     @Cacheable(value=RoleMembership.Cache.NAME, key="'memberType=' + #p0 + '|' + 'memberId=' + #p1")
429 	List<String> getMemberParentRoleIds(String memberType, String memberId) throws RiceIllegalArgumentException;
430 
431 
432     /**
433      * Gets role members based on the given search criteria.
434      *
435      * @param queryByCriteria the qualifications for the roleIds.
436      * @return query results.  will never return null.
437      * @throws RiceIllegalArgumentException if queryByCriteria is null.
438      */
439     @WebMethod(operationName = "findRoleMembers")
440     @WebResult(name = "results")
441 	RoleMemberQueryResults findRoleMembers(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
442 
443 
444     /**
445      * Gets a list of Roles Ids that are a member of the given roleId, including nested membership.
446      *
447      * @param roleId the role id.
448      * @return list of RoleIds that are members of the given role or and empty list if none found.
449      * @throws RiceIllegalArgumentException if roleId is null or blank.
450      */
451     @WebMethod(operationName = "getRoleTypeRoleMemberIds")
452     @XmlElementWrapper(name = "memberIds", required = true)
453     @XmlElement(name = "memberId", required = false)
454     @WebResult(name = "memberIds")
455     @Cacheable(value=RoleMember.Cache.NAME, key="'{getRoleTypeRoleMemberIds}' + 'roleId=' + #p0")
456     Set<String> getRoleTypeRoleMemberIds(@WebParam(name = "roleId") String roleId) throws RiceIllegalArgumentException;
457 
458 
459     /**
460      * Gets role members based on the given search criteria.
461      *
462      * @param queryByCriteria the qualifications for the roleIds.
463      * @return query results.  will never return null.
464      * @throws RiceIllegalArgumentException if queryByCriteria is null.
465      */
466     @WebMethod(operationName = "findDelegateMembers")
467     @WebResult(name = "results")
468     DelegateMemberQueryResults findDelegateMembers(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
469 
470 	/**
471 	 * Gets the delegate members for the given delegation.
472      *
473      * @param delegateId the delegate id.
474      * @return list of delegate members that are members of the given delegation or an empty list if none found.
475      * @throws RiceIllegalArgumentException if delegationId is null or blank.
476 	 */
477     @WebMethod(operationName = "getDelegationMembersByDelegationId")
478     @XmlElementWrapper(name = "delegateMembers", required = true)
479     @XmlElement(name = "delegateMember", required = false)
480     @WebResult(name = "delegateMembers")
481     @Cacheable(value=DelegateMember.Cache.NAME, key="'delegateId=' + #p0")
482     List<DelegateMember> getDelegationMembersByDelegationId(
483             @WebParam(name = "delegateId") String delegateId) throws RiceIllegalArgumentException;
484 
485 
486     /**
487      * Gets the delegate member for the given delegationId and memberId.
488      *
489      * @param delegationId the delegate id.
490      * @param memberId the member id matching the DelegateMember
491      * @return the delegate member with the given parameters or null if not found.
492      * @throws RiceIllegalArgumentException if delegationId or memberId is null or blank.
493      */
494     @WebMethod(operationName = "getDelegationMemberByDelegationAndMemberId")
495     @WebResult(name = "delegateMember")
496     @Cacheable(value=DelegateMember.Cache.NAME, key="'delegationId=' + #p0 + '|' + 'memberId=' + #p1")
497     DelegateMember getDelegationMemberByDelegationAndMemberId(
498             @WebParam(name = "delegationId") String delegationId, @WebParam(name = "memberId") String memberId) throws RiceIllegalArgumentException;
499 
500 
501     /**
502      * Gets the delegate member with the given delegation member id.
503      *
504      * @param id the member id matching the DelegateMember
505      * @return the delegate member with the given parameters or null if not found.
506      * @throws RiceIllegalArgumentException if delegationId or memberId is null or blank.
507      */
508     @WebMethod(operationName = "getDelegationMemberById")
509     @WebResult(name = "delegateMember")
510     @Cacheable(value=DelegateMember.Cache.NAME, key="'id=' + #p0")
511     DelegateMember getDelegationMemberById(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
512 
513 
514     /**
515      * Gets a list of role reponsibilities for the given role id.
516      *
517      * @param roleId the role Id.
518      * @return a list of RoleResponsibilities for the given role Id, or an empty list if none found.
519      * @throws RiceIllegalArgumentException if roleId is null or blank.
520      */
521     @WebMethod(operationName = "getRoleResponsibilities")
522     @XmlElementWrapper(name = "roleResponsibilities", required = true)
523     @XmlElement(name = "roleResponsibility", required = false)
524     @WebResult(name = "roleResponsibilities")
525     @Cacheable(value=RoleResponsibility.Cache.NAME, key="'roleId=' + #p0")
526 	List<RoleResponsibility> getRoleResponsibilities(@WebParam(name="roleId") String roleId)  throws RiceIllegalArgumentException;
527 
528 
529     /**
530      * Gets a list of RoleResponsibilityActions for the given role member id.
531      *
532      * @param roleMemberId the role member Id.
533      * @return a list of RoleResponsibilityActions for the given role member Id, or an empty list if none found.
534      * @throws RiceIllegalArgumentException if roleMemberId is null or blank.
535      */
536     @WebMethod(operationName = "getRoleMemberResponsibilityActions")
537     @XmlElementWrapper(name = "roleResponsibilityActions", required = true)
538     @XmlElement(name = "roleResponsibilityAction", required = false)
539     @WebResult(name = "roleResponsibilityActions")
540     @Cacheable(value=RoleResponsibility.Cache.NAME, key="'roleMemberId=' + #p0")
541 	List<RoleResponsibilityAction> getRoleMemberResponsibilityActions(
542             @WebParam(name = "roleMemberId") String roleMemberId)  throws RiceIllegalArgumentException;
543 
544 
545     /**
546      * Gets a DelegateType for the given role id and delegation type.
547      *
548      * @param roleId the role Id.
549      * @param delegateType type of delegation
550      * @return the DelegateType for the given role Id and delegationType, or null if none found.
551      * @throws RiceIllegalArgumentException if roleId or delegationType is null or blank.
552      */
553     @WebMethod(operationName = "getDelegateTypeByRoleIdAndDelegateTypeCode")
554     @WebResult(name = "delegateType")
555     @Cacheable(value=DelegateType.Cache.NAME, key="'roleId=' + #p0 + '|' + 'delegateType=' + #p1")
556     DelegateType getDelegateTypeByRoleIdAndDelegateTypeCode(@WebParam(name = "roleId") String roleId,
557             @WebParam(name = "delegateType") DelegationType delegateType)  throws RiceIllegalArgumentException;
558 
559 
560     /**
561      * Gets a DelegateType for the given delegation id.
562      *
563      * @param delegationId the id of delegation
564      * @return the DelegateType for the given delegation Id, or null if none found.
565      * @throws RiceIllegalArgumentException if delegationId is null or blank.
566      */
567     @WebMethod(operationName = "getDelegateTypeByDelegationId")
568     @WebResult(name = "delegateType")
569     @Cacheable(value=DelegateType.Cache.NAME, key="'delegationId=' + #p0")
570     DelegateType getDelegateTypeByDelegationId(@WebParam(name = "delegationId") String delegationId)  throws RiceIllegalArgumentException;
571 
572     /**
573 	 * Assigns the principal with the given id to the role with the specified
574 	 * namespace code and name with the supplied set of qualifications.
575      *
576      * @param principalId the principalId
577      * @param namespaceCode the namespaceCode of the Role
578      * @param roleName the name of the role
579      * @param qualifications the qualifications for the principalId to be assigned to the role
580      * @return newly created/assigned RoleMember.
581      * @throws RiceIllegalArgumentException if princialId, namespaceCode or roleName is null or blank.
582 	 */
583     @WebMethod(operationName = "assignPrincipalToRole")
584     @WebResult(name = "roleMember")
585     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
586     RoleMember assignPrincipalToRole(@WebParam(name="principalId") String principalId,
587                 @WebParam(name="namespaceCode")
588                 String namespaceCode,
589                 @WebParam(name="roleName")
590                 String roleName,
591                 @WebParam(name="qualifications")
592                 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
593                 Map<String, String> qualifications)
594             throws RiceIllegalArgumentException;
595 
596 	/**
597 	 * Assigns the group with the given id to the role with the specified
598 	 * namespace code and name with the supplied set of qualifications.
599      *
600      * @param groupId the groupId
601      * @param namespaceCode the namespaceCode of the Role
602      * @param roleName the name of the role
603      * @param qualifications the qualifications for the principalId to be assigned to the role
604      * @return newly created/assigned RoleMember.
605      * @throws RiceIllegalArgumentException if groupId, namespaceCode or roleName is null or blank.
606 	 */
607     @WebMethod(operationName = "assignGroupToRole")
608     @WebResult(name = "roleMember")
609     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
610     RoleMember assignGroupToRole(@WebParam(name="groupId") String groupId,
611     		@WebParam(name="namespaceCode") String namespaceCode,
612     		@WebParam(name="roleName") String roleName,
613     		@WebParam(name="qualifications") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualifications)
614             throws RiceIllegalArgumentException;
615 
616 	/**
617 	 * Assigns the role with the given id to the role with the specified
618 	 * namespace code and name with the supplied set of qualifications.
619      *
620      * @param roleId the roleId
621      * @param namespaceCode the namespaceCode of the Role
622      * @param roleName the name of the role
623      * @param qualifications the qualifications for the principalId to be assigned to the role
624      * @return newly created/assigned RoleMember.
625      * @throws RiceIllegalArgumentException if princiapId, namespaceCode or roleName is null or blank.
626 	 */
627     @WebMethod(operationName = "assignRoleToRole")
628     @WebResult(name = "roleMember")
629     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
630     RoleMember assignRoleToRole(@WebParam(name="roleId") String roleId,
631     		@WebParam(name="namespaceCode") String namespaceCode,
632     		@WebParam(name="roleName") String roleName,
633     		@WebParam(name="qualifications") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualifications)
634             throws RiceIllegalArgumentException;
635 
636 	/**
637 	 * Creates a new RoleMember.  Needs to be passed a valid RoleMember object that does not currently exist.
638      *
639      * @param roleMember the new RoleMember to save.
640      * @return RoleMember as created.
641      * @throws RiceIllegalArgumentException if roleMember is null.
642      * @throws RiceIllegalStateException if roleMember already exists.
643 	 */
644     @WebMethod(operationName = "createRoleMember")
645     @WebResult(name = "roleMember")
646     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
647     RoleMember createRoleMember(
648                 @WebParam(name = "roleMember")
649                 RoleMember roleMember) throws RiceIllegalArgumentException, RiceIllegalStateException;
650 
651     /**
652 	 * Updates the given roleMember to the values in the passed in roleMember
653      *
654      * @param roleMember the new RoleMember to save.
655      * @return RoleMember as updated.
656      * @throws RiceIllegalArgumentException if roleMember is null.
657      * @throws RiceIllegalStateException if roleMember does not yet exist.
658 	 */
659     @WebMethod(operationName = "updateRoleMember")
660     @WebResult(name = "roleMember")
661     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
662     RoleMember updateRoleMember(@WebParam(name = "roleMember") RoleMember roleMember) throws RiceIllegalArgumentException, RiceIllegalStateException;
663 
664     /**
665      * Updates the given delegateMember to the values in the passed in delegateMember
666      *
667      * @param delegateMember the new DelegateMember to save.
668      * @return DelegateMember as updated.
669      * @throws RiceIllegalArgumentException if delegateMember is null.
670      * @throws RiceIllegalStateException if delegateMember does not yet exist.
671      */
672     @WebMethod(operationName = "updateDelegateMember")
673     @WebResult(name = "delegateMember")
674     @CacheEvict(value={Role.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
675     DelegateMember updateDelegateMember(@WebParam(name = "delegateMember") DelegateMember delegateMember) throws RiceIllegalArgumentException, RiceIllegalStateException;
676 
677     /**
678      * Creates a new DelegateMember.  Needs to be passed a valid DelegateMember object that does not currently exist.
679      *
680      * @param delegateMember the new DelegateMember to save.
681      * @return DelegateMember as created.
682      * @throws RiceIllegalArgumentException if delegateMember is null.
683      * @throws RiceIllegalStateException if delegateMember already exists.
684      */
685     @WebMethod(operationName = "createDelegateMember")
686     @WebResult(name = "delegateMember")
687     @CacheEvict(value={Role.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
688     DelegateMember createDelegateMember(
689             @WebParam(name = "delegateMember")
690             DelegateMember delegateMember) throws RiceIllegalArgumentException, RiceIllegalStateException;
691 
692     /**
693      * Removes existing DelegateMembers.  Needs to be passed DelegateMember objects.
694      *
695      * @param  DelegateMembers to remove.
696      * @throws RiceIllegalArgumentException if delegateMember is null.
697      */
698     @WebMethod(operationName = "removeDelegateMembers")
699     @CacheEvict(value={Role.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
700     void removeDelegateMembers(
701             @WebParam(name = "delegateMembers")
702             List<DelegateMember> delegateMembers) throws RiceIllegalArgumentException, RiceIllegalStateException;
703 
704     /**
705      * Creates a new RoleResponsibilityAction.  Needs to be passed a valid RoleResponsibilityAction
706      * object that does not currently exist.
707      *
708      * @param roleResponsibilityAction the new RoleResponsibilityAction to save.
709      * @return RoleResponsibilityAction as created.
710      * @throws RiceIllegalArgumentException if roleResponsibilityAction is null.
711      * @throws RiceIllegalStateException if roleResponsibilityAction already exists.
712      */
713     @WebMethod(operationName = "createRoleResponsibilityAction")
714     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
715     RoleResponsibilityAction createRoleResponsibilityAction(@WebParam(name = "roleResponsibilityAction") RoleResponsibilityAction roleResponsibilityAction) throws RiceIllegalArgumentException;
716 
717     /**
718      * Creates a new DelegateType.  Needs to be passed a valid DelegateType
719      * object that does not currently exist.
720      *
721      * @param delegateType the new DelegateType to save.
722      * @return DelegateType as created.
723      * @throws RiceIllegalArgumentException if delegateType is null.
724      * @throws RiceIllegalStateException if delegateType already exists.
725      */
726     @WebMethod(operationName = "createDelegateType")
727     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
728     DelegateType createDelegateType(@WebParam(name="delegateType") DelegateType delegateType) throws RiceIllegalArgumentException, RiceIllegalStateException;
729 
730     /**
731      * Updates the given DelegateType to the values in the passed in delegateType
732      *
733      * @param delegateType the new DelegateType to save.
734      * @return DelegateType as updated.
735      * @throws RiceIllegalArgumentException if delegateType is null.
736      * @throws RiceIllegalStateException if delegateType does not yet exist.
737      */
738     @WebMethod(operationName = "updateDelegateType")
739     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
740     DelegateType updateDelegateType(@WebParam(name="delegateType") DelegateType delegateType) throws RiceIllegalArgumentException, RiceIllegalStateException;
741 
742     /**
743      * Remove the principal with the given id and qualifications from the role
744      * with the specified namespace code and role name.
745      *
746      * @param principalId the principalId
747      * @param namespaceCode the namespaceCode of the Role
748      * @param roleName the name of the role
749      * @param qualifications the qualifications for the principalId to be assigned to the role
750      * @return void.
751      * @throws RiceIllegalArgumentException if principalId, namespaceCode or roleName is null or blank.
752      */
753     @WebMethod(operationName = "removePrincipalFromRole")
754     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
755     void removePrincipalFromRole(@WebParam(name="principalId") String principalId,
756     		@WebParam(name="namespaceCode") String namespaceCode,
757     		@WebParam(name="roleName") String roleName,
758     		@WebParam(name="qualifications") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualifications) throws RiceIllegalArgumentException;
759 
760     /**
761      * Remove the group with the given id and qualifications from the role
762      * with the specified namespace code and role name.
763      *
764      * @param groupId the groupId
765      * @param namespaceCode the namespaceCode of the Role
766      * @param roleName the name of the role
767      * @param qualifications the qualifications for the principalId to be assigned to the role
768      * @return void.
769      * @throws RiceIllegalArgumentException if groupId, namespaceCode or roleName is null or blank.
770      */
771     @WebMethod(operationName = "removeGroupFromRole")
772     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
773     void removeGroupFromRole(@WebParam(name="groupId") String groupId,
774     		@WebParam(name="namespaceCode") String namespaceCode,
775     		@WebParam(name="roleName") String roleName,
776     		@WebParam(name="qualifications") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualifications) throws RiceIllegalArgumentException;
777 
778     /**
779      * Remove the group with the given id and qualifications from the role
780      * with the specified namespace code and role name.
781      *
782      * @param roleId the roleId
783      * @param namespaceCode the namespaceCode of the Role
784      * @param roleName the name of the role
785      * @param qualifications the qualifications for the principalId to be assigned to the role
786      * @return void.
787      * @throws RiceIllegalArgumentException if roleId, namespaceCode or roleName is null or blank.
788      */
789     @WebMethod(operationName = "removeRoleFromRole")
790     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
791     void removeRoleFromRole(@WebParam(name="roleId") String roleId,
792     		@WebParam(name="namespaceCode") String namespaceCode,
793     		@WebParam(name="roleName") String roleName,
794     		@WebParam(name="qualifications") @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) Map<String, String> qualifications) throws RiceIllegalArgumentException;
795 
796     /**
797      * Assigns the given permission to the given role
798      *
799      * @param permissionId the permissionId
800      * @param roleId the roleId
801      * @return void.
802      * @throws RiceIllegalArgumentException if permissionId or roleId is null or blank.
803      */
804     @WebMethod(operationName = "assignPermissionToRole")
805     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
806     void assignPermissionToRole(
807             @WebParam(name = "permissionId") String permissionId,
808             @WebParam(name = "roleId") String roleId)
809             throws RiceIllegalArgumentException;
810 
811     /**
812      * Removes the given permission to the given role
813      *
814      * @param permissionId the permissionId
815      * @param roleId the roleId
816      * @return void.
817      * @throws RiceIllegalArgumentException if permissionId or roleId is null or blank.
818      */
819     @WebMethod(operationName = "revokePermissionFromRole")
820     @CacheEvict(value={Permission.Cache.NAME, Responsibility.Cache.NAME, RoleMembership.Cache.NAME, RoleMember.Cache.NAME, DelegateMember.Cache.NAME, RoleResponsibility.Cache.NAME, DelegateType.Cache.NAME }, allEntries = true)
821     void revokePermissionFromRole(
822             @WebParam(name = "permissionId") String permissionId,
823             @WebParam(name = "roleId") String roleId)
824             throws RiceIllegalArgumentException;
825 
826 
827     /**
828      * Determines if a role with a provided id is a derived role
829      *
830      * @since 2.1.1
831      * @param roleId the roleId
832      * @return true if role is a derived role
833      * @throws RiceIllegalArgumentException if roleId is null or blank.
834      */
835     @WebMethod(operationName = "isDerivedRole")
836     @WebResult(name = "isDerivedRole")
837     @Cacheable(value= Role.Cache.NAME, key="'{isDerivedRole}' + 'roleId=' + #p0")
838     boolean isDerivedRole(@WebParam(name = "roleId") String roleId) throws RiceIllegalArgumentException;
839 
840     /**
841      * Determines if a role with a provided id is a uses dynamic role memberships
842      *
843      * @since 2.1.1
844      * @param roleId the roleId
845      * @return true if role uses dynamic memberships
846      * @throws RiceIllegalArgumentException if roleId is null or blank.
847      */
848     @WebMethod(operationName = "isDynamicRoleMembership")
849     @WebResult(name = "isDynamicRoleMembership")
850     @Cacheable(value= Role.Cache.NAME, key="'{isDynamicRoleMembership}' + 'roleId=' + #p0")
851     boolean isDynamicRoleMembership(@WebParam(name = "roleId") String roleId) throws RiceIllegalArgumentException;
852 }