View Javadoc

1   package org.kuali.ole.deliver.loan.keyvalue;
2   
3   import org.kuali.ole.location.bo.OleLocation;
4   import org.kuali.rice.core.api.util.ConcreteKeyValue;
5   import org.kuali.rice.core.api.util.KeyValue;
6   import org.kuali.rice.krad.keyvalues.KeyValuesBase;
7   import org.kuali.rice.krad.service.KRADServiceLocator;
8   
9   import java.util.ArrayList;
10  import java.util.Collection;
11  import java.util.List;
12  
13  /**
14   *  OleBorrowerKeyValue returns BorrowerTypeId and BorrowerTypeName for OleBorrowerType.
15   */
16  public class OleCirculationLocationKeyValue extends KeyValuesBase {
17      /**
18       * This method will populate the code as a key and name as a value and return it as list
19       * @return keyValues(list)
20       */
21      @Override
22      public List getKeyValues() {
23          List<KeyValue> keyValues = new ArrayList<KeyValue>();
24          Collection<OleLocation> oleLocations = KRADServiceLocator.getBusinessObjectService().findAll(OleLocation.class);
25          keyValues.add(new ConcreteKeyValue("", ""));
26          for (OleLocation oleLocation : oleLocations) {
27              if("LIBRARY".equalsIgnoreCase(oleLocation.getLevelCode()))
28              keyValues.add(new ConcreteKeyValue(oleLocation.getLocationCode(),oleLocation.getLocationName()));
29  
30          }
31          return keyValues;
32      }
33  }