001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package edu.sampleu.demo.registration; 017 018import java.util.ArrayList; 019import java.util.List; 020 021import javax.servlet.http.HttpServletRequest; 022import javax.servlet.http.HttpServletResponse; 023 024import edu.sampleu.demo.course.Course; 025import edu.sampleu.demo.course.CourseSection; 026import org.kuali.rice.krad.web.controller.UifControllerBase; 027import org.kuali.rice.krad.web.form.UifFormBase; 028import org.springframework.stereotype.Controller; 029import org.springframework.validation.BindingResult; 030import org.springframework.web.bind.annotation.ModelAttribute; 031import org.springframework.web.bind.annotation.RequestMapping; 032import org.springframework.web.bind.annotation.RequestMethod; 033import org.springframework.web.servlet.ModelAndView; 034 035/** 036 * @author Kuali Rice Team (rice.collab@kuali.org) 037 */ 038@Controller 039@RequestMapping(value = "/registration") 040public class RegistrationController extends UifControllerBase { 041 042 /** 043 * @see org.kuali.rice.krad.web.controller.UifControllerBase#createInitialForm(javax.servlet.http.HttpServletRequest) 044 */ 045 @Override 046 protected RegistrationForm createInitialForm() { 047 return new RegistrationForm(); 048 } 049 050 /** 051 * Populate some data for demonstration 052 */ 053 @Override 054 @RequestMapping(method = RequestMethod.GET, params = "methodToCall=start") 055 public ModelAndView start(UifFormBase form) { 056 057 RegistrationForm registrationForm = (RegistrationForm) form; 058 registrationForm.setRegistrationTerm("Fall"); 059 registrationForm.setRegistrationYear(2011); 060 061 List<Course> courseListing = new ArrayList<Course>(); 062 063 Course course = new Course(); 064 course.setSubjectId("CTWR"); 065 course.setNumber("106a"); 066 course.setTitle("Screenwriting Fundamentals"); 067 course.setMaxCredits(4); 068 069 CourseSection section = new CourseSection(); 070 section.setSection("001"); 071 section.setRegistrationId("19177D"); 072 section.setStandardMeetingTime("10:00-12:50p | F"); 073 section.setRegisteredNumber(0); 074 section.setWaitlistNumber(1); 075 section.setTotalMaxEnrollment(14); 076 section.setInstructor("Mardik Martin"); 077 section.setLocation("RZC119"); 078 course.getSections().add(section); 079 080 CourseSection section2 = new CourseSection(); 081 section2.setSection("001"); 082 section2.setRegistrationId("19179D"); 083 section2.setStandardMeetingTime("4:00-6:50p | W"); 084 section2.setRegisteredNumber(0); 085 section2.setWaitlistNumber(7); 086 section2.setTotalMaxEnrollment(17); 087 section2.setInstructor("Noreen Stone"); 088 section2.setLocation("RZC119"); 089 course.getSections().add(section2); 090 courseListing.add(course); 091 092 Course course2 = new Course(); 093 course2.setSubjectId("CTWR"); 094 course2.setNumber("206a"); 095 course2.setTitle("Writing the Screenplay"); 096 course2.setMaxCredits(4); 097 course2.getSections().add(section); 098 course2.getSections().add(section2); 099 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}