001/**
002 * Copyright 2005-2018 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 org.kuali.rice.krad.inquiry;
017
018import org.kuali.rice.krad.util.KRADConstants;
019import org.kuali.rice.krad.web.controller.UifControllerBase;
020import org.kuali.rice.krad.web.form.InquiryForm;
021import org.kuali.rice.krad.web.service.ControllerService;
022import org.springframework.beans.factory.annotation.Autowired;
023import org.springframework.beans.factory.annotation.Qualifier;
024import org.springframework.stereotype.Controller;
025import org.springframework.web.bind.annotation.RequestMapping;
026import org.springframework.web.bind.annotation.RequestMethod;
027import org.springframework.web.servlet.ModelAndView;
028
029import javax.servlet.http.HttpServletRequest;
030import javax.servlet.http.HttpServletResponse;
031
032/**
033 * Controller for inquiry views which handle initial requests for the inquiry and
034 * actions coming from the inquiry view such as export.
035 *
036 * @author Kuali Rice Team (rice.collab@kuali.org)
037 */
038@Controller
039@RequestMapping(value = KRADConstants.ControllerMappings.INQUIRY)
040public class InquiryController extends UifControllerBase {
041
042    /**
043     * {@inheritDoc}
044     */
045    @Override
046    protected InquiryForm createInitialForm() {
047        return new InquiryForm();
048    }
049
050    /**
051     * @see org.kuali.rice.krad.inquiry.InquiryControllerService#downloadDataObjectAttachment(org.kuali.rice.krad.web.form.InquiryForm,
052     * javax.servlet.http.HttpServletResponse)
053     */
054    @RequestMapping(method = RequestMethod.POST, params = "methodToCall=downloadDataObjectAttachment")
055    public ModelAndView downloadDataObjectAttachment(InquiryForm form, HttpServletResponse response) {
056        getControllerService().downloadDataObjectAttachment(form, response);
057
058        return null;
059    }
060
061    /**
062     * @see org.kuali.rice.krad.inquiry.InquiryControllerService#downloadCustomDataObjectAttachment(org.kuali.rice.krad.web.form.InquiryForm,
063     * javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
064     */
065    @RequestMapping(method = RequestMethod.POST, params = "methodToCall=downloadCustomDataObjectAttachment")
066    public ModelAndView downloadCustomDataObjectAttachment(InquiryForm form, HttpServletRequest request,
067            HttpServletResponse response) throws Exception {
068        getControllerService().downloadCustomDataObjectAttachment(form, request, response);
069
070        return null;
071    }
072
073    @Override
074    protected InquiryControllerService getControllerService() {
075        return (InquiryControllerService) super.getControllerService();
076    }
077
078    @Override
079    @Autowired
080    @Qualifier("inquiryControllerService")
081    public void setControllerService(ControllerService controllerService) {
082        super.setControllerService(controllerService);
083    }
084}