View Javadoc
1   package org.kuali.ole.module.purap.businessobject.options;
2   
3   import org.kuali.ole.select.bo.OlePurchaseOrderPurpose;
4   import org.kuali.ole.sys.context.SpringContext;
5   import org.kuali.rice.core.api.util.ConcreteKeyValue;
6   import org.kuali.rice.core.api.util.KeyValue;
7   import org.kuali.rice.krad.keyvalues.KeyValuesBase;
8   import org.kuali.rice.krad.service.KRADServiceLocator;
9   import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
10  import org.kuali.rice.krad.service.KeyValuesService;
11  
12  import java.util.ArrayList;
13  import java.util.Collection;
14  import java.util.Iterator;
15  import java.util.List;
16  
17  /**
18   * Created by sambasivam on 29/9/14.
19   */
20  public class OLEPurchaseOrderPurposeKeyValueFinder extends KeyValuesBase {
21  
22  
23      @Override
24      public List<KeyValue> getKeyValues() {
25          KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
26          Collection codes = KRADServiceLocator.getBusinessObjectService().findAll(OlePurchaseOrderPurpose.class);
27          List labels = new ArrayList();
28          labels.add(new ConcreteKeyValue("", ""));
29          for (Iterator iter = codes.iterator(); iter.hasNext(); ) {
30              OlePurchaseOrderPurpose olePurchaseOrderPurpose = (OlePurchaseOrderPurpose) iter.next();
31              labels.add(new ConcreteKeyValue(olePurchaseOrderPurpose.getPurchaseOrderPurposeId().toString(), olePurchaseOrderPurpose.getPurchaseOrderPurposeCode()));
32          }
33  
34  
35          return labels;
36  
37      }
38  }