001package org.kuali.ole.describe.keyvalue;
002
003
004import org.kuali.ole.describe.bo.OleAccessMethod;
005import org.kuali.rice.core.api.util.ConcreteKeyValue;
006import org.kuali.rice.core.api.util.KeyValue;
007import org.kuali.rice.krad.keyvalues.KeyValuesBase;
008import org.kuali.rice.krad.service.KRADServiceLocator;
009
010import java.util.ArrayList;
011import java.util.Collection;
012import java.util.List;
013
014/**
015 * AdditionalAccessMethodInformation used to render the values for AccessMethod dropdown control.
016 */
017public class AdditionalAccessMethodInformation extends KeyValuesBase {
018    /**
019     * This method returns the List of  ConcreteKeyValue,
020     * ConcreteKeyValue has two arguments accessMethodCode  and
021     * accessMethodName.
022     *
023     * @return List<KeyValue>
024     */
025    @Override
026    public List<KeyValue> getKeyValues() {
027        List<KeyValue> options = new ArrayList<KeyValue>();
028        Collection<OleAccessMethod> oleAccessMethods =
029                KRADServiceLocator.getBusinessObjectService().findAll(OleAccessMethod.class);
030        options.add(new ConcreteKeyValue("", ""));
031        for (OleAccessMethod type : oleAccessMethods) {
032            options.add(new ConcreteKeyValue(type.getAccessMethodCode(), type.getAccessMethodName()));
033        }
034        return options;
035    }
036}