View Javadoc
1   /*
2    * Copyright 2007 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.ole.fp.businessobject.options;
17  
18  import java.util.ArrayList;
19  import java.util.HashMap;
20  import java.util.Iterator;
21  import java.util.List;
22  import java.util.Map;
23  
24  import org.kuali.ole.fp.businessobject.TravelPerDiem;
25  import org.kuali.ole.sys.OLEPropertyConstants;
26  import org.kuali.ole.sys.context.SpringContext;
27  import org.kuali.ole.sys.service.UniversityDateService;
28  import org.kuali.rice.core.api.util.ConcreteKeyValue;
29  import org.kuali.rice.krad.keyvalues.KeyValuesBase;
30  import org.kuali.rice.krad.service.KeyValuesService;
31  
32  /**
33   * This class returns list of per diem category value pairs.
34   */
35  public class TravelPerDiemCategoryValuesFinder extends KeyValuesBase {
36  
37      /*
38       * @see org.kuali.keyvalues.KeyValuesFinder#getKeyValues()
39       */
40      public List getKeyValues() {
41          Map criteria = new HashMap();
42          criteria.put(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear());
43  
44          List boList = (List) SpringContext.getBean(KeyValuesService.class).findMatching(TravelPerDiem.class, criteria);
45          List keyValues = new ArrayList();
46          keyValues.add(new ConcreteKeyValue("", ""));
47          for (Iterator iter = boList.iterator(); iter.hasNext();) {
48              TravelPerDiem element = (TravelPerDiem) iter.next();
49              keyValues.add(new ConcreteKeyValue(element.getPerDiemCountryName(), element.getPerDiemCountryName()));
50          }
51  
52          return keyValues;
53      }
54  
55  }