View Javadoc
1   /**
2    * Copyright 2005-2014 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.document;
17  
18  import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent;
19  import org.kuali.rice.krad.web.controller.UifControllerBase;
20  import org.kuali.rice.krad.web.form.DocumentFormBase;
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.web.bind.annotation.RequestMapping;
25  import org.springframework.web.bind.annotation.RequestMethod;
26  import org.springframework.web.servlet.ModelAndView;
27  
28  import javax.servlet.http.HttpServletResponse;
29  
30  /**
31   * Base controller class for all KRAD document view screens working with document models.
32   *
33   * <p>Provides default controller implementations for the standard document actions including: doc handler
34   * (retrieve from doc search and action list), save, route (and other KEW actions)</p>
35   *
36   * @author Kuali Rice Team (rice.collab@kuali.org)
37   */
38  public abstract class DocumentControllerBase extends UifControllerBase {
39  
40      /**
41       * {@inheritDoc}
42       */
43      @Override
44      protected abstract DocumentFormBase createInitialForm();
45  
46      /**
47       * @see DocumentControllerService#docHandler(org.kuali.rice.krad.web.form.DocumentFormBase)
48       */
49      @RequestMapping(params = "methodToCall=docHandler")
50      public ModelAndView docHandler(DocumentFormBase form) throws Exception {
51          return getControllerService().docHandler(form);
52      }
53  
54      /**
55       * @see DocumentControllerService#reload(org.kuali.rice.krad.web.form.DocumentFormBase)
56       */
57      @RequestMapping(params = "methodToCall=reload")
58      public ModelAndView reload(DocumentFormBase form) throws Exception {
59          return getControllerService().reload(form);
60      }
61  
62      /**
63       * @see DocumentControllerService#recall(org.kuali.rice.krad.web.form.DocumentFormBase)
64       */
65      @RequestMapping(params = "methodToCall=recall")
66      public ModelAndView recall(DocumentFormBase form) {
67          return getControllerService().recall(form);
68      }
69  
70      /**
71       * @see DocumentControllerService#save(org.kuali.rice.krad.web.form.DocumentFormBase)
72       */
73      @RequestMapping(params = "methodToCall=save")
74      public ModelAndView save(DocumentFormBase form) {
75          return getControllerService().save(form);
76      }
77  
78      /**
79       * @see DocumentControllerService#save(org.kuali.rice.krad.web.form.DocumentFormBase,
80       * org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent)
81       */
82      protected ModelAndView save(DocumentFormBase form, SaveDocumentEvent saveDocumentEvent) {
83          return getControllerService().save(form, saveDocumentEvent);
84      }
85  
86      /**
87       * @see DocumentControllerService#complete(org.kuali.rice.krad.web.form.DocumentFormBase)
88       */
89      @RequestMapping(params = "methodToCall=complete")
90      public ModelAndView complete(DocumentFormBase form) {
91          return getControllerService().complete(form);
92      }
93  
94      /**
95       * @see DocumentControllerService#route(org.kuali.rice.krad.web.form.DocumentFormBase)
96       */
97      @RequestMapping(params = "methodToCall=route")
98      public ModelAndView route(DocumentFormBase form) {
99          return getControllerService().route(form);
100     }
101 
102     /**
103      * @see DocumentControllerService#blanketApprove(org.kuali.rice.krad.web.form.DocumentFormBase)
104      */
105     @RequestMapping(params = "methodToCall=blanketApprove")
106     public ModelAndView blanketApprove(DocumentFormBase form) {
107         return getControllerService().blanketApprove(form);
108     }
109 
110     /**
111      * @see DocumentControllerService#approve(org.kuali.rice.krad.web.form.DocumentFormBase)
112      */
113     @RequestMapping(params = "methodToCall=approve")
114     public ModelAndView approve(DocumentFormBase form) {
115         return getControllerService().approve(form);
116     }
117 
118     /**
119      * @see DocumentControllerService#disapprove(org.kuali.rice.krad.web.form.DocumentFormBase)
120      */
121     @RequestMapping(params = "methodToCall=disapprove")
122     public ModelAndView disapprove(DocumentFormBase form) {
123         return getControllerService().disapprove(form);
124     }
125 
126     /**
127      * @see DocumentControllerService#fyi(org.kuali.rice.krad.web.form.DocumentFormBase)
128      */
129     @RequestMapping(params = "methodToCall=fyi")
130     public ModelAndView fyi(DocumentFormBase form) {
131         return getControllerService().fyi(form);
132     }
133 
134     /**
135      * @see DocumentControllerService#acknowledge(org.kuali.rice.krad.web.form.DocumentFormBase)
136      */
137     @RequestMapping(params = "methodToCall=acknowledge")
138     public ModelAndView acknowledge(DocumentFormBase form) {
139         return getControllerService().acknowledge(form);
140     }
141 
142     /**
143      * @see DocumentControllerService#sendAdHocRequests(org.kuali.rice.krad.web.form.DocumentFormBase)
144      */
145     @RequestMapping(params = "methodToCall=sendAdHocRequests")
146     public ModelAndView sendAdHocRequests(DocumentFormBase form) {
147         return getControllerService().sendAdHocRequests(form);
148     }
149 
150     /**
151      * @see DocumentControllerService#supervisorFunctions(org.kuali.rice.krad.web.form.DocumentFormBase)
152      */
153     @RequestMapping(params = "methodToCall=supervisorFunctions")
154     public ModelAndView supervisorFunctions(DocumentFormBase form) {
155         return getControllerService().supervisorFunctions(form);
156     }
157 
158     /**
159      * @see DocumentControllerService#insertNote(org.kuali.rice.krad.web.form.DocumentFormBase)
160      */
161     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=insertNote")
162     public ModelAndView insertNote(DocumentFormBase form) {
163         return getControllerService().insertNote(form);
164     }
165 
166     /**
167      * @see DocumentControllerService#deleteNote(org.kuali.rice.krad.web.form.DocumentFormBase)
168      */
169     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteNote")
170     public ModelAndView deleteNote(DocumentFormBase form) {
171         return getControllerService().deleteNote(form);
172     }
173 
174     /**
175      * {@inheritDoc}
176      *
177      * @see DocumentControllerService#superUserTakeActions(org.kuali.rice.krad.web.form.DocumentFormBase)
178      */
179     @RequestMapping(params = "methodToCall=superUserTakeActions")
180     public ModelAndView superUserTakeActions(DocumentFormBase form) {
181         return getControllerService().superUserTakeActions(form);
182     }
183 
184     /**
185      * {@inheritDoc}
186      *
187      * @see DocumentControllerService#superUserApprove(org.kuali.rice.krad.web.form.DocumentFormBase)
188      */
189     @RequestMapping(params = "methodToCall=superUserApprove")
190     public ModelAndView superUserApprove(DocumentFormBase form) {
191         return getControllerService().superUserApprove(form);
192     }
193 
194     /**
195      * {@inheritDoc}
196      *
197      * @see DocumentControllerService#superUserDisapprove(org.kuali.rice.krad.web.form.DocumentFormBase)
198      */
199     @RequestMapping(params = "methodToCall=superUserDisapprove")
200     public ModelAndView superUserDisapprove(DocumentFormBase form) {
201         return getControllerService().superUserDisapprove(form);
202     }
203 
204     /**
205      * @see DocumentControllerService#downloadAttachment(org.kuali.rice.krad.web.form.DocumentFormBase,
206      * javax.servlet.http.HttpServletResponse)
207      */
208     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=downloadAttachment")
209     public ModelAndView downloadAttachment(DocumentFormBase form, HttpServletResponse response) {
210         return getControllerService().downloadAttachment(form, response);
211     }
212 
213     /**
214      * @see DocumentControllerService#cancelAttachment(org.kuali.rice.krad.web.form.DocumentFormBase)
215      */
216     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=cancelAttachment")
217     public ModelAndView cancelAttachment(DocumentFormBase form) {
218         return getControllerService().cancelAttachment(form);
219     }
220 
221     @Override
222     protected DocumentControllerService getControllerService() {
223         return (DocumentControllerService) super.getControllerService();
224     }
225 
226     @Override
227     @Autowired
228     @Qualifier("documentControllerService")
229     public void setControllerService(ControllerService controllerService) {
230         super.setControllerService(controllerService);
231     }
232 
233 }