1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.demo.course;
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
35
36
37 @Controller
38 @RequestMapping(value = "/courseOffering")
39 public class CourseOfferingController extends UifControllerBase {
40
41
42
43
44 @Override
45 protected CourseOfferingForm createInitialForm() {
46 return new CourseOfferingForm();
47 }
48
49
50
51
52 @Override
53 @RequestMapping(params = "methodToCall=start")
54 public ModelAndView start(UifFormBase form) {
55
56 Course course = new Course();
57 course.setSubjectId("CTWR");
58 course.setNumber("437");
59 course.setTitle("Writing the Situation Comedy Pilot");
60 course.setActivityType("Lecture");
61 course.setMinCredits(2);
62 course.setMaxCredits(4);
63 course.setGradingOptions("A-F");
64 course.setTranscriptTitle("Filmwriting");
65 course.setFee(new KualiDecimal(25));
66 course.setOfferingStatus("Active");
67
68 CourseSection section = new CourseSection();
69 section.setSection("001");
70 section.setRegistrationId("12345");
71
72 CourseInstructor instructor = new CourseInstructor();
73 instructor.setAffiliation("I");
74 instructor.setName("Dr. Neal");
75 section.getInstructors().add(instructor);
76
77 CourseInstructor instructor2 = new CourseInstructor();
78 instructor2.setAffiliation("I");
79 instructor2.setName("Dr. Smith");
80 section.getInstructors().add(instructor2);
81
82 section.setTerm("Su");
83
84 Calendar calendar = new GregorianCalendar(2009, 10, 14);
85 section.setStartDate(calendar.getTime());
86
87 Calendar endCalendar = new GregorianCalendar(2010, 5, 14);
88 section.setEndDate(endCalendar.getTime());
89
90 section.setStandardMeetingSchedule("A");
91 section.setStandardMeetingTime("A");
92 section.setAttendanceType("PA");
93
94 section.setBuilding("Adams");
95 section.setRoom("100");
96
97 section.setCourse(course);
98 course.getSections().add(section);
99
100 ((CourseOfferingForm) form).setCourseSection(section);
101
102 return super.start(form);
103 }
104 }