View Javadoc

1   package org.kuali.student.enrollment.class2.population.controller;
2   
3   import org.kuali.rice.krad.web.controller.MaintenanceDocumentController;
4   import org.kuali.rice.krad.web.form.MaintenanceForm;
5   import org.kuali.student.enrollment.class2.population.dto.PopulationWrapper;
6   import org.springframework.stereotype.Controller;
7   import org.springframework.validation.BindingResult;
8   import org.springframework.web.bind.annotation.ModelAttribute;
9   import org.springframework.web.bind.annotation.RequestMapping;
10  import org.springframework.web.servlet.ModelAndView;
11  
12  import javax.servlet.http.HttpServletRequest;
13  import javax.servlet.http.HttpServletResponse;
14  
15  /**
16   * This class is a basic controller for managing Populations.
17   * The two custom methods set values on the wrapper based on if the population is rule based or not.
18   *
19   * @author Kuali Student Team
20   */
21  @Controller
22  @RequestMapping(value = "/population")
23  public class PopulationController extends MaintenanceDocumentController {
24  
25      @RequestMapping(params = "methodToCall=createByRule")
26      public ModelAndView createByRule(@ModelAttribute("KualiForm") MaintenanceForm form, @SuppressWarnings("unused") BindingResult result,
27                                            @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
28  
29          PopulationWrapper wrapper = (PopulationWrapper)form.getDocument().getNewMaintainableObject().getDataObject();
30  
31          wrapper.setCreateByRule(true);
32          return getUIFModelAndView(form);
33      }
34  
35      @RequestMapping(params = "methodToCall=createByCombiningPopulations")
36      public ModelAndView createByCombiningPopulations (@ModelAttribute("KualiForm") MaintenanceForm form, @SuppressWarnings("unused") BindingResult result,
37                                                        @SuppressWarnings("unused") HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
38          PopulationWrapper wrapper = (PopulationWrapper)form.getDocument().getNewMaintainableObject().getDataObject();
39          wrapper.setCreateByRule(false);
40          wrapper.setEnableCreateButton(false);
41          return getUIFModelAndView(form);
42  
43      }
44  }