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