View Javadoc
1   /**
2    * Copyright 2005-2012 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.ingest.keyvalue;
17  
18  import org.kuali.rice.core.api.util.ConcreteKeyValue;
19  import org.kuali.rice.core.api.util.KeyValue;
20  import org.kuali.rice.krad.keyvalues.KeyValuesBase;
21  import org.kuali.rice.krad.service.KRADServiceLocator;
22  import org.kuali.rice.krms.impl.repository.AgendaBo;
23  
24  import java.util.ArrayList;
25  import java.util.Collection;
26  import java.util.List;
27  
28  /**
29   * AgendaKeyValues is the value finder class
30   */
31  public class AgendaKeyValues extends KeyValuesBase {
32  
33      private boolean blankOption;
34  
35      public boolean isBlankOption() {
36          return this.blankOption;
37      }
38  
39      /**
40       * @param blankOption the blankOption to set
41       */
42      public void setBlankOption(boolean blankOption) {
43          this.blankOption = blankOption;
44      }
45  
46      /**
47       * This method returns the List of ConcreteKeyValue,
48       * ConcreteKeyValue has two arguments Code and
49       * Name.
50       * @return  List<KeyValue>
51       */
52      @Override
53      public List getKeyValues() {
54          List<KeyValue> keyValues = new ArrayList<KeyValue>();
55          Collection<AgendaBo> agendaBo = KRADServiceLocator.getBusinessObjectService().findAll(AgendaBo.class);
56          keyValues.add(new ConcreteKeyValue("", ""));
57          for (AgendaBo typ : agendaBo) {
58              keyValues.add(new ConcreteKeyValue(typ.getName(), typ.getName()));
59          }
60          return keyValues;
61      }
62  
63  }