1 /**
2 * Copyright 2004-2013 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.kpme.core.service.role;
17
18 import java.util.List;
19 import java.util.Map;
20
21 import org.joda.time.DateTime;
22 import org.kuali.rice.kim.api.role.RoleMember;
23 import org.springframework.cache.annotation.Cacheable;
24
25 public interface KPMERoleService {
26
27 /**
28 * Checks whether the given {@code principalId} has the role {@code roleName}.
29 *
30 * @param principalId The person to check the role for
31 * @param namespaceCode The namespace of the role
32 * @param roleName The name of the role
33 * @param asOfDate The effective date of the role
34 *
35 * @return true if {@code principalId} has the role {@code roleName}, false otherwise.
36 */
37 @Cacheable(value=RoleMember.Cache.NAME, key="'{principalHasRole}' + 'principal=' + #p0 + '|' + 'namespace=' + #p1 + '|' + 'roleName=' + #p2 + '|' + 'asOfDate=' + #p3")
38 boolean principalHasRole(String principalId, String namespaceCode, String roleName, DateTime asOfDate);
39
40 /**
41 * Checks whether the given {@code principalId} has the role {@code roleName} depending on the given role qualifications.
42 *
43 * @param principalId The person to check the role for
44 * @param namespaceCode The namespace of the role
45 * @param roleName The name of the role
46 * @param qualification The map of role qualifiers for the person
47 * @param asOfDate The effective date of the role
48 *
49 * @return true if {@code principalId} has the role {@code roleName}, false otherwise.
50 */
51 @Cacheable(value=RoleMember.Cache.NAME, key="'{principalHasRole}' + 'principal=' + #p0 + '|' + 'namespace=' + #p1 + '|' + 'roleName=' + #p2 + '|' + 'qualification=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).mapKey(#p3) + '|' + 'asOfDate=' + #p4")
52 boolean principalHasRole(String principalId, String namespaceCode, String roleName, Map<String, String> qualification, DateTime asOfDate);
53
54 /**
55 * Checks whether the given {@code principalId} has the role {@code roleName} depending on the given work area.
56 *
57 * @param principalId The person to check the role for
58 * @param namespaceCode The namespace of the role
59 * @param roleName The name of the role
60 * @param workArea The work area qualifier
61 * @param asOfDate The effective date of the role
62 *
63 * @return true if {@code principalId} has the role {@code roleName} for the given work area, false otherwise.
64 */
65 @Cacheable(value=RoleMember.Cache.NAME, key="'{principalHasRoleInWorkArea}' + 'principal=' + #p0 + '|' + 'namespace=' + #p1 + '|' + 'roleName=' + #p2 + '|' + 'workArea=' + #p3 + '|' + 'asOfDate=' + #p4")
66 boolean principalHasRoleInWorkArea(String principalId, String namespaceCode, String roleName, Long workArea, DateTime asOfDate);
67
68 /**
69 * Checks whether the given {@code principalId} has the role {@code roleName} depending on the given department.
70 *
71 * @param principalId The person to check the role for
72 * @param namespaceCode The namespace of the role
73 * @param roleName The name of the role
74 * @param department The department qualifier
75 * @param asOfDate The effective date of the role
76 *
77 * @return true if {@code principalId} has the role {@code roleName} for the given department, false otherwise.
78 */
79 @Cacheable(value= RoleMember.Cache.NAME, key="'{principalHasRoleInDepartment}' + 'principal=' + #p0 + '|' + 'namespace=' + #p1 + '|' + 'roleName=' + #p2 + '|' + 'department=' + #p3 + '|' + 'asOfDate=' + #p4")
80 boolean principalHasRoleInDepartment(String principalId, String namespaceCode, String roleName, String department, DateTime asOfDate);
81
82 /**
83 * Checks whether the given {@code principalId} has the role {@code roleName} depending on the given location.
84 *
85 * @param principalId The person to check the role for
86 * @param namespaceCode The namespace of the role
87 * @param roleName The name of the role
88 * @param location The location qualifier
89 * @param asOfDate The effective date of the role
90 *
91 * @return true if {@code principalId} has the role {@code roleName} for the given location, false otherwise.
92 */
93 @Cacheable(value= RoleMember.Cache.NAME, key="'{principalHasRoleInLocation}' + 'principal=' + #p0 + '|' + 'namespace=' + #p1 + '|' + 'roleName=' + #p2 + '|' + 'location=' + #p3 + '|' + 'asOfDate=' + #p4")
94 boolean principalHasRoleInLocation(String principalId, String namespaceCode, String roleName, String location, DateTime asOfDate);
95
96 /**
97 * Gets the members of the role {@code roleName}.
98 *
99 * @param namespaceCode The namespace of the role
100 * @param roleName The name of the role
101 * @param asOfDate The effective date of the role
102 * @param getActiveOnly Whether or not to get only active role members
103 *
104 * @return the list of role members in the role {@code roleName}.
105 */
106 List<RoleMember> getRoleMembers(String namespaceCode, String roleName, DateTime asOfDate, boolean isActiveOnly);
107
108 /**
109 * Gets the members of the role {@code roleName} for the given role qualifiers.
110 *
111 * @param namespaceCode The namespace of the role
112 * @param roleName The name of the role
113 * @param qualification The map of role qualifiers
114 * @param asOfDate The effective date of the role
115 * @param getActiveOnly Whether or not to get only active role members
116 *
117 * @return the list of role members in the role {@code roleName}.
118 */
119 List<RoleMember> getRoleMembers(String namespaceCode, String roleName, Map<String, String> qualification, DateTime asOfDate, boolean isActiveOnly);
120
121 /**
122 * Gets the members of the role {@code roleName} for the given work area.
123 *
124 * @param namespaceCode The namespace of the role
125 * @param roleName The name of the role
126 * @param workArea The work area qualifier
127 * @param asOfDate The effective date of the role
128 * @param getActiveOnly Whether or not to get only active role members
129 *
130 * @return the list of role members in the role {@code roleName} for the given work area.
131 */
132 List<RoleMember> getRoleMembersInWorkArea(String namespaceCode, String roleName, Long workArea, DateTime asOfDate, boolean isActiveOnly);
133
134 /**
135 * Gets the members of the role {@code roleName} for the given department.
136 *
137 * @param namespaceCode The namespace of the role
138 * @param roleName The name of the role
139 * @param department The department qualifier
140 * @param asOfDate The effective date of the role
141 * @param getActiveOnly Whether or not to get only active role members
142 *
143 * @return the list of role members in the role {@code roleName} for the given department.
144 */
145 List<RoleMember> getRoleMembersInDepartment(String namespaceCode, String roleName, String department, DateTime asOfDate, boolean isActiveOnly);
146
147 List<RoleMember> getRoleMembersInPosition(String namespaceCode, String roleName, String positionNumber, DateTime asOfDate, boolean isActiveOnly);
148 /**
149 * Gets the members of the role {@code roleName} for the given location.
150 *
151 * @param namespaceCode The namespace of the role
152 * @param roleName The name of the role
153 * @param location The location qualifier
154 * @param asOfDate The effective date of the role
155 * @param getActiveOnly Whether or not to get only active role members
156 *
157 * @return the list of role members in the role {@code roleName} for the given location.
158 */
159 List<RoleMember> getRoleMembersInLocation(String namespaceCode, String roleName, String location, DateTime asOfDate, boolean isActiveOnly);
160
161 /**
162 * Gets the work areas for the given {@code principalId} in the role {@code roleName}.
163 *
164 * @param principalId The person to check the role for
165 * @param namespaceCode The namespace of the role
166 * @param roleName The name of the role
167 * @param asOfDate The effective date of the role
168 * @param activeOnly Whether or not to get only active role members
169 *
170 * @return the list of work areas for the given {@code principalId} in the role {@code roleName}.
171 */
172 @Cacheable(value= RoleMember.Cache.NAME, key="'{getWorkAreasForPrincipalInRole}' + 'principal=' + #p0 + '|' + 'namespace=' + #p1 + '|' + 'roleName=' + #p2 + '|' + 'asOfDate=' + #p3 + '|' + 'activeOnly=' + #p4")
173 List<Long> getWorkAreasForPrincipalInRole(String principalId, String namespaceCode, String roleName, DateTime asOfDate, boolean activeOnly);
174
175 /**
176 * Gets the work areas for the given {@code principalId} in the role {@code roleName}.
177 *
178 * @param principalId The person to check the role for
179 * @param roleIds The list of roleIds
180 * @param asOfDate The effective date of the role
181 * @param activeOnly Whether or not to get only active role members
182 *
183 * @return the list of work areas for the given {@code principalId} in the role {@code roleName}.
184 */
185 @Cacheable(value= RoleMember.Cache.NAME, key="'{getWorkAreasForPrincipalInRoles}' + 'principal=' + #p0 + '|' + 'roleIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p1) + '|' + 'asOfDate=' + #p3 + '|' + 'activeOnly=' + #p4")
186 List<Long> getWorkAreasForPrincipalInRoles(String principalId, List<String> roleIds, DateTime asOfDate, boolean activeOnly);
187
188 /**
189 * Gets the departments for the given {@code principalId} in the roles {@code roleIds}.
190 *
191 * @param principalId The person to check the role for
192 * @param roleIds The list of roleIds
193 * @param asOfDate The effective date of the role
194 * @param activeOnly Whether or not to get only active role members
195 *
196 * @return the list of work areas for the given {@code principalId} in the roles {@code roleIds}.
197 */
198 @Cacheable(value= RoleMember.Cache.NAME, key="'{getDepartmentsForPrincipalInRoles}' + 'principal=' + #p0 + '|' + 'roleIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p1) + '|' + 'asOfDate=' + #p3 + '|' + 'activeOnly=' + #p4")
199 List<String> getDepartmentsForPrincipalInRoles(String principalId, List<String> roleIds, DateTime asOfDate, boolean activeOnly);
200
201 /**
202 * Gets the locations for the given {@code principalId} in the roles {@code roleIds}.
203 *
204 * @param principalId The person to check the role for
205 * @param roleIds The list of roleIds
206 * @param asOfDate The effective date of the role
207 * @param activeOnly Whether or not to get only active role members
208 *
209 * @return the list of work areas for the given {@code principalId} in the roles {@code roleIds}.
210 */
211 @Cacheable(value= RoleMember.Cache.NAME, key="'{getLocationsForPrincipalInRoles}' + 'principal=' + #p0 + '|' + 'roleIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p1) + '|' + 'asOfDate=' + #p3 + '|' + 'activeOnly=' + #p4")
212 List<String> getLocationsForPrincipalInRoles(String principalId, List<String> roleIds, DateTime asOfDate, boolean activeOnly);
213
214
215 /**
216 * Gets the departments for the given {@code principalId} in the role {@code roleName}.
217 *
218 * @param principalId The person to check the role for
219 * @param namespaceCode The namespace of the role
220 * @param roleName The name of the role
221 * @param asOfDate The effective date of the role
222 * @param isActiveOnly Whether or not to get only active role members
223 *
224 * @return the list of departments for the given {@code principalId} in the role {@code roleName}.
225 */
226 @Cacheable(value= RoleMember.Cache.NAME, key="'{getDepartmentsForPrincipalInRole}' + 'principal=' + #p0 + '|' + 'namespace=' + #p1 + '|' + 'roleName=' + #p2 + '|' + 'asOfDate=' + #p3 + '|' + 'isActiveOnly=' + #p4")
227 List<String> getDepartmentsForPrincipalInRole(String principalId, String namespaceCode, String roleName, DateTime asOfDate, boolean isActiveOnly);
228
229 /**
230 * Gets the locations for the given {@code principalId} in the role {@code roleName}.
231 *
232 * @param principalId The person to check the role for
233 * @param namespaceCode The namespace of the role
234 * @param roleName The name of the role
235 * @param asOfDate The effective date of the role
236 * @param isActiveOnly Whether or not to get only active role members
237 *
238 * @return the list of locations for the given {@code principalId} in the role {@code roleName}.
239 */
240 @Cacheable(value= RoleMember.Cache.NAME, key="'{getLocationsForPrincipalInRole}' + 'principal=' + #p0 + '|' + 'namespace=' + #p1 + '|' + 'roleName=' + #p2 + '|' + 'asOfDate=' + #p3 + '|' + 'isActiveOnly=' + #p4")
241 List<String> getLocationsForPrincipalInRole(String principalId, String namespaceCode, String roleName, DateTime asOfDate, boolean isActiveOnly);
242
243 }