View Javadoc
1   package org.kuali.ole.select.keyvalue;
2   
3   import org.kuali.ole.select.bo.OLEPlatformStatus;
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   import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
9   
10  import java.util.ArrayList;
11  import java.util.Collection;
12  import java.util.List;
13  
14  /**
15   * Created by chenchulakshmig on 9/12/14.
16   * OLEPlatformStatusKeyValues returns platformStatusId and platformStatusName for OLEPlatformStatus.
17   */
18  public class OLEPlatformStatusKeyValues extends KeyValuesBase {
19  
20      /**
21       * This method will populate the id as a key and name as a value and return it as list
22       *
23       * @return keyValues(list)
24       */
25      @Override
26      public List getKeyValues() {
27          List<KeyValue> keyValues = new ArrayList<KeyValue>();
28          Collection<OLEPlatformStatus> olePlatformStatusList = KRADServiceLocator.getBusinessObjectService().findAll(OLEPlatformStatus.class);
29          for (OLEPlatformStatus olePlatformStatus : olePlatformStatusList) {
30              if (olePlatformStatus.isActive()) {
31                  keyValues.add(new ConcreteKeyValue(olePlatformStatus.getPlatformStatusId(), olePlatformStatus.getPlatformStatusName()));
32              }
33          }
34          return keyValues;
35      }
36  }