Coverage Report - org.kuali.rice.kew.service.impl.ReviewResponsibilityTypeServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ReviewResponsibilityTypeServiceImpl
0%
0/15
0%
0/10
3.5
 
 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.kew.service.impl;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.kim.api.KimConstants;
 20  
 import org.kuali.rice.kim.api.responsibility.Responsibility;
 21  
 import org.kuali.rice.kim.framework.responsibility.ResponsibilityTypeService;
 22  
 
 23  
 import java.util.ArrayList;
 24  
 import java.util.Collections;
 25  
 import java.util.Iterator;
 26  
 import java.util.List;
 27  
 import java.util.Map;
 28  
 
 29  
 /**
 30  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 31  
  */
 32  0
 public class ReviewResponsibilityTypeServiceImpl extends DocumentTypeResponsibilityTypeServiceImpl implements ResponsibilityTypeService {
 33  
         {
 34  0
                 exactMatchStringAttributeName = KimConstants.AttributeConstants.ROUTE_NODE_NAME;
 35  0
         }
 36  
 
 37  
     @Override
 38  
     protected List<String> getRequiredAttributes() {
 39  0
         final List<String> attrs = new ArrayList<String>(super.getRequiredAttributes());
 40  0
         attrs.add(KimConstants.AttributeConstants.ROUTE_NODE_NAME);
 41  0
         return Collections.unmodifiableList(attrs);
 42  
     }
 43  
 
 44  
         @Override
 45  
         protected List<Responsibility> performResponsibilityMatches(
 46  
                         Map<String, String> requestedDetails,
 47  
                         List<Responsibility> responsibilitiesList) {
 48  
                 // get the base responsibility matches based on the route level and document type
 49  0
                 List<Responsibility> baseMatches = super.performResponsibilityMatches(requestedDetails,
 50  
                                 responsibilitiesList);
 51  
                 // now, if any of the responsibilities have the "qualifierResolverProvidedIdentifier" detail property
 52  
                 // perform an exact match on the property with the requested details
 53  
                 // if the property does not match or does not exist in the requestedDetails, remove
 54  
                 // the responsibility from the list
 55  0
                 Iterator<Responsibility> respIter = baseMatches.iterator();
 56  0
                 while ( respIter.hasNext() ) {
 57  0
                         Map<String, String> respDetails = respIter.next().getAttributes();
 58  0
                         if ( respDetails.containsKey( KimConstants.AttributeConstants.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER ) && StringUtils.isNotBlank( respDetails.get(KimConstants.AttributeConstants.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER) ) ) {
 59  0
                                 if ( !requestedDetails.containsKey( KimConstants.AttributeConstants.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER )
 60  
                                                 || !StringUtils.equals( respDetails.get(KimConstants.AttributeConstants.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER)
 61  
                                                                 , requestedDetails.get(KimConstants.AttributeConstants.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER))) {
 62  0
                                         respIter.remove();
 63  
                                 }
 64  
                         }
 65  0
                 }                
 66  0
                 return baseMatches;
 67  
         }
 68  
 }