001package org.kuali.ole.select.keyvalue;
002
003import org.kuali.ole.select.bo.OLEEResourceStatus;
004import org.kuali.rice.core.api.util.ConcreteKeyValue;
005import org.kuali.rice.core.api.util.KeyValue;
006import org.kuali.rice.krad.keyvalues.KeyValuesBase;
007import org.kuali.rice.krad.service.KRADServiceLocator;
008
009import java.util.ArrayList;
010import java.util.Collection;
011import java.util.List;
012
013/**
014 * Created with IntelliJ IDEA.
015 * User: srinivasane
016 * Date: 6/26/13
017 * Time: 3:22 PM
018 * To change this template use File | Settings | File Templates.
019 */
020public class OLEEResourceStatusKeyValues extends KeyValuesBase {
021
022    @Override
023    public List getKeyValues() {
024        List<KeyValue> keyValues = new ArrayList<KeyValue>();
025        Collection<OLEEResourceStatus> oleEResourceStatuss = KRADServiceLocator.getBusinessObjectService().findAll(OLEEResourceStatus.class);
026        for (OLEEResourceStatus oleEResourceStatus : oleEResourceStatuss) {
027            if (oleEResourceStatus.isActive()) {
028                keyValues.add(new ConcreteKeyValue(oleEResourceStatus.getOleEResourceStatusId(), oleEResourceStatus.getOleEResourceStatusName()));
029            }
030        }
031        return keyValues;
032    }
033}