Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KimPermissionTypeServiceBase |
|
| 2.0;2 |
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.impl; | |
17 | ||
18 | import java.util.ArrayList; | |
19 | import java.util.List; | |
20 | ||
21 | import org.kuali.rice.kim.bo.role.dto.KimPermissionInfo; | |
22 | import org.kuali.rice.kim.bo.types.dto.AttributeSet; | |
23 | import org.kuali.rice.kim.service.support.KimPermissionTypeService; | |
24 | ||
25 | /** | |
26 | * This is a description of what this class does - bhargavp don't forget to fill this in. | |
27 | * | |
28 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
29 | * | |
30 | */ | |
31 | 0 | public class KimPermissionTypeServiceBase extends KimTypeServiceBase implements KimPermissionTypeService { |
32 | ||
33 | /** | |
34 | * @see org.kuali.rice.kim.service.support.KimPermissionTypeService#getMatchingPermissions(AttributeSet, List) | |
35 | */ | |
36 | public final List<KimPermissionInfo> getMatchingPermissions( AttributeSet requestedDetails, List<KimPermissionInfo> permissionsList ) { | |
37 | 0 | requestedDetails = translateInputAttributeSet(requestedDetails); |
38 | 0 | validateRequiredAttributesAgainstReceived(requestedDetails); |
39 | 0 | return performPermissionMatches(requestedDetails, permissionsList); |
40 | } | |
41 | ||
42 | /** | |
43 | * Internal method for matching permissions. Override this method to customize the matching behavior. | |
44 | * | |
45 | * This base implementation uses the {@link #performMatch(AttributeSet, AttributeSet)} method | |
46 | * to perform an exact match on the permission details and return all that are equal. | |
47 | */ | |
48 | protected List<KimPermissionInfo> performPermissionMatches(AttributeSet requestedDetails, List<KimPermissionInfo> permissionsList) { | |
49 | 0 | List<KimPermissionInfo> matchingPermissions = new ArrayList<KimPermissionInfo>(); |
50 | 0 | for (KimPermissionInfo permission : permissionsList) { |
51 | 0 | if ( performMatch(requestedDetails, permission.getDetails()) ) { |
52 | 0 | matchingPermissions.add( permission ); |
53 | } | |
54 | } | |
55 | 0 | return matchingPermissions; |
56 | } | |
57 | } |