| 1 |  |  package org.kuali.student.core.enumerationmanagement.bo.options; | 
  | 2 |  |   | 
  | 3 |  |  import java.util.ArrayList; | 
  | 4 |  |  import java.util.Collection; | 
  | 5 |  |  import java.util.HashMap; | 
  | 6 |  |  import java.util.Iterator; | 
  | 7 |  |  import java.util.List; | 
  | 8 |  |  import java.util.Map; | 
  | 9 |  |   | 
  | 10 |  |  import org.kuali.rice.core.util.KeyLabelPair; | 
  | 11 |  |  import org.kuali.rice.kns.lookup.keyvalues.KeyValuesBase; | 
  | 12 |  |  import org.kuali.rice.kns.service.BusinessObjectService; | 
  | 13 |  |  import org.kuali.rice.kns.service.KNSServiceLocator; | 
  | 14 |  |  import org.kuali.student.core.enumerationmanagement.bo.EnumeratedValue; | 
  | 15 |  |   | 
  | 16 |  |   | 
  | 17 |  |   | 
  | 18 |  |   | 
  | 19 |  |   | 
  | 20 |  |   | 
  | 21 |  |   | 
  | 22 | 0 |  public abstract class EnumerationCodeValuesFinderBase extends KeyValuesBase { | 
  | 23 |  |       | 
  | 24 |  |      @SuppressWarnings("unchecked") | 
  | 25 |  |      @Override | 
  | 26 |  |      public List<KeyLabelPair> getKeyValues() { | 
  | 27 | 0 |          List<KeyLabelPair> labels = new ArrayList<KeyLabelPair>(); | 
  | 28 | 0 |          Map<String, Object> criteria = new HashMap<String,Object>(); | 
  | 29 |  |           | 
  | 30 | 0 |          criteria.put(EnumeratedValue.ENUMERATION_KEY, getEnumerationKey()); | 
  | 31 | 0 |          BusinessObjectService boService = KNSServiceLocator.getBusinessObjectService(); | 
  | 32 | 0 |          Collection<EnumeratedValue> values = boService.findMatching(EnumeratedValue.class, criteria); | 
  | 33 |  |           | 
  | 34 | 0 |          Iterator<EnumeratedValue> iterator = values.iterator();  | 
  | 35 | 0 |          while(iterator.hasNext()) { | 
  | 36 | 0 |              EnumeratedValue value = iterator.next(); | 
  | 37 | 0 |              labels.add(new KeyLabelPair(value.getCode(), value.getValue())); | 
  | 38 | 0 |          } | 
  | 39 |  |           | 
  | 40 | 0 |          return labels; | 
  | 41 |  |      } | 
  | 42 |  |       | 
  | 43 |  |      public abstract String getEnumerationKey(); | 
  | 44 |  |   | 
  | 45 |  |  } |