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