Coverage Report - org.kuali.rice.student.lookup.keyvalues.StudentKeyValuesBase
 
Classes in this File Line Coverage Branch Coverage Complexity
StudentKeyValuesBase
0%
0/7
0%
0/4
2.5
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 /**
 17  
  * 
 18  
  */
 19  
 package org.kuali.rice.student.lookup.keyvalues;
 20  
 
 21  
 import javax.xml.namespace.QName;
 22  
 
 23  
 import org.apache.commons.lang.StringUtils;
 24  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 25  
 import org.kuali.rice.core.api.util.ConcreteKeyValue;
 26  
 import org.kuali.rice.core.api.util.KeyValue;
 27  
 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
 28  
 import org.kuali.student.core.organization.service.OrganizationService;
 29  
 
 30  
 /**
 31  
  * Convenience class used to help out key values classes
 32  
  *
 33  
  */
 34  0
 public abstract class StudentKeyValuesBase extends KeyValuesBase {
 35  
 
 36  
         private static OrganizationService organizationService;
 37  
 
 38  
         protected static OrganizationService getOrganizationService() {
 39  0
                 if (organizationService == null) {
 40  0
                 organizationService = (OrganizationService) GlobalResourceLoader
 41  
                 .getService(new QName("http://student.kuali.org/wsdl/organization","OrganizationService"));
 42  
                 }
 43  0
                 return organizationService;
 44  
         }
 45  
 
 46  
         /**
 47  
          * Builds a valid {@link KeyValue} object for use in Student system KeyValue classes. Will throw an {@link IllegalArgumentException}
 48  
          * if the parameters needed are not passed.
 49  
          * 
 50  
          * @param orgId
 51  
          * @param orgShortName
 52  
          * @param orgLongName
 53  
          * @param orgType
 54  
          * @return
 55  
          */
 56  
         
 57  
         //** question from Bonnie: Why the input parameters have orgId, orgShortName, orgLongName and orgType,
 58  
         //** but the output of KeyValue is constructed with orgShortName for both key and label?
 59  
         //** This looks weird for me.
 60  
         protected static KeyValue buildKeyValue(String orgId, String orgShortName, String orgLongName, String orgType) {
 61  0
                 if (StringUtils.isBlank(orgShortName)) {
 62  0
                         throw new IllegalArgumentException("Blank value for orgShortName is invalid.");
 63  
                 }
 64  
                 //        return new KeyValue(orgShortName, orgShortName);
 65  0
                 return new ConcreteKeyValue(orgId, orgShortName);
 66  
         }
 67  
 
 68  
 }