View Javadoc
1   package org.kuali.ole.deliver.keyvalue;
2   
3   import org.kuali.rice.core.api.util.ConcreteKeyValue;
4   import org.kuali.rice.core.api.util.KeyValue;
5   import org.kuali.rice.krad.keyvalues.KeyValuesBase;
6   import org.kuali.rice.krad.service.KRADServiceLocator;
7   import org.kuali.rice.krms.impl.repository.RuleBo;
8   
9   import java.util.ArrayList;
10  import java.util.Collection;
11  import java.util.List;
12  
13  /**
14   * OleBorrowerKeyValue returns BorrowerTypeId and BorrowerTypeName for OleBorrowerType.
15   */
16  public class OleRuleKeyValueFinder extends KeyValuesBase {
17      /**
18       * This method will populate the code as a key and name as a value and return it as list
19       *
20       * @return keyValues(list)
21       */
22      @Override
23      public List getKeyValues() {
24          List<KeyValue> keyValues = new ArrayList<KeyValue>();
25          Collection<RuleBo> rules = KRADServiceLocator.getBusinessObjectService().findAll(RuleBo.class);
26          keyValues.add(new ConcreteKeyValue("", ""));
27          for (RuleBo ruleBo : rules) {
28              keyValues.add(new ConcreteKeyValue(ruleBo.getName(), ruleBo.getName()));
29          }
30          return keyValues;
31      }
32  }