View Javadoc

1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.sampleu.travel.document.keyvalue;
17  
18  import org.kuali.rice.core.api.CoreApiServiceLocator;
19  import org.kuali.rice.core.api.util.ConcreteKeyValue;
20  import org.kuali.rice.core.api.util.KeyValue;
21  import org.kuali.rice.krad.uif.util.UrlInfo;
22  import org.kuali.rice.krad.uif.util.UifKeyValueLocation;
23  
24  import java.util.ArrayList;
25  import java.util.List;
26  
27  /**
28   * Test class for KeyValueLocations KeyValuesFinder
29   */
30  public class SimpleTestKeyValueLocations extends SimpleTestKeyValues {
31  
32      /**
33       * This is a fake implementation of a key value finder, normally this would make a request to
34       * a database to obtain the necessary values.  Used only for testing.
35       *
36       * @see org.kuali.rice.krad.keyvalues.KeyValuesFinder#getKeyValues()
37       */
38      @Override
39      public List<KeyValue> getKeyValues() {
40          List<KeyValue> keyValues = new ArrayList<KeyValue>();
41          if (this.isBlankOption()) {
42              keyValues.add(new ConcreteKeyValue("", ""));
43          }
44  
45          String baseUrl = CoreApiServiceLocator.getKualiConfigurationService().getPropertyValueAsString("krad.url");
46  
47          keyValues.add(new UifKeyValueLocation("Google", "Google", new UrlInfo("http://www.google.com")));
48          keyValues.add(new UifKeyValueLocation("Kuali", "Kuali", new UrlInfo("http://www.kuali.org")));
49          keyValues.add(new UifKeyValueLocation("Jira", "Jira", new UrlInfo("http://jira.kuali.org")));
50          keyValues.add(new UifKeyValueLocation("Config", "Config Test View",
51                  new UrlInfo(baseUrl,"/uicomponents","ConfigurationTestView","start")));
52  
53          return keyValues;
54      }
55  }