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