| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| StudentKeyValuesBase |
|
| 2.5;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.resourceloader.GlobalResourceLoader; | |
| 25 | import org.kuali.rice.core.util.KeyLabelPair; | |
| 26 | import org.kuali.rice.kns.lookup.keyvalues.KeyValuesBase; | |
| 27 | import org.kuali.student.core.organization.service.OrganizationService; | |
| 28 | ||
| 29 | /** | |
| 30 | * Convenience class used to help out key values classes | |
| 31 | * | |
| 32 | */ | |
| 33 | 0 | public abstract class StudentKeyValuesBase extends KeyValuesBase { |
| 34 | ||
| 35 | private static OrganizationService organizationService; | |
| 36 | ||
| 37 | protected static OrganizationService getOrganizationService() { | |
| 38 | 0 | if (organizationService == null) { |
| 39 | 0 | organizationService = (OrganizationService) GlobalResourceLoader |
| 40 | .getService(new QName("http://student.kuali.org/wsdl/organization","OrganizationService")); | |
| 41 | } | |
| 42 | 0 | return organizationService; |
| 43 | } | |
| 44 | ||
| 45 | /** | |
| 46 | * Builds a valid {@link KeyLabelPair} object for use in Student system KeyValue classes. Will throw an {@link IllegalArgumentException} | |
| 47 | * if the parameters needed are not passed. | |
| 48 | * | |
| 49 | * @param orgId | |
| 50 | * @param orgShortName | |
| 51 | * @param orgLongName | |
| 52 | * @param orgType | |
| 53 | * @return | |
| 54 | */ | |
| 55 | protected static KeyLabelPair buildKeyLabelPair(String orgId, String orgShortName, String orgLongName, String orgType) { | |
| 56 | 0 | if (StringUtils.isBlank(orgShortName)) { |
| 57 | 0 | throw new IllegalArgumentException("Blank value for orgShortName is invalid."); |
| 58 | } | |
| 59 | 0 | return new KeyLabelPair(orgShortName, orgShortName); |
| 60 | } | |
| 61 | ||
| 62 | } |