Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TravelRequestType |
|
| 4.0;4 |
1 | /* | |
2 | * Copyright 2007 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 java.util.ArrayList; | |
19 | import java.util.List; | |
20 | ||
21 | import org.kuali.rice.core.util.KeyLabelPair; | |
22 | import org.kuali.rice.kns.document.Document; | |
23 | import org.kuali.rice.kns.lookup.keyvalues.KeyValuesBase; | |
24 | import org.kuali.rice.kns.util.GlobalVariables; | |
25 | import org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase; | |
26 | import org.kuali.rice.kns.web.struts.form.KualiForm; | |
27 | ||
28 | 0 | public class TravelRequestType extends KeyValuesBase { |
29 | ||
30 | public List getKeyValues() { | |
31 | 0 | List<KeyLabelPair> keyValues = new ArrayList<KeyLabelPair>(); |
32 | ||
33 | 0 | keyValues.add(new KeyLabelPair("", "")); |
34 | 0 | keyValues.add(new KeyLabelPair("TRT1", "Travel Request Type 1")); |
35 | 0 | keyValues.add(new KeyLabelPair("TRT2", "Travel Request Type 2")); |
36 | ||
37 | // This should populate Type 3 only if we can get the form from GlobalVariables | |
38 | // and if we can get the document from the form and the document is not null; | |
39 | // this should be true when this ValuesFinder is used within the context of the webapp. | |
40 | 0 | KualiForm form = GlobalVariables.getKualiForm(); |
41 | 0 | if ((form != null) && (form instanceof KualiDocumentFormBase)) { |
42 | 0 | Document doc =((KualiDocumentFormBase)form).getDocument(); |
43 | 0 | if (doc != null) { |
44 | 0 | keyValues.add(new KeyLabelPair("TRT3", "Travel Request Type 3")); |
45 | } | |
46 | } | |
47 | ||
48 | 0 | return keyValues; |
49 | } | |
50 | ||
51 | } |