View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.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/ecl2.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.krad.inquiry;
17  
18  import org.kuali.rice.krad.util.KRADConstants;
19  import org.kuali.rice.krad.web.controller.UifControllerBase;
20  import org.kuali.rice.krad.web.form.InquiryForm;
21  import org.kuali.rice.krad.web.service.ControllerService;
22  import org.springframework.beans.factory.annotation.Autowired;
23  import org.springframework.beans.factory.annotation.Qualifier;
24  import org.springframework.stereotype.Controller;
25  import org.springframework.web.bind.annotation.RequestMapping;
26  import org.springframework.web.bind.annotation.RequestMethod;
27  import org.springframework.web.servlet.ModelAndView;
28  
29  import javax.servlet.http.HttpServletRequest;
30  import javax.servlet.http.HttpServletResponse;
31  
32  /**
33   * Controller for inquiry views which handle initial requests for the inquiry and
34   * actions coming from the inquiry view such as export.
35   *
36   * @author Kuali Rice Team (rice.collab@kuali.org)
37   */
38  @Controller
39  @RequestMapping(value = KRADConstants.ControllerMappings.INQUIRY)
40  public class InquiryController extends UifControllerBase {
41  
42      /**
43       * {@inheritDoc}
44       */
45      @Override
46      protected InquiryForm createInitialForm() {
47          return new InquiryForm();
48      }
49  
50      /**
51       * @see org.kuali.rice.krad.inquiry.InquiryControllerService#downloadDataObjectAttachment(org.kuali.rice.krad.web.form.InquiryForm,
52       * javax.servlet.http.HttpServletResponse)
53       */
54      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=downloadDataObjectAttachment")
55      public ModelAndView downloadDataObjectAttachment(InquiryForm form, HttpServletResponse response) {
56          getControllerService().downloadDataObjectAttachment(form, response);
57  
58          return null;
59      }
60  
61      /**
62       * @see org.kuali.rice.krad.inquiry.InquiryControllerService#downloadCustomDataObjectAttachment(org.kuali.rice.krad.web.form.InquiryForm,
63       * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
64       */
65      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=downloadCustomDataObjectAttachment")
66      public ModelAndView downloadCustomDataObjectAttachment(InquiryForm form, HttpServletRequest request,
67              HttpServletResponse response) throws Exception {
68          getControllerService().downloadCustomDataObjectAttachment(form, request, response);
69  
70          return null;
71      }
72  
73      @Override
74      protected InquiryControllerService getControllerService() {
75          return (InquiryControllerService) super.getControllerService();
76      }
77  
78      @Override
79      @Autowired
80      @Qualifier("inquiryControllerService")
81      public void setControllerService(ControllerService controllerService) {
82          super.setControllerService(controllerService);
83      }
84  }