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     */
016    package org.kuali.ole.license.keyvalue;
017    
018    import org.kuali.ole.agreement.bo.OleAgreementMethod;
019    import org.kuali.rice.core.api.util.ConcreteKeyValue;
020    import org.kuali.rice.core.api.util.KeyValue;
021    import org.kuali.rice.krad.keyvalues.KeyValuesBase;
022    import org.kuali.rice.krad.service.KRADServiceLocator;
023    
024    import java.util.ArrayList;
025    import java.util.Collection;
026    import java.util.List;
027    
028    /**
029     * OleAgreementMethodKeyValues is the value finder class for OleAgreementMethod Maintenance Document
030     */
031    public class OleAgreementMethodKeyValues extends KeyValuesBase {
032    
033        private boolean blankOption;
034    
035        /**
036         *  Gets the blankOption attribute.
037         * @return  Returns the blankOption
038         */
039        public boolean isBlankOption() {
040            return this.blankOption;
041        }
042    
043        /**
044         * Sets the blankOption attribute value.
045         * @param blankOption The blankOption to set.
046         */
047        public void setBlankOption(boolean blankOption) {
048            this.blankOption = blankOption;
049        }
050    
051        /**
052         *  Gets the keyValues attribute.
053         * @return  Returns the keyValues
054         */
055        @Override
056        public List getKeyValues() {
057            List<KeyValue> keyValues = new ArrayList<KeyValue>();
058            Collection<OleAgreementMethod> oleAgreementMethodCollection = KRADServiceLocator.getBusinessObjectService().findAll(OleAgreementMethod.class);
059            keyValues.add(new ConcreteKeyValue("", ""));
060            for (OleAgreementMethod oleAgreementMethod : oleAgreementMethodCollection) {
061                keyValues.add(new ConcreteKeyValue(oleAgreementMethod.getAgreementMethodName(), oleAgreementMethod.getAgreementMethodName()));
062            }
063            return keyValues;
064        }
065    
066    }