@Override public List<KeyValue> getKeyValues() { BusinessObjectService boService = KraServiceLocator.getService(BusinessObjectService.class); Collection<UnitAdministratorType> types = (Collection<UnitAdministratorType>) boService.findAll(UnitAdministratorType.class); List<KeyValue> keyValues = new ArrayList<KeyValue>(); for (UnitAdministratorType aType : types) { if (aType .getDefaultGroupFlag() .equals(Constants.UNIT_CONTACTS_DEFAULT_GROUP_FLAG)) { // only get Unit Contacts keyValues.add( new ConcreteKeyValue(aType.getUnitAdministratorTypeCode(), aType.getDescription())); } } keyValues.add( 0, new ConcreteKeyValue( PrefixValuesFinder.getPrefixKey(), PrefixValuesFinder.getDefaultPrefixValue())); return keyValues; }
/** * Constructs the list of Iacuc Protocol Procedure Category Types. Each entry in the list is a * <key, value> pair, where the "key" is the unique procedure category code and the "value" * is the textual description that is viewed by a user. The list is obtained from the * IACUC_PROCEDURE_CATEGORY database table via the "KeyValuesService". * * @return the list of <key, value> pairs of abstract types. The first entry is always * <"", "select:">. * @see org.kuali.rice.krad.keyvalues.KeyValuesFinder#getKeyValues() */ @Override public List<KeyValue> getKeyValues() { Collection<IacucProcedureCategory> iacucProcedureCategories = getKeyValuesService() .findAllOrderBy(IacucProcedureCategory.class, "procedureCategoryCode", true); List<KeyValue> keyValues = new ArrayList<KeyValue>(); keyValues.add( 0, new ConcreteKeyValue( PrefixValuesFinder.getPrefixKey(), PrefixValuesFinder.getDefaultPrefixValue())); for (Iterator<IacucProcedureCategory> iter = iacucProcedureCategories.iterator(); iter.hasNext(); ) { IacucProcedureCategory iacucProcedureCategory = (IacucProcedureCategory) iter.next(); if (iacucProcedureCategory.isActive()) { keyValues.add( new ConcreteKeyValue( iacucProcedureCategory.getProcedureCategoryCode().toString(), iacucProcedureCategory.getProcedureCategory())); } } return keyValues; }