001    package org.kuali.ole.editor.keyvalue;
002    
003    import org.kuali.ole.catalog.bo.OleReceiptStatus;
004    import org.kuali.rice.core.api.util.ConcreteKeyValue;
005    import org.kuali.rice.core.api.util.KeyValue;
006    import org.kuali.rice.krad.keyvalues.KeyValuesBase;
007    import org.kuali.rice.krad.service.KRADServiceLocator;
008    
009    import java.util.ArrayList;
010    import java.util.Collection;
011    import java.util.List;
012    
013    /**
014     * ReceiptStatus used to render the values for ReceiptStatus dropdown control.
015     */
016    public class ReceiptStatus extends KeyValuesBase {
017        /**
018         * This method returns the List of ConcreteKeyValues,
019         * ConcreteKeyValue has two arguments  receiptStatusCode and
020         * receiptStatusName.
021         * @return  List<KeyValue>
022         */
023        @Override
024        public List<KeyValue> getKeyValues() {
025            List<KeyValue> options = new ArrayList<KeyValue>();
026            Collection<OleReceiptStatus> oleReceiptStatuses = KRADServiceLocator.getBusinessObjectService().findAll(OleReceiptStatus.class);
027            options.add(new ConcreteKeyValue("", ""));
028            for (OleReceiptStatus type : oleReceiptStatuses) {
029                options.add(new ConcreteKeyValue(type.getReceiptStatusCode(), type.getReceiptStatusName()));
030            }
031            return options;
032        }
033    }