Coverage Report - edu.sampleu.student.web.controller.CourseOfferingController
 
Classes in this File Line Coverage Branch Coverage Complexity
CourseOfferingController
0%
0/39
N/A
1
 
 1  
 /**
 2  
  * Copyright 2005-2011 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.student.web.controller;
 17  
 
 18  
 import java.util.Calendar;
 19  
 import java.util.GregorianCalendar;
 20  
 
 21  
 import javax.servlet.http.HttpServletRequest;
 22  
 import javax.servlet.http.HttpServletResponse;
 23  
 
 24  
 import org.kuali.rice.core.api.util.type.KualiDecimal;
 25  
 import org.kuali.rice.krad.web.controller.UifControllerBase;
 26  
 import org.kuali.rice.krad.web.form.UifFormBase;
 27  
 import org.springframework.stereotype.Controller;
 28  
 import org.springframework.validation.BindingResult;
 29  
 import org.springframework.web.bind.annotation.ModelAttribute;
 30  
 import org.springframework.web.bind.annotation.RequestMapping;
 31  
 import org.springframework.web.bind.annotation.RequestMethod;
 32  
 import org.springframework.web.servlet.ModelAndView;
 33  
 
 34  
 import edu.sampleu.student.dataobject.Course;
 35  
 import edu.sampleu.student.dataobject.CourseInstructor;
 36  
 import edu.sampleu.student.dataobject.CourseSection;
 37  
 import edu.sampleu.student.web.form.CourseOfferingForm;
 38  
 
 39  
 /**
 40  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 41  
  */
 42  0
 @Controller
 43  
 @RequestMapping(value = "/courseOffering")
 44  0
 public class CourseOfferingController extends UifControllerBase {
 45  
 
 46  
     /**
 47  
      * @see org.kuali.rice.krad.web.controller.UifControllerBase#createInitialForm(javax.servlet.http.HttpServletRequest)
 48  
      */
 49  
     @Override
 50  
     protected CourseOfferingForm createInitialForm(HttpServletRequest request) {
 51  0
         return new CourseOfferingForm();
 52  
     }
 53  
 
 54  
     /**
 55  
      * Populate some data for demonstration
 56  
      */
 57  
     @Override
 58  
     @RequestMapping(method = RequestMethod.GET, params = "methodToCall=start")
 59  
     public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
 60  
             HttpServletRequest request, HttpServletResponse response) {
 61  
 
 62  0
         Course course = new Course();
 63  0
         course.setSubjectId("CTWR");
 64  0
         course.setNumber("437");
 65  0
         course.setTitle("Writing the Situation Comedy Pilot");
 66  0
         course.setActivityType("Lecture");
 67  0
         course.setMinCredits(2);
 68  0
         course.setMaxCredits(4);
 69  0
         course.setGradingOptions("A-F");
 70  0
         course.setTranscriptTitle("Filmwriting");
 71  0
         course.setFee(new KualiDecimal(25));
 72  0
         course.setOfferingStatus("Active");
 73  
 
 74  0
         CourseSection section = new CourseSection();
 75  0
         section.setSection("001");
 76  0
         section.setRegistrationId("12345");
 77  
 
 78  0
         CourseInstructor instructor = new CourseInstructor();
 79  0
         instructor.setAffiliation("I");
 80  0
         instructor.setName("Dr. Neal");
 81  0
         section.getInstructors().add(instructor);
 82  
 
 83  0
         CourseInstructor instructor2 = new CourseInstructor();
 84  0
         instructor2.setAffiliation("I");
 85  0
         instructor2.setName("Dr. Smith");
 86  0
         section.getInstructors().add(instructor2);
 87  
 
 88  0
         section.setTerm("Su");
 89  
 
 90  0
         Calendar calendar = new GregorianCalendar(2009, 10, 14);
 91  0
         section.setStartDate(calendar.getTime());
 92  
 
 93  0
         Calendar endCalendar = new GregorianCalendar(2010, 5, 14);
 94  0
         section.setEndDate(endCalendar.getTime());
 95  
 
 96  0
         section.setStandardMeetingSchedule("A");
 97  0
         section.setStandardMeetingTime("A");
 98  0
         section.setAttendanceType("PA");
 99  
 
 100  0
         section.setBuilding("Adams");
 101  0
         section.setRoom("100");
 102  
 
 103  0
         section.setCourse(course);
 104  0
         course.getSections().add(section);
 105  
 
 106  0
         ((CourseOfferingForm) form).setCourseSection(section);
 107  
 
 108  0
         return super.start(form, result, request, response);
 109  
     }
 110  
 }