001/**
002 * Copyright 2005-2014 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 edu.sampleu.travel.document.keyvalue;
017
018import org.kuali.rice.core.api.CoreApiServiceLocator;
019import org.kuali.rice.core.api.util.ConcreteKeyValue;
020import org.kuali.rice.core.api.util.KeyValue;
021import org.kuali.rice.krad.uif.util.UrlInfo;
022import org.kuali.rice.krad.uif.util.UifKeyValueLocation;
023
024import java.util.ArrayList;
025import java.util.List;
026
027/**
028 * Test class for KeyValueLocations KeyValuesFinder
029 */
030public class SimpleTestKeyValueLocations extends SimpleTestKeyValues {
031
032    /**
033     * This is a fake implementation of a key value finder, normally this would make a request to
034     * a database to obtain the necessary values.  Used only for testing.
035     *
036     * @see org.kuali.rice.krad.keyvalues.KeyValuesFinder#getKeyValues()
037     */
038    @Override
039    public List<KeyValue> getKeyValues() {
040        List<KeyValue> keyValues = new ArrayList<KeyValue>();
041        if (this.isBlankOption()) {
042            keyValues.add(new ConcreteKeyValue("", ""));
043        }
044
045        String baseUrl = CoreApiServiceLocator.getKualiConfigurationService().getPropertyValueAsString("krad.url");
046
047        keyValues.add(new UifKeyValueLocation("Google", "Google", new UrlInfo("http://www.google.com")));
048        keyValues.add(new UifKeyValueLocation("Kuali", "Kuali", new UrlInfo("http://www.kuali.org")));
049        keyValues.add(new UifKeyValueLocation("Jira", "Jira", new UrlInfo("http://jira.kuali.org")));
050        keyValues.add(new UifKeyValueLocation("Config", "Config Test View",
051                new UrlInfo(baseUrl,"/uicomponents","ConfigurationTestView","start")));
052
053        return keyValues;
054    }
055}