001package org.kuali.ole.module.purap.businessobject.options;
002
003import org.kuali.ole.select.bo.OlePurchaseOrderPurpose;
004import org.kuali.ole.sys.context.SpringContext;
005import org.kuali.rice.core.api.util.ConcreteKeyValue;
006import org.kuali.rice.core.api.util.KeyValue;
007import org.kuali.rice.krad.keyvalues.KeyValuesBase;
008import org.kuali.rice.krad.service.KRADServiceLocator;
009import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
010import org.kuali.rice.krad.service.KeyValuesService;
011
012import java.util.ArrayList;
013import java.util.Collection;
014import java.util.Iterator;
015import java.util.List;
016
017/**
018 * Created by sambasivam on 29/9/14.
019 */
020public class OLEPurchaseOrderPurposeKeyValueFinder extends KeyValuesBase {
021
022
023    @Override
024    public List<KeyValue> getKeyValues() {
025        KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
026        Collection codes = KRADServiceLocator.getBusinessObjectService().findAll(OlePurchaseOrderPurpose.class);
027        List labels = new ArrayList();
028        labels.add(new ConcreteKeyValue("", ""));
029        for (Iterator iter = codes.iterator(); iter.hasNext(); ) {
030            OlePurchaseOrderPurpose olePurchaseOrderPurpose = (OlePurchaseOrderPurpose) iter.next();
031            labels.add(new ConcreteKeyValue(olePurchaseOrderPurpose.getPurchaseOrderPurposeId().toString(), olePurchaseOrderPurpose.getPurchaseOrderPurposeCode()));
032        }
033
034
035        return labels;
036
037    }
038}