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.maintenance;
17  
18  import org.kuali.rice.krad.document.DocumentControllerBase;
19  import org.kuali.rice.krad.util.KRADConstants;
20  import org.kuali.rice.krad.web.form.MaintenanceDocumentForm;
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.HttpServletResponse;
30  
31  /**
32   * Controller that handles requests for a {@link org.kuali.rice.krad.uif.view.MaintenanceDocumentView}.
33   *
34   * @author Kuali Rice Team (rice.collab@kuali.org)
35   */
36  @Controller
37  @RequestMapping(value = KRADConstants.ControllerMappings.MAINTENANCE)
38  public class MaintenanceDocumentController extends DocumentControllerBase {
39  
40      /**
41       * {@inheritDoc}
42       */
43      @Override
44      protected MaintenanceDocumentForm createInitialForm() {
45          return new MaintenanceDocumentForm();
46      }
47  
48      /**
49       * @see MaintenanceDocumentControllerService#setupMaintenanceEdit(org.kuali.rice.krad.web.form.MaintenanceDocumentForm)
50       */
51      @RequestMapping(params = "methodToCall=" + KRADConstants.Maintenance.METHOD_TO_CALL_EDIT)
52      public ModelAndView setupMaintenanceEdit(MaintenanceDocumentForm form) {
53          return getControllerService().setupMaintenanceEdit(form);
54      }
55  
56      /**
57       * @see MaintenanceDocumentControllerService#setupMaintenanceCopy(org.kuali.rice.krad.web.form.MaintenanceDocumentForm)
58       */
59      @RequestMapping(params = "methodToCall=" + KRADConstants.Maintenance.METHOD_TO_CALL_COPY)
60      public ModelAndView setupMaintenanceCopy(MaintenanceDocumentForm form) {
61          return getControllerService().setupMaintenanceCopy(form);
62      }
63  
64      /**
65       * @see MaintenanceDocumentControllerService#setupMaintenanceNewWithExisting(org.kuali.rice.krad.web.form.MaintenanceDocumentForm)
66       */
67      @RequestMapping(params = "methodToCall=" + KRADConstants.Maintenance.METHOD_TO_CALL_NEW_WITH_EXISTING)
68      public ModelAndView setupMaintenanceNewWithExisting(MaintenanceDocumentForm form) {
69          return getControllerService().setupMaintenanceNewWithExisting(form);
70      }
71  
72      /**
73       * @see MaintenanceDocumentControllerService#setupMaintenanceDelete(org.kuali.rice.krad.web.form.MaintenanceDocumentForm)
74       */
75      @RequestMapping(params = "methodToCall=" + KRADConstants.Maintenance.METHOD_TO_CALL_DELETE)
76      public ModelAndView maintenanceDelete(MaintenanceDocumentForm form) {
77          return getControllerService().setupMaintenanceDelete(form);
78      }
79  
80      /**
81       * @see MaintenanceDocumentControllerService#downloadDataObjectAttachment(org.kuali.rice.krad.web.form.MaintenanceDocumentForm,
82       * javax.servlet.http.HttpServletResponse)
83       */
84      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=downloadDataObjectAttachment")
85      public ModelAndView downloadDataObjectAttachment(MaintenanceDocumentForm form, HttpServletResponse response) {
86          getControllerService().downloadDataObjectAttachment(form, response);
87  
88          return null;
89      }
90  
91      @Override
92      protected MaintenanceDocumentControllerService getControllerService() {
93          return (MaintenanceDocumentControllerService) super.getControllerService();
94      }
95  
96      @Override
97      @Autowired
98      @Qualifier("maintenanceDocumentControllerService")
99      public void setControllerService(ControllerService controllerService) {
100         super.setControllerService(controllerService);
101     }
102 
103 }