1 /**
2 * Copyright 2005-2016 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.kew.api.action.ActionRequest;
19 import org.kuali.rice.kew.api.exception.WorkflowException;
20 import org.kuali.rice.krad.rules.rule.event.DocumentEvent;
21 import org.kuali.rice.krad.rules.rule.event.SaveDocumentEvent;
22 import org.kuali.rice.krad.uif.UifConstants;
23 import org.kuali.rice.krad.web.form.DocumentFormBase;
24 import org.kuali.rice.krad.web.service.ControllerService;
25 import org.springframework.web.servlet.ModelAndView;
26
27 import javax.servlet.http.HttpServletResponse;
28
29 /**
30 * Controller service that handles document specific actions (such as workflow actions).
31 *
32 * @author Kuali Rice Team (rice.collab@kuali.org)
33 */
34 public interface DocumentControllerService extends ControllerService {
35
36 /**
37 * Handles all requests for a new document instance or to load an existing document based on the
38 * given form parameters.
39 *
40 * @param form form instance containing the document data
41 * @return ModelAndView instance for rendering the document view
42 * @throws WorkflowException if a document cannot be created or loaded
43 */
44 ModelAndView docHandler(DocumentFormBase form) throws WorkflowException;
45
46 /**
47 * Reloads from the database the document with the doc id on the given form.
48 *
49 * @param form form instance containing the document id that will be reloaded
50 * @return ModelAndView instance for rendering the reloaded document view
51 * @throws WorkflowException if the document cannot be reloaded
52 */
53 ModelAndView reload(DocumentFormBase form) throws WorkflowException;
54
55 /**
56 * Recalls the document with the given id on the form from workflow.
57 *
58 * @param form form instance containing the document id that will be recalled
59 * @return ModelAndView instance for rendering the document view
60 */
61 ModelAndView recall(DocumentFormBase form);
62
63 /**
64 * Saves the document instance contained on the given form.
65 *
66 * @param form form instance containing the document that will be saved
67 * @return ModelAndView instance for rendering the document view
68 */
69 ModelAndView save(DocumentFormBase form);
70
71 /**
72 * Saves the document instance contained on the given form and passes the given event for rule
73 * evaluation.
74 *
75 * @param form form instance containing the document that will be saved
76 * @param saveDocumentEvent rule event that will be processed with the save operation
77 * @return ModelAndView instance for rendering the document view
78 */
79 ModelAndView save(DocumentFormBase form, SaveDocumentEvent saveDocumentEvent);
80
81 /**
82 * Sends a complete workflow action for the document contained on the form.
83 *
84 * @param form form instance containing the document the complete request will be generated for
85 * @return ModelAndView instance for rendering the document view
86 */
87 ModelAndView complete(DocumentFormBase form);
88
89 /**
90 * Sends a route workflow action for the document contained on the form.
91 *
92 * @param form form instance containing the document the route request will be generated for
93 * @return ModelAndView instance for rendering the document view
94 */
95 ModelAndView route(DocumentFormBase form);
96
97 /**
98 * Sends a blanket approve workflow action for the document contained on the form.
99 *
100 * @param form form instance containing the document the blanket approve request will be generated for
101 * @return ModelAndView instance for rendering the document view
102 */
103 ModelAndView blanketApprove(DocumentFormBase form);
104
105 /**
106 * Sends a approve workflow action for the document contained on the form.
107 *
108 * @param form form instance containing the document the approve request will be generated for
109 * @return ModelAndView instance for rendering the document view
110 */
111 ModelAndView approve(DocumentFormBase form);
112
113 /**
114 * Sends a disapprove workflow action for the document contained on the form.
115 *
116 * @param form form instance containing the document the disapprove request will be generated for
117 * @return ModelAndView instance for rendering the document view
118 */
119 ModelAndView disapprove(DocumentFormBase form);
120
121 /**
122 * Sends a fyi workflow action for the document contained on the form.
123 *
124 * @param form form instance containing the document the fyi request will be generated for
125 * @return ModelAndView instance for rendering the document view
126 */
127 ModelAndView fyi(DocumentFormBase form);
128
129 /**
130 * Sends a acknowledge workflow action for the document contained on the form.
131 *
132 * @param form form instance containing the document the acknowledge request will be generated for
133 * @return ModelAndView instance for rendering the document view
134 */
135 ModelAndView acknowledge(DocumentFormBase form);
136
137 /**
138 * Sends AdHoc workflow Requests for the document instance contained on the form to the AdHoc recipients
139 * contained on the form.
140 *
141 * @param form form instance containing the document and recipients the requests will be generated for
142 * @return ModelAndView instance for rendering the document view
143 */
144 ModelAndView sendAdHocRequests(DocumentFormBase form);
145
146 /**
147 * Redirects to the supervisor workflow view.
148 *
149 * @param form form instance containing the document instance
150 * @return ModelAndView instance for rendering the supervisor workflow view
151 */
152 ModelAndView supervisorFunctions(DocumentFormBase form);
153
154 /**
155 * Closes the document and returns to the hub.
156 *
157 * @param form form instance containing the document instance
158 * @return ModelAndView instance for rendering the document view
159 */
160 ModelAndView close(DocumentFormBase form);
161
162 /**
163 * Invoked by the add note action to adding the note instance contained of the given form.
164 *
165 * @param form form instance containing the note instance
166 * @return ModelAndView instance for rendering the document view
167 */
168 ModelAndView insertNote(DocumentFormBase form);
169
170 /**
171 * Invoked by the delete note action to delete a note instance contained on document (within the form).
172 *
173 * @param form form instance containing the note instance
174 * @return ModelAndView instance for rendering the document view
175 */
176 ModelAndView deleteNote(DocumentFormBase form);
177
178 /**
179 * Invoked to download an attachment that has been uploaded for a note.
180 *
181 * @param form form instance containing the note (and attachment) instance
182 * @param response http servlet response instance for sending back the attachment contents
183 * @return ModelAndView instance for rendering the document view, or null if the response has been
184 * finished
185 */
186 ModelAndView downloadAttachment(DocumentFormBase form, HttpServletResponse response);
187
188 /**
189 * Invoked to remove an attachment that was uploaded for the add note instance.
190 *
191 * @param form form instance containing the attachment.
192 * @return ModelAndView instance for rendering the document view
193 */
194 ModelAndView cancelAttachment(DocumentFormBase form);
195
196 /**
197 * Invoked to take super user actions on a document.
198 *
199 * @param form form instance containing the actions.
200 * @return ModelAndView instance for rendering the document view
201 */
202 ModelAndView superUserTakeActions(DocumentFormBase form);
203
204 /**
205 * Sends a super user approve workflow action for the document contained on the form.
206 *
207 * @param form form instance containing the document the super user approve request will be generated for
208 * @return ModelAndView instance for rendering the document view
209 */
210 ModelAndView superUserApprove(DocumentFormBase form);
211
212 /**
213 * Sends a super user disapprove workflow action for the document contained on the form.
214 *
215 * @param form form instance containing the document the super user disapprove request will be generated for
216 * @return ModelAndView instance for rendering the document view
217 */
218 ModelAndView superUserDisapprove(DocumentFormBase form);
219
220 /**
221 * Invokes the {@link org.kuali.rice.krad.service.DocumentService} to carry out a request workflow action and adds a
222 * success message, if requested a check for sensitive data is also performed.
223 *
224 * @param form document form instance containing the document for which the action will be taken on
225 * @param action {@link org.kuali.rice.krad.uif.UifConstants.WorkflowAction} enum indicating what workflow action
226 * to take
227 */
228 void performWorkflowAction(DocumentFormBase form, UifConstants.WorkflowAction action);
229
230 /**
231 * Invokes the {@link org.kuali.rice.krad.service.DocumentService} to carry out a request workflow action and adds a
232 * success message, if requested a check for sensitive data is also performed.
233 *
234 * @param form document form instance containing the document for which the action will be taken on
235 * @param action {@link org.kuali.rice.krad.uif.UifConstants.WorkflowAction} enum indicating what workflow action
236 * to take
237 * @param documentEvent rule event instance that will be evaluated with the workflow action, only currently
238 * supported for the save action
239 */
240 void performWorkflowAction(DocumentFormBase form, UifConstants.WorkflowAction action, DocumentEvent documentEvent);
241
242 /**
243 * Invokes the {@link org.kuali.rice.krad.service.DocumentService} to carry out a super user request workflow action
244 * and adds a success message.
245 *
246 * @param form document form instance containing the document for which the super user action will be taken on
247 * @param action {@link org.kuali.rice.krad.uif.UifConstants.SuperUserWorkflowAction} enum indicating what super
248 * user workflow action to take
249 */
250 void performSuperUserWorkflowAction(DocumentFormBase form, UifConstants.SuperUserWorkflowAction action);
251
252 /**
253 * Invokes the {@link org.kuali.rice.krad.service.DocumentService} to carry out a super user request workflow action
254 * and adds a success message.
255 *
256 * @param form document form instance containing the document for which the super user action will be taken on
257 * @param action {@link org.kuali.rice.krad.uif.UifConstants.SuperUserWorkflowAction} enum indicating what super
258 * user workflow action to take
259 * @param actionRequest the requested action to take, currenly only available for take action
260 */
261 void performSuperUserWorkflowAction(DocumentFormBase form, UifConstants.SuperUserWorkflowAction action, ActionRequest actionRequest);
262
263 }