001package org.kuali.ole.deliver.keyvalue; 002 003import org.kuali.ole.deliver.bo.OleBorrowerType; 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 * OleBorrowerKeyValue returns BorrowerTypeId and BorrowerTypeName for OleBorrowerType. 015 */ 016public class OleBorrowerKeyValue extends KeyValuesBase { 017 /** 018 * This method will populate the code as a key and name as a value and return it as list 019 * 020 * @return keyValues(list) 021 */ 022 @Override 023 public List getKeyValues() { 024 List<KeyValue> keyValues = new ArrayList<KeyValue>(); 025 Collection<OleBorrowerType> oleBorrowerTypes = KRADServiceLocator.getBusinessObjectService().findAll(OleBorrowerType.class); 026 keyValues.add(new ConcreteKeyValue("", "")); 027 for (OleBorrowerType oleBorrowerType : oleBorrowerTypes) { 028 if (oleBorrowerType.isActive()) { 029 keyValues.add(new ConcreteKeyValue(oleBorrowerType.getBorrowerTypeId(), oleBorrowerType.getBorrowerTypeName())); 030 } 031 } 032 return keyValues; 033 } 034}