Coverage Report - org.kuali.rice.krad.service.impl.CampusRoleTypeServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
CampusRoleTypeServiceImpl
0%
0/21
0%
0/8
3
 
 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.krad.service.impl;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
 20  
 import org.kuali.rice.core.api.uif.RemotableAttributeField;
 21  
 import org.kuali.rice.kim.api.KimConstants;
 22  
 import org.kuali.rice.kim.api.type.KimAttributeField;
 23  
 import org.kuali.rice.kns.kim.role.RoleTypeServiceBase;
 24  
 
 25  
 import java.util.ArrayList;
 26  
 import java.util.Collections;
 27  
 import java.util.List;
 28  
 
 29  0
 public class CampusRoleTypeServiceImpl extends RoleTypeServiceBase {
 30  
 
 31  
     @Override
 32  
     protected List<String> getRequiredAttributes() {
 33  0
         final List<String> attrs = new ArrayList<String>(super.getRequiredAttributes());
 34  0
         attrs.add(KimConstants.AttributeConstants.CAMPUS_CODE);
 35  0
         return Collections.unmodifiableList(attrs);
 36  
     }
 37  
 
 38  
     @Override
 39  
     public List<String> getWorkflowRoutingAttributes(String routeLevel) {
 40  0
         if (StringUtils.isBlank(routeLevel)) {
 41  0
             throw new RiceIllegalArgumentException("routeLevel was blank or null");
 42  
         }
 43  
 
 44  0
         final List<String> attrs = new ArrayList<String>(super.getWorkflowRoutingAttributes(routeLevel));
 45  0
         attrs.add(KimConstants.AttributeConstants.CAMPUS_CODE);
 46  0
         return Collections.unmodifiableList(attrs);
 47  
     }
 48  
 
 49  
         @Override
 50  
         public List<KimAttributeField> getAttributeDefinitions(String kimTypeId) {
 51  0
                 if (StringUtils.isBlank(kimTypeId)) {
 52  0
             throw new RiceIllegalArgumentException("kimTypeId was null or blank");
 53  
         }
 54  
 
 55  0
         List<KimAttributeField> map = new ArrayList<KimAttributeField>(super.getAttributeDefinitions(kimTypeId));
 56  
 
 57  0
                 for (int i = 0; i < map.size(); i++) {
 58  0
             final KimAttributeField definition = map.get(i);
 59  0
                         if (KimConstants.AttributeConstants.CAMPUS_CODE.equals(definition.getAttributeField().getName())) {
 60  0
                                 KimAttributeField.Builder b = KimAttributeField.Builder.create(definition);
 61  
 
 62  0
                 RemotableAttributeField.Builder fb =  b.getAttributeField();
 63  0
                 fb.setRequired(true);
 64  
 
 65  0
                 b.setAttributeField(fb);
 66  0
                 map.set(i, b.build());
 67  
                         }
 68  
                 }
 69  0
                 return Collections.unmodifiableList(map);
 70  
         }
 71  
 }