1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  package org.kuali.kfs.module.bc.businessobject.options;
20  
21  import java.util.ArrayList;
22  import java.util.Collection;
23  import java.util.List;
24  
25  import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAppointmentFundingReasonCode;
26  import org.kuali.kfs.sys.KFSConstants;
27  import org.kuali.kfs.sys.context.SpringContext;
28  import org.kuali.rice.core.api.util.ConcreteKeyValue;
29  import org.kuali.rice.core.api.util.KeyValue;
30  import org.kuali.rice.krad.keyvalues.KeyValuesBase;
31  import org.kuali.rice.krad.service.KeyValuesService;
32  
33  
34  
35  
36  public class AppointmentFundingReasonValuesFinder extends KeyValuesBase {
37  
38      
39  
40  
41      @SuppressWarnings("unchecked")
42      public List getKeyValues() {
43          KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
44          Collection<BudgetConstructionAppointmentFundingReasonCode> reasonCodes = boService.findAll(BudgetConstructionAppointmentFundingReasonCode.class);
45  
46          List<KeyValue> reasonCodeKeyLabels = new ArrayList<KeyValue>();
47          reasonCodeKeyLabels.add(new ConcreteKeyValue(KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING));
48  
49          for (BudgetConstructionAppointmentFundingReasonCode reasonCode : reasonCodes) {
50              if (!reasonCode.isActive()) {
51                  continue;
52              }
53  
54              String code = reasonCode.getAppointmentFundingReasonCode();
55              reasonCodeKeyLabels.add(new ConcreteKeyValue(code, code));
56          }
57  
58          return reasonCodeKeyLabels;
59      }
60  }