Coverage Report - org.kuali.rice.kns.kim.responsibility.KimResponsibilityTypeServiceBase
 
Classes in this File Line Coverage Branch Coverage Complexity
KimResponsibilityTypeServiceBase
0%
0/13
0%
0/8
4
 
 1  
 /**
 2  
  * Copyright 2005-2011 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.kns.kim.responsibility;
 17  
 
 18  
 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
 19  
 import org.kuali.rice.kim.api.responsibility.Responsibility;
 20  
 import org.kuali.rice.kim.framework.responsibility.ResponsibilityTypeService;
 21  
 import org.kuali.rice.kns.kim.type.DataDictionaryTypeServiceBase;
 22  
 
 23  
 import java.util.ArrayList;
 24  
 import java.util.Collections;
 25  
 import java.util.List;
 26  
 import java.util.Map;
 27  
 
 28  
 /**
 29  
  * @deprecated A krad integrated type service base class will be provided in the future.
 30  
  */
 31  
 @Deprecated
 32  0
 public class KimResponsibilityTypeServiceBase extends DataDictionaryTypeServiceBase
 33  
                 implements ResponsibilityTypeService {
 34  
 
 35  
         @Override
 36  
         public final List<Responsibility> getMatchingResponsibilities( Map<String, String> requestedDetails, List<Responsibility> responsibilitiesList ) {
 37  0
                 if (requestedDetails == null) {
 38  0
             throw new RiceIllegalArgumentException("requestedDetails is null");
 39  
         }
 40  
 
 41  0
         if (responsibilitiesList == null) {
 42  0
             throw new RiceIllegalArgumentException("responsibilitiesList is null");
 43  
         }
 44  
 
 45  0
         requestedDetails = translateInputAttributes(requestedDetails);
 46  0
                 validateRequiredAttributesAgainstReceived(requestedDetails);
 47  0
                 return Collections.unmodifiableList(performResponsibilityMatches(requestedDetails, responsibilitiesList));
 48  
         }
 49  
 
 50  
         /**
 51  
          * Internal method for matching Responsibilities.  Override this method to customize the matching behavior.
 52  
          * 
 53  
          * This base implementation uses the {@link #performMatch(Map, Map)} method
 54  
          * to perform an exact match on the Responsibility details and return all that are equal.
 55  
          */
 56  
         protected List<Responsibility> performResponsibilityMatches(Map<String, String> requestedDetails, List<Responsibility> responsibilitiesList) {
 57  0
                 List<Responsibility> matchingResponsibilities = new ArrayList<Responsibility>();
 58  0
                 for (Responsibility responsibility : responsibilitiesList) {
 59  0
                         if ( performMatch(requestedDetails, responsibility.getAttributes())) {
 60  0
                                 matchingResponsibilities.add( responsibility );
 61  
                         }
 62  
                 }
 63  0
                 return matchingResponsibilities;
 64  
         }
 65  
 }