Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KimResponsibilityTypeServiceBase |
|
| 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.impl.responsibility; | |
17 | ||
18 | ||
19 | import org.kuali.rice.kim.api.responsibility.Responsibility; | |
20 | import org.kuali.rice.kim.impl.type.KimTypeServiceBase; | |
21 | ||
22 | import java.util.ArrayList; | |
23 | import java.util.List; | |
24 | import java.util.Map; | |
25 | ||
26 | /** | |
27 | * This is a description of what this class does - ewestfal don't forget to fill this in. | |
28 | * | |
29 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
30 | * | |
31 | */ | |
32 | 0 | public class KimResponsibilityTypeServiceBase extends KimTypeServiceBase |
33 | implements KimResponsibilityTypeService { | |
34 | ||
35 | @Override | |
36 | public final List<Responsibility> getMatchingResponsibilities( Map<String, String> requestedDetails, List<Responsibility> responsibilitiesList ) { | |
37 | 0 | requestedDetails = translateInputAttributes(requestedDetails); |
38 | 0 | validateRequiredAttributesAgainstReceived(requestedDetails); |
39 | 0 | return performResponsibilityMatches(requestedDetails, responsibilitiesList); |
40 | } | |
41 | ||
42 | /** | |
43 | * Internal method for matching Responsibilities. Override this method to customize the matching behavior. | |
44 | * | |
45 | * This base implementation uses the {@link #performMatch(Map<String, String>, Map<String, String>)} method | |
46 | * to perform an exact match on the Responsibility details and return all that are equal. | |
47 | */ | |
48 | protected List<Responsibility> performResponsibilityMatches(Map<String, String> requestedDetails, List<Responsibility> responsibilitiesList) { | |
49 | 0 | List<Responsibility> matchingResponsibilities = new ArrayList<Responsibility>(); |
50 | 0 | for (Responsibility responsibility : responsibilitiesList) { |
51 | 0 | if ( performMatch(requestedDetails, responsibility.getAttributes())) { |
52 | 0 | matchingResponsibilities.add( responsibility ); |
53 | } | |
54 | } | |
55 | 0 | return matchingResponsibilities; |
56 | } | |
57 | } |