1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.web.controller;
17
18 import javax.servlet.http.HttpServletRequest;
19 import javax.servlet.http.HttpServletResponse;
20
21 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
22 import org.kuali.rice.krad.service.KualiExceptionIncidentService;
23 import org.kuali.rice.krad.web.form.IncidentReportForm;
24 import org.kuali.rice.krad.web.form.UifFormBase;
25 import org.springframework.stereotype.Controller;
26 import org.springframework.validation.BindingResult;
27 import org.springframework.web.bind.annotation.ModelAttribute;
28 import org.springframework.web.bind.annotation.RequestMapping;
29 import org.springframework.web.bind.annotation.RequestMethod;
30 import org.springframework.web.servlet.ModelAndView;
31
32
33
34
35
36
37 @Controller
38 @RequestMapping(value = "/incidentReport")
39 public class IncidentReportController extends UifControllerBase {
40
41
42
43
44 @Override
45 protected IncidentReportForm createInitialForm(HttpServletRequest request) {
46 return new IncidentReportForm();
47 }
48
49
50
51
52 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=submitReport")
53 public ModelAndView submitReport(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
54 HttpServletRequest request, HttpServletResponse response) throws Exception {
55
56 KualiExceptionIncidentService reporterService = KRADServiceLocatorWeb.getKualiExceptionIncidentService();
57 reporterService.emailReport(((IncidentReportForm) uifForm).createEmailSubject(),
58 ((IncidentReportForm) uifForm).createEmailMessage());
59
60
61 return close(uifForm, result, request, response);
62 }
63
64 }