View Javadoc
1   package org.kuali.ole.describe.keyvalue;
2   
3   import org.kuali.ole.describe.bo.OleStatisticalSearchingCodes;
4   import org.kuali.rice.core.api.util.ConcreteKeyValue;
5   import org.kuali.rice.core.api.util.KeyValue;
6   import org.kuali.rice.krad.keyvalues.KeyValuesBase;
7   import org.kuali.rice.krad.service.KRADServiceLocator;
8   
9   import java.util.ArrayList;
10  import java.util.Collection;
11  import java.util.List;
12  
13  /**
14   * StatisticalSearchingCodes used to render the values for StatisticalSearchingCodes dropdown control.
15   */
16  public class StatisticalSearchingCodes extends KeyValuesBase {
17      /**
18       * This method returns the List of ConcreteKeyValue,
19       * ConcreteKeyValue has two arguments statisticalSearchingCode and
20       * statisticalSearchingName .
21       *
22       * @return List<KeyValue>
23       */
24      @Override
25      public List<KeyValue> getKeyValues() {
26          List<KeyValue> options = new ArrayList<KeyValue>();
27          Collection<OleStatisticalSearchingCodes> oleStatisticalSearchingCodes = KRADServiceLocator.getBusinessObjectService().findAll(OleStatisticalSearchingCodes.class);
28          options.add(new ConcreteKeyValue("", ""));
29          for (OleStatisticalSearchingCodes type : oleStatisticalSearchingCodes) {
30              if (type.isActive()) {
31                  options.add(new ConcreteKeyValue(type.getStatisticalSearchingCode(), type.getStatisticalSearchingName()));
32              }
33          }
34          return options;
35      }
36  }