Coverage Report - edu.sampleu.student.web.controller.RegistrationController
 
Classes in this File Line Coverage Branch Coverage Complexity
RegistrationController
0%
0/73
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.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import javax.servlet.http.HttpServletRequest;
 22  
 import javax.servlet.http.HttpServletResponse;
 23  
 
 24  
 import org.kuali.rice.krad.web.controller.UifControllerBase;
 25  
 import org.kuali.rice.krad.web.form.UifFormBase;
 26  
 import org.springframework.stereotype.Controller;
 27  
 import org.springframework.validation.BindingResult;
 28  
 import org.springframework.web.bind.annotation.ModelAttribute;
 29  
 import org.springframework.web.bind.annotation.RequestMapping;
 30  
 import org.springframework.web.bind.annotation.RequestMethod;
 31  
 import org.springframework.web.servlet.ModelAndView;
 32  
 
 33  
 import edu.sampleu.student.dataobject.Course;
 34  
 import edu.sampleu.student.dataobject.CourseSection;
 35  
 import edu.sampleu.student.web.form.RegistrationForm;
 36  
 
 37  
 /**
 38  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 39  
  */
 40  0
 @Controller
 41  
 @RequestMapping(value = "/registration")
 42  0
 public class RegistrationController extends UifControllerBase {
 43  
 
 44  
     /**
 45  
      * @see org.kuali.rice.krad.web.controller.UifControllerBase#createInitialForm(javax.servlet.http.HttpServletRequest)
 46  
      */
 47  
     @Override
 48  
     protected RegistrationForm createInitialForm(HttpServletRequest request) {
 49  0
         return new RegistrationForm();
 50  
     }
 51  
 
 52  
     /**
 53  
      * Populate some data for demonstration
 54  
      */
 55  
     @Override
 56  
     @RequestMapping(method = RequestMethod.GET, params = "methodToCall=start")
 57  
     public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
 58  
             HttpServletRequest request, HttpServletResponse response) {
 59  
 
 60  0
         RegistrationForm registrationForm = (RegistrationForm) form;
 61  0
         registrationForm.setRegistrationTerm("Fall");
 62  0
         registrationForm.setRegistrationYear(2011);
 63  
 
 64  0
         List<Course> courseListing = new ArrayList<Course>();
 65  
 
 66  0
         Course course = new Course();
 67  0
         course.setSubjectId("CTWR");
 68  0
         course.setNumber("106a");
 69  0
         course.setTitle("Screenwriting Fundamentals");
 70  0
         course.setMaxCredits(4);
 71  
 
 72  0
         CourseSection section = new CourseSection();
 73  0
         section.setSection("001");
 74  0
         section.setRegistrationId("19177D");
 75  0
         section.setStandardMeetingTime("10:00-12:50p | F");
 76  0
         section.setRegisteredNumber(0);
 77  0
         section.setWaitlistNumber(1);
 78  0
         section.setTotalMaxEnrollment(14);
 79  0
         section.setInstructor("Mardik Martin");
 80  0
         section.setLocation("RZC119");
 81  0
         course.getSections().add(section);
 82  
 
 83  0
         CourseSection section2 = new CourseSection();
 84  0
         section2.setSection("001");
 85  0
         section2.setRegistrationId("19179D");
 86  0
         section2.setStandardMeetingTime("4:00-6:50p | W");
 87  0
         section2.setRegisteredNumber(0);
 88  0
         section2.setWaitlistNumber(7);
 89  0
         section2.setTotalMaxEnrollment(17);
 90  0
         section2.setInstructor("Noreen Stone");
 91  0
         section2.setLocation("RZC119");
 92  0
         course.getSections().add(section2);
 93  0
         courseListing.add(course);
 94  
 
 95  0
         Course course2 = new Course();
 96  0
         course2.setSubjectId("CTWR");
 97  0
         course2.setNumber("206a");
 98  0
         course2.setTitle("Writing the Screenplay");
 99  0
         course2.setMaxCredits(4);
 100  0
         course2.getSections().add(section);
 101  0
         course2.getSections().add(section2);
 102  0
         courseListing.add(course2);
 103  
 
 104  0
         Course course3 = new Course();
 105  0
         course3.setSubjectId("CTWR");
 106  0
         course3.setNumber("305");
 107  0
         course3.setTitle("Writing To Be Performed");
 108  0
         course3.setMaxCredits(2);
 109  0
         course3.getSections().add(section);
 110  0
         course3.getSections().add(section2);
 111  0
         courseListing.add(course3);
 112  0
         courseListing.add(course3);
 113  0
         courseListing.add(course3);
 114  0
         courseListing.add(course3);
 115  0
         courseListing.add(course3);
 116  0
         courseListing.add(course3);
 117  0
         courseListing.add(course3);
 118  0
         courseListing.add(course3);
 119  0
         courseListing.add(course3);
 120  0
         courseListing.add(course3);
 121  0
         courseListing.add(course3);
 122  0
         courseListing.add(course3);
 123  0
         courseListing.add(course3);
 124  0
         courseListing.add(course3);
 125  0
         courseListing.add(course3);
 126  0
         courseListing.add(course3);
 127  0
         courseListing.add(course3);
 128  0
         courseListing.add(course3);
 129  0
         courseListing.add(course3);
 130  0
         courseListing.add(course3);
 131  0
         courseListing.add(course3);
 132  0
         courseListing.add(course3);
 133  0
         courseListing.add(course3);
 134  
 
 135  0
         registrationForm.setCourseListing(courseListing);
 136  
 
 137  0
         return super.start(form, result, request, response);
 138  
     }
 139  
 }