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 edu.sampleu.student.dataobject.Course;
19 import edu.sampleu.student.dataobject.CourseSection;
20 import edu.sampleu.student.web.form.RegistrationForm;
21 import org.kuali.rice.core.api.util.type.KualiDecimal;
22 import org.kuali.rice.krad.uif.util.CloneUtils;
23 import org.kuali.rice.krad.util.ObjectUtils;
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 javax.servlet.http.HttpServletRequest;
34 import javax.servlet.http.HttpServletResponse;
35 import java.util.ArrayList;
36 import java.util.List;
37
38
39
40
41 @Controller
42 @RequestMapping(value = "/registration")
43 public class RegistrationController extends UifControllerBase {
44
45 @Override
46 protected Class<RegistrationForm> formType() {
47 return RegistrationForm.class;
48 }
49
50
51
52
53 @Override
54 @RequestMapping(method = RequestMethod.GET, params = "methodToCall=start")
55 public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
56 HttpServletRequest request, HttpServletResponse response) {
57
58 RegistrationForm registrationForm = (RegistrationForm) form;
59 registrationForm.setRegistrationTerm("Fall");
60 registrationForm.setRegistrationYear(2011);
61
62 List<Course> courseListing = new ArrayList<Course>();
63
64 Course course = new Course();
65 course.setSubjectId("CTWR");
66 course.setNumber("106a");
67 course.setTitle("Screenwriting Fundamentals");
68 course.setMaxCredits(4);
69
70 CourseSection section = new CourseSection();
71 section.setSection("001");
72 section.setRegistrationId("19177D");
73 section.setStandardMeetingTime("10:00-12:50p | F");
74 section.setRegisteredNumber(0);
75 section.setWaitlistNumber(1);
76 section.setTotalMaxEnrollment(14);
77 section.setInstructor("Mardik Martin");
78 section.setLocation("RZC119");
79 course.getSections().add(section);
80
81 CourseSection section2 = new CourseSection();
82 section2.setSection("001");
83 section2.setRegistrationId("19179D");
84 section2.setStandardMeetingTime("4:00-6:50p | W");
85 section2.setRegisteredNumber(0);
86 section2.setWaitlistNumber(7);
87 section2.setTotalMaxEnrollment(17);
88 section2.setInstructor("Noreen Stone");
89 section2.setLocation("RZC119");
90 course.getSections().add(section2);
91 courseListing.add(course);
92
93 Course course2 = new Course();
94 course2.setSubjectId("CTWR");
95 course2.setNumber("206a");
96 course2.setTitle("Writing the Screenplay");
97 course2.setMaxCredits(4);
98 course2.getSections().add(section);
99 course2.getSections().add(section2);
100 courseListing.add(course2);
101
102 Course course3 = new Course();
103 course3.setSubjectId("CTWR");
104 course3.setNumber("305");
105 course3.setTitle("Writing To Be Performed");
106 course3.setMaxCredits(2);
107 course3.getSections().add(section);
108 course3.getSections().add(section2);
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 courseListing.add(course3);
132
133 registrationForm.setCourseListing(courseListing);
134
135 return super.start(form, result, request, response);
136 }
137 }