Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KimRoleTypeService |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2007-2008 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.service.support; | |
17 | ||
18 | import java.util.List; | |
19 | ||
20 | import org.kuali.rice.kim.bo.role.dto.RoleMembershipInfo; | |
21 | import org.kuali.rice.kim.bo.types.dto.AttributeSet; | |
22 | ||
23 | /** | |
24 | * This is a service interface that must be used for a service related to a role type. | |
25 | * | |
26 | * Is it used to interpret the qualifiers which may be attached. | |
27 | * | |
28 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
29 | * | |
30 | */ | |
31 | public interface KimRoleTypeService extends KimTypeService { | |
32 | ||
33 | ||
34 | /** Return whether a role assignment with the given qualifier is applicable for the given qualification. | |
35 | * | |
36 | * For example, the qualifier for a role could be as follows: | |
37 | * chartOfAccountsCode = BL | |
38 | * organizationCode = ARSC | |
39 | * descendsHierarchy = true | |
40 | * | |
41 | * The qualification could be: | |
42 | * chartOfAccountsCode = BL | |
43 | * organizationCode = PSY (reports to BL-ARSC) | |
44 | * | |
45 | * This method would return true for this set of arguments. This would require a query of | |
46 | * the KFS organization hierarchy, so an implementation of this sort must be done by | |
47 | * a service which lives within KFS and will be called remotely by KIM. | |
48 | * | |
49 | * The contents of the passed in attribute sets should not be modified as they may be used in future calls by | |
50 | * the role service. | |
51 | */ | |
52 | boolean doesRoleQualifierMatchQualification( AttributeSet qualification, AttributeSet roleQualifier ); | |
53 | ||
54 | /** Same as {@link #doesRoleQualifierMatchQualification(AttributeSet, AttributeSet)} except that it takes a list of qualifiers to check. | |
55 | */ | |
56 | List<RoleMembershipInfo> doRoleQualifiersMatchQualification( AttributeSet qualification, List<RoleMembershipInfo> roleMemberList ); | |
57 | ||
58 | /** | |
59 | * Returns true if this role type represents an "application" role type. That is, the members of the | |
60 | * role are known to the host application, not to KIM. This is needed for cases like the KFS | |
61 | * Fiscal Officer, where the members of the role are in the Account table in the KFS database. | |
62 | */ | |
63 | boolean isApplicationRoleType(); | |
64 | ||
65 | /** | |
66 | * Returns a list of principal IDs corresponding to the given application role. These principal IDs | |
67 | * would be returned from the implementing application. | |
68 | * | |
69 | * Continuing the example from {@link #isApplicationRoleType()}, the qualification in that case would be | |
70 | * a chart code and account number. This service would use that information to retrieve the Fiscal Officer | |
71 | * from the account table. | |
72 | * | |
73 | * The contents of the passed in attribute sets should not be modified as they may be used in future calls by | |
74 | * the role service. | |
75 | * | |
76 | * @see #isApplicationRoleType() | |
77 | */ | |
78 | List<RoleMembershipInfo> getRoleMembersFromApplicationRole( String namespaceCode, String roleName, AttributeSet qualification ); | |
79 | ||
80 | /** | |
81 | * This method can be used to check if the given principal has this application role. It is designed to be used in case | |
82 | * there is a more efficient way to check for whether a principal is in a role rather than retrieving all the | |
83 | * members of the role and checking against that. | |
84 | * | |
85 | * The groupIds parameter is intended to be the complete list of groups to which the principal belongs. If either the | |
86 | * principalId or the groupIds parameters are blank/empty, that parameter should be ignored. | |
87 | * | |
88 | * @see #isApplicationRoleType() | |
89 | * @see #getRoleMembersFromApplicationRole(String, String, AttributeSet) | |
90 | */ | |
91 | boolean hasApplicationRole( String principalId, List<String> groupIds, String namespaceCode, String roleName, AttributeSet qualification ); | |
92 | ||
93 | /** | |
94 | * For roles where the order of members returned may be meaningful, | |
95 | * this method provides a hook to sort the results before they | |
96 | * are returned from getRoleMembers on the RoleService. | |
97 | * | |
98 | * This method may alter the passed in list directly and return it rather than | |
99 | * allocating a new list. | |
100 | * | |
101 | * This is also the place where the roleSortingCode property on the RoleMembershipInfo objects can be | |
102 | * populated in preparation for routing if not all members of this role should be group as separate | |
103 | * units for routing. | |
104 | */ | |
105 | List<RoleMembershipInfo> sortRoleMembers( List<RoleMembershipInfo> roleMembers ); | |
106 | ||
107 | /** | |
108 | * Takes the passed in qualifications and converts them, if necessary, for any downstream roles which may be present. | |
109 | */ | |
110 | AttributeSet convertQualificationForMemberRoles( String namespaceCode, String roleName, String memberRoleNamespaceCode, String memberRoleName, AttributeSet qualification ); | |
111 | ||
112 | /** | |
113 | * Called by the role service when it is notified that a principal has been inactivated. Can be used | |
114 | * to perform local data cleanup by application roles. | |
115 | */ | |
116 | void principalInactivated( String principalId, String namespaceCode, String roleName ); | |
117 | ||
118 | /** | |
119 | * Determines if the role specified by the given namespace and role name should have membership queries cached | |
120 | * | |
121 | * @param namespaceCode the namespace code of the role to determine caching on | |
122 | * @param roleName the name of the role to determine caching on | |
123 | * @return true if the membership results of the Role should be cached, false otherwise | |
124 | */ | |
125 | boolean shouldCacheRoleMembershipResults(String namespaceCode, String roleName); | |
126 | ||
127 | /** For roles whose memberships may be matched exactly by qualifiers, | |
128 | * this method returns the list of such qualifiers | |
129 | * | |
130 | * @return list of qualifier names that can be used for exact match | |
131 | */ | |
132 | List<String> getQualifiersForExactMatch(); | |
133 | ||
134 | } |