View Javadoc
1   package org.kuali.ole.select.businessobject.options;
2   
3   import org.kuali.ole.select.bo.OLECancellationReason;
4   import org.kuali.ole.sys.context.SpringContext;
5   import org.kuali.rice.core.api.util.ConcreteKeyValue;
6   import org.kuali.rice.krad.keyvalues.KeyValuesBase;
7   import org.kuali.rice.krad.service.KeyValuesService;
8   
9   import java.util.ArrayList;
10  import java.util.Collection;
11  import java.util.Iterator;
12  import java.util.List;
13  
14  /**
15   * Created with IntelliJ IDEA.
16   * User: meenau
17   * Date: 12/10/13
18   * Time: 3:59 PM
19   * To change this template use File | Settings | File Templates.
20   */
21  public class OLECancellationReasonValueFinder extends KeyValuesBase {
22      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OLECancellationReasonValueFinder.class);
23  
24      @Override
25      public List getKeyValues() {
26          KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
27          Collection codes = boService.findAll(OLECancellationReason.class);
28          Iterator iterator = codes.iterator();
29          List labels = new ArrayList();
30          labels.add(new ConcreteKeyValue("", ""));
31          while (iterator.hasNext()) {
32              OLECancellationReason oleCancellationReason = (OLECancellationReason) iterator.next();
33              labels.add(new ConcreteKeyValue(oleCancellationReason.getCancelReasonName(), oleCancellationReason
34                      .getCancelReasonName()));
35          }
36          return labels;
37      }
38  
39  }