Coverage Report - org.kuali.rice.kns.web.spring.controller.IncidentReportController
 
Classes in this File Line Coverage Branch Coverage Complexity
IncidentReportController
0%
0/5
N/A
1
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl1.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kns.web.spring.controller;
 17  
 
 18  
 import javax.servlet.http.HttpServletRequest;
 19  
 import javax.servlet.http.HttpServletResponse;
 20  
 
 21  
 import org.kuali.rice.kns.service.KNSServiceLocatorWeb;
 22  
 import org.kuali.rice.kns.service.KualiExceptionIncidentService;
 23  
 import org.kuali.rice.kns.web.spring.form.IncidentReportForm;
 24  
 import org.kuali.rice.kns.web.spring.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  
  * Handler for incident reports
 34  
  * 
 35  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 36  
  */
 37  
 @Controller
 38  
 @RequestMapping(value = "/incidentReport")
 39  0
 public class IncidentReportController extends UifControllerBase {
 40  
 
 41  
     @Override
 42  
     protected UifFormBase createInitialForm(HttpServletRequest request) {
 43  0
         return new IncidentReportForm();
 44  
     }
 45  
 
 46  
     /**
 47  
      * Emails the report and closes the incident report screen
 48  
      */
 49  
     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=submitReport")
 50  
     public ModelAndView submitReport(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
 51  
             HttpServletRequest request, HttpServletResponse response) throws Exception {
 52  
         // get the exception incident service and use it to mail the report
 53  0
         KualiExceptionIncidentService reporterService = KNSServiceLocatorWeb.getKualiExceptionIncidentService();
 54  0
         reporterService.emailReport(((IncidentReportForm) uifForm).createEmailSubject(),
 55  
                 ((IncidentReportForm) uifForm).createEmailMessage());
 56  
 
 57  
         // return the close redirect
 58  0
         return close(uifForm, result, request, response);
 59  
     }
 60  
 
 61  
 }