1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
39
40 @Controller
41 @RequestMapping(value = "/registration")
42 public class RegistrationController extends UifControllerBase {
43
44
45
46
47 @Override
48 protected RegistrationForm createInitialForm(HttpServletRequest request) {
49 return new RegistrationForm();
50 }
51
52
53
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 RegistrationForm registrationForm = (RegistrationForm) form;
61 registrationForm.setRegistrationTerm("Fall");
62 registrationForm.setRegistrationYear(2011);
63
64 List<Course> courseListing = new ArrayList<Course>();
65
66 Course course = new Course();
67 course.setSubjectId("CTWR");
68 course.setNumber("106a");
69 course.setTitle("Screenwriting Fundamentals");
70 course.setMaxCredits(4);
71
72 CourseSection section = new CourseSection();
73 section.setSection("001");
74 section.setRegistrationId("19177D");
75 section.setStandardMeetingTime("10:00-12:50p | F");
76 section.setRegisteredNumber(0);
77 section.setWaitlistNumber(1);
78 section.setTotalMaxEnrollment(14);
79 section.setInstructor("Mardik Martin");
80 section.setLocation("RZC119");
81 course.getSections().add(section);
82
83 CourseSection section2 = new CourseSection();
84 section2.setSection("001");
85 section2.setRegistrationId("19179D");
86 section2.setStandardMeetingTime("4:00-6:50p | W");
87 section2.setRegisteredNumber(0);
88 section2.setWaitlistNumber(7);
89 section2.setTotalMaxEnrollment(17);
90 section2.setInstructor("Noreen Stone");
91 section2.setLocation("RZC119");
92 course.getSections().add(section2);
93 courseListing.add(course);
94
95 Course course2 = new Course();
96 course2.setSubjectId("CTWR");
97 course2.setNumber("206a");
98 course2.setTitle("Writing the Screenplay");
99 course2.setMaxCredits(4);
100 course2.getSections().add(section);
101 course2.getSections().add(section2);
102 courseListing.add(course2);
103
104 Course course3 = new Course();
105 course3.setSubjectId("CTWR");
106 course3.setNumber("305");
107 course3.setTitle("Writing To Be Performed");
108 course3.setMaxCredits(2);
109 course3.getSections().add(section);
110 course3.getSections().add(section2);
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 courseListing.add(course3);
132 courseListing.add(course3);
133 courseListing.add(course3);
134
135 registrationForm.setCourseListing(courseListing);
136
137 return super.start(form, result, request, response);
138 }
139 }