|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
   package org.kuali.rice.kns.lookup.keyvalues;  | 
  |  17 |     | 
     | 
  |  18 |     | 
   import java.util.ArrayList;  | 
  |  19 |     | 
   import java.util.Collections;  | 
  |  20 |     | 
   import java.util.Iterator;  | 
  |  21 |     | 
   import java.util.List;  | 
  |  22 |     | 
     | 
  |  23 |     | 
   import org.kuali.rice.core.util.KeyLabelPair;  | 
  |  24 |     | 
   import org.kuali.rice.kns.bo.CampusType;  | 
  |  25 |     | 
   import org.kuali.rice.kns.bo.CampusTypeImpl;  | 
  |  26 |     | 
   import org.kuali.rice.kns.service.KNSServiceLocator;  | 
  |  27 |     | 
   import org.kuali.rice.kns.service.KeyValuesService;  | 
  |  28 |     | 
     | 
  |  29 |     | 
     | 
  |  30 |     | 
     | 
  |  31 |     | 
     | 
  |  32 |     | 
     | 
  |  33 |     | 
     | 
  |  34 |    0 |    public class CampusTypeValuesFinder extends KeyValuesBase { | 
  |  35 |     | 
     | 
  |  36 |     | 
       public List getKeyValues() { | 
  |  37 |     | 
     | 
  |  38 |     | 
             | 
  |  39 |    0 |            KeyValuesService boService = KNSServiceLocator.getKeyValuesService();  | 
  |  40 |    0 |            List campusTypes = (List) boService.findAll(CampusTypeImpl.class);  | 
  |  41 |     | 
             | 
  |  42 |    0 |            if ( campusTypes == null ) { | 
  |  43 |    0 |                    campusTypes = new ArrayList<CampusTypeImpl>(0);  | 
  |  44 |     | 
           } else { | 
  |  45 |    0 |                    campusTypes = new ArrayList<CampusTypeImpl>( campusTypes );  | 
  |  46 |     | 
           }  | 
  |  47 |     | 
             | 
  |  48 |    0 |            CampusTypeComparator campusTypeComparator = new CampusTypeComparator();  | 
  |  49 |     | 
     | 
  |  50 |     | 
             | 
  |  51 |    0 |            Collections.sort(campusTypes, campusTypeComparator);  | 
  |  52 |     | 
     | 
  |  53 |     | 
             | 
  |  54 |    0 |            List labels = new ArrayList();  | 
  |  55 |     | 
     | 
  |  56 |    0 |            for (Iterator iter = campusTypes.iterator(); iter.hasNext();) { | 
  |  57 |    0 |                CampusType campusType = (CampusType) iter.next();  | 
  |  58 |    0 |                labels.add(new KeyLabelPair(campusType.getCampusTypeCode(), campusType.getCampusTypeCode() + " - " + campusType.getCampusTypeName()));  | 
  |  59 |    0 |            }  | 
  |  60 |     | 
     | 
  |  61 |    0 |            return labels;  | 
  |  62 |     | 
       }  | 
  |  63 |     | 
   }  |