01: /*
02: * Copyright 2006-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.kra.budget.lookup.keyvalues;
17:
18: import java.util.ArrayList;
19: import java.util.List;
20:
21: import org.kuali.core.lookup.keyvalues.KeyValuesBase;
22: import org.kuali.core.web.ui.KeyLabelPair;
23: import org.kuali.kfs.context.SpringContext;
24: import org.kuali.kfs.service.ParameterService;
25: import org.kuali.module.kra.KraConstants;
26: import org.kuali.module.kra.budget.bo.AppointmentType;
27: import org.kuali.module.kra.budget.document.BudgetDocument;
28: import org.kuali.module.kra.budget.service.BudgetFringeRateService;
29:
30: /**
31: * This class...
32: */
33: public class BudgetAppointmentTypeValuesFinder extends KeyValuesBase {
34:
35: private static String summerAppointmentType;
36:
37: /**
38: * Constructs a BudgetAppointmentTypeValuesFinder.java.
39: */
40: public BudgetAppointmentTypeValuesFinder() {
41: super ();
42: }
43:
44: /**
45: * @see org.kuali.core.lookup.keyvalues.KeyValuesFinder#getKeyValues()
46: */
47: public List getKeyValues() {
48: if (summerAppointmentType == null) {
49: summerAppointmentType = SpringContext
50: .getBean(ParameterService.class)
51: .getParameterValue(
52: BudgetDocument.class,
53: KraConstants.KRA_BUDGET_PERSONNEL_SUMMER_GRID_APPOINTMENT_TYPE);
54: }
55:
56: List<AppointmentType> appointmentTypes = (List) SpringContext
57: .getBean(BudgetFringeRateService.class)
58: .getDefaultFringeRates(); // getDefaultFringeRates
59: // is,
60: // perhaps,
61: // misnamed.
62: // It
63: // returns
64: // a
65: // list
66: // of
67: // appointment
68: // types.
69: List appointmentTypeKeyLabelPairList = new ArrayList();
70: for (AppointmentType element : appointmentTypes) {
71: if (!element.getAppointmentTypeCode().equals(
72: summerAppointmentType)) {
73: appointmentTypeKeyLabelPairList.add(new KeyLabelPair(
74: element.getAppointmentTypeCode(), element
75: .getAppointmentTypeDescription()));
76: }
77: }
78:
79: return appointmentTypeKeyLabelPairList;
80: }
81:
82: }
|