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 | import java.util.ArrayList; | |
19 | import java.util.List; | |
20 | ||
21 | import org.kuali.rice.core.util.AttributeSet; | |
22 | import org.kuali.rice.kim.api.responsibility.Responsibility; | |
23 | import org.kuali.rice.kim.impl.responsibility.KimResponsibilityTypeService; | |
24 | import org.kuali.rice.kim.service.support.impl.KimTypeServiceBase; | |
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 | /** | |
36 | * @see org.kuali.rice.kim.impl.responsibility.KimResponsibilityTypeService#getMatchingResponsibilities(AttributeSet, List) | |
37 | */ | |
38 | public final List<Responsibility> getMatchingResponsibilities( AttributeSet requestedDetails, List<Responsibility> responsibilitiesList ) { | |
39 | 0 | requestedDetails = translateInputAttributeSet(requestedDetails); |
40 | 0 | validateRequiredAttributesAgainstReceived(requestedDetails); |
41 | 0 | return performResponsibilityMatches(requestedDetails, responsibilitiesList); |
42 | } | |
43 | ||
44 | /** | |
45 | * Internal method for matching Responsibilities. Override this method to customize the matching behavior. | |
46 | * | |
47 | * This base implementation uses the {@link #performMatch(AttributeSet, AttributeSet)} method | |
48 | * to perform an exact match on the Responsibility details and return all that are equal. | |
49 | */ | |
50 | protected List<Responsibility> performResponsibilityMatches(AttributeSet requestedDetails, List<Responsibility> responsibilitiesList) { | |
51 | 0 | List<Responsibility> matchingResponsibilities = new ArrayList<Responsibility>(); |
52 | 0 | for (Responsibility responsibility : responsibilitiesList) { |
53 | 0 | if ( performMatch(requestedDetails, new AttributeSet(responsibility.getAttributes().toMap())) ) { |
54 | 0 | matchingResponsibilities.add( responsibility ); |
55 | } | |
56 | } | |
57 | 0 | return matchingResponsibilities; |
58 | } | |
59 | } |