001package org.kuali.ole.describe.keyvalue;
002
003import org.kuali.ole.describe.bo.ImportBibUserPreferences;
004import org.kuali.rice.core.api.util.ConcreteKeyValue;
005import org.kuali.rice.core.api.util.KeyValue;
006import org.kuali.rice.krad.service.KRADServiceLocator;
007import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
008import org.kuali.rice.krad.uif.view.ViewModel;
009
010import java.util.ArrayList;
011import java.util.Collection;
012import java.util.List;
013
014/**
015 * Created with IntelliJ IDEA.
016 * User: PJ7789
017 * Date: 30/11/12
018 * Time: 5:12 PM
019 * To change this template use File | Settings | File Templates.
020 */
021public class ImportBibKeyValueFinder
022        extends UifKeyValuesFinderBase {
023    @Override
024    public List<KeyValue> getKeyValues(ViewModel viewModel) {
025        List<KeyValue> options = new ArrayList<KeyValue>();
026        Collection<ImportBibUserPreferences> importBibUserPreferences = KRADServiceLocator.getBusinessObjectService()
027                .findAll(
028                        ImportBibUserPreferences.class);
029        for (ImportBibUserPreferences userPref : importBibUserPreferences) {
030            options.add(new ConcreteKeyValue(String.valueOf(userPref.getPrefId()), userPref.getPrefName()));
031        }
032        return options;
033    }
034}