001package org.kuali.ole.select.keyvalue; 002 003import org.kuali.ole.select.bo.OLEPlatformStatus; 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; 008import org.kuali.rice.krad.service.KRADServiceLocatorWeb; 009 010import java.util.ArrayList; 011import java.util.Collection; 012import java.util.List; 013 014/** 015 * Created by chenchulakshmig on 9/12/14. 016 * OLEPlatformStatusKeyValues returns platformStatusId and platformStatusName for OLEPlatformStatus. 017 */ 018public class OLEPlatformStatusKeyValues extends KeyValuesBase { 019 020 /** 021 * This method will populate the id as a key and name as a value and return it as list 022 * 023 * @return keyValues(list) 024 */ 025 @Override 026 public List getKeyValues() { 027 List<KeyValue> keyValues = new ArrayList<KeyValue>(); 028 Collection<OLEPlatformStatus> olePlatformStatusList = KRADServiceLocator.getBusinessObjectService().findAll(OLEPlatformStatus.class); 029 for (OLEPlatformStatus olePlatformStatus : olePlatformStatusList) { 030 if (olePlatformStatus.isActive()) { 031 keyValues.add(new ConcreteKeyValue(olePlatformStatus.getPlatformStatusId(), olePlatformStatus.getPlatformStatusName())); 032 } 033 } 034 return keyValues; 035 } 036}