001/**
002 * Copyright 2005-2012 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.ole.ingest.keyvalue;
017
018import org.kuali.rice.core.api.util.ConcreteKeyValue;
019import org.kuali.rice.core.api.util.KeyValue;
020import org.kuali.rice.krad.keyvalues.KeyValuesBase;
021import org.kuali.rice.krad.service.KRADServiceLocator;
022import org.kuali.rice.krms.impl.repository.AgendaBo;
023
024import java.util.ArrayList;
025import java.util.Collection;
026import java.util.List;
027
028/**
029 * AgendaKeyValues is the value finder class
030 */
031public class AgendaKeyValues extends KeyValuesBase {
032
033    private boolean blankOption;
034
035    public boolean isBlankOption() {
036        return this.blankOption;
037    }
038
039    /**
040     * @param blankOption the blankOption to set
041     */
042    public void setBlankOption(boolean blankOption) {
043        this.blankOption = blankOption;
044    }
045
046    /**
047     * This method returns the List of ConcreteKeyValue,
048     * ConcreteKeyValue has two arguments Code and
049     * Name.
050     * @return  List<KeyValue>
051     */
052    @Override
053    public List getKeyValues() {
054        List<KeyValue> keyValues = new ArrayList<KeyValue>();
055        Collection<AgendaBo> agendaBo = KRADServiceLocator.getBusinessObjectService().findAll(AgendaBo.class);
056        keyValues.add(new ConcreteKeyValue("", ""));
057        for (AgendaBo typ : agendaBo) {
058            keyValues.add(new ConcreteKeyValue(typ.getName(), typ.getName()));
059        }
060        return keyValues;
061    }
062
063}