Coverage Report - org.kuali.student.enrollment.class2.acal.keyvalue.AcademicTermStateKeyValues
 
Classes in this File Line Coverage Branch Coverage Complexity
AcademicTermStateKeyValues
0%
0/17
0%
0/4
2.5
 
 1  
 package org.kuali.student.enrollment.class2.acal.keyvalue;
 2  
 
 3  
 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
 4  
 import org.kuali.rice.core.api.util.ConcreteKeyValue;
 5  
 import org.kuali.rice.core.api.util.KeyValue;
 6  
 import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
 7  
 import org.kuali.rice.krad.uif.view.ViewModel;
 8  
 import org.kuali.student.enrollment.acal.service.AcademicCalendarService;
 9  
 import org.kuali.student.r2.common.constants.CommonServiceConstants;
 10  
 import org.kuali.student.r2.common.dto.ContextInfo;
 11  
 import org.kuali.student.r2.core.state.dto.StateInfo;
 12  
 import org.kuali.student.mock.utilities.TestHelper;
 13  
 
 14  
 import javax.xml.namespace.QName;
 15  
 import java.io.Serializable;
 16  
 import java.util.ArrayList;
 17  
 import java.util.List;
 18  
 
 19  0
 public class AcademicTermStateKeyValues extends UifKeyValuesFinderBase implements Serializable {
 20  
 
 21  
     private static final long serialVersionUID = 1L;
 22  
 
 23  
     private transient AcademicCalendarService acalService;
 24  
 
 25  
     @Override
 26  
     public List<KeyValue> getKeyValues(ViewModel model) {
 27  
 
 28  0
         List<KeyValue> keyValues = new ArrayList<KeyValue>();
 29  
 
 30  
         //TODO:Build real context.
 31  0
         ContextInfo context = TestHelper.getContext1();
 32  
 
 33  
 
 34  
         try {
 35  0
             List<StateInfo> states = getAcalService().getTermStates(context);
 36  0
             for (StateInfo state : states) {
 37  0
                 ConcreteKeyValue keyValue = new ConcreteKeyValue();
 38  0
                 keyValue.setKey(state.getKey());
 39  0
                 keyValue.setValue(state.getName());
 40  0
                 keyValues.add(keyValue);
 41  0
             }
 42  0
         } catch (Exception e) {
 43  0
             e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
 44  0
         }
 45  
 
 46  0
         return keyValues;
 47  
     }
 48  
 
 49  
     public AcademicCalendarService getAcalService() {
 50  0
         if(acalService == null) {
 51  0
             acalService = (AcademicCalendarService) GlobalResourceLoader.getService(new QName(CommonServiceConstants.REF_OBJECT_URI_GLOBAL_PREFIX + "acal", "AcademicCalendarService"));
 52  
         }
 53  0
         return this.acalService;
 54  
     }
 55  
 }