1 package org.kuali.ole.deliver.keyvalue;
2
3 import org.kuali.ole.OLEConstants;
4 import org.kuali.ole.deliver.bo.OlePaymentStatus;
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
10 import java.util.ArrayList;
11 import java.util.Collection;
12 import java.util.List;
13
14
15
16
17
18
19
20
21 public class OlePaymentStatusKeyValues extends KeyValuesBase {
22
23 @Override
24 public List getKeyValues() {
25 List<KeyValue> keyValues = new ArrayList<KeyValue>();
26 Collection<OlePaymentStatus> olePaymentStatus = KRADServiceLocator.getBusinessObjectService().findAll(OlePaymentStatus.class);
27 for (OlePaymentStatus paymentStatus : olePaymentStatus) {
28 if (paymentStatus.getPaymentStatusName().equals(OLEConstants.OlePatron.BILL_PAYMENT_STATUS_OUTSTANDING)) {
29 keyValues.add(new ConcreteKeyValue(paymentStatus.getPaymentStatusId(), paymentStatus.getPaymentStatusName()));
30 break;
31 }
32 }
33 for (OlePaymentStatus paymentStatus : olePaymentStatus) {
34 if (!paymentStatus.getPaymentStatusName().equals(OLEConstants.OlePatron.BILL_PAYMENT_STATUS_OUTSTANDING)) {
35 keyValues.add(new ConcreteKeyValue(paymentStatus.getPaymentStatusId(), paymentStatus.getPaymentStatusName()));
36 }
37 }
38 return keyValues;
39 }
40 }