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
16
17
18
19
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 }