1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.web.controller;
17
18 import org.kuali.rice.krad.uif.UifConstants;
19 import org.kuali.rice.krad.uif.field.AttributeQueryResult;
20 import org.kuali.rice.krad.util.GlobalVariables;
21 import org.kuali.rice.krad.web.form.UifFormBase;
22 import org.kuali.rice.krad.web.service.CollectionControllerService;
23 import org.kuali.rice.krad.web.service.ControllerService;
24 import org.kuali.rice.krad.web.service.FileControllerService;
25 import org.kuali.rice.krad.web.service.ModelAndViewService;
26 import org.kuali.rice.krad.web.service.NavigationControllerService;
27 import org.kuali.rice.krad.web.service.QueryControllerService;
28 import org.kuali.rice.krad.web.service.RefreshControllerService;
29 import org.kuali.rice.krad.web.service.SaveControllerService;
30 import org.springframework.beans.factory.annotation.Autowired;
31 import org.springframework.validation.BindingResult;
32 import org.springframework.web.bind.annotation.ModelAttribute;
33 import org.springframework.web.bind.annotation.RequestMapping;
34 import org.springframework.web.bind.annotation.RequestMethod;
35 import org.springframework.web.bind.annotation.ResponseBody;
36 import org.springframework.web.servlet.ModelAndView;
37
38 import javax.servlet.http.HttpServletRequest;
39 import javax.servlet.http.HttpServletResponse;
40 import java.util.Map;
41 import java.util.Properties;
42
43
44
45
46
47
48
49
50
51
52
53
54 public abstract class UifControllerBase {
55
56 @Autowired
57 private ControllerService controllerService;
58
59 @Autowired
60 private NavigationControllerService navigationControllerService;
61
62 @Autowired
63 private CollectionControllerService collectionControllerService;
64
65 @Autowired
66 private SaveControllerService saveControllerService;
67
68 @Autowired
69 private RefreshControllerService refreshControllerService;
70
71 @Autowired
72 private QueryControllerService queryControllerService;
73
74 @Autowired
75 private FileControllerService fileControllerService;
76
77 @Autowired
78 private ModelAndViewService modelAndViewService;
79
80
81
82
83
84
85 @ModelAttribute(value = UifConstants.DEFAULT_MODEL_NAME)
86 protected UifFormBase initForm() {
87 return createInitialForm();
88 }
89
90
91
92
93
94
95 protected abstract UifFormBase createInitialForm();
96
97
98
99
100 @RequestMapping()
101 public ModelAndView defaultMapping(UifFormBase form) {
102 return start(form);
103 }
104
105
106
107
108 @RequestMapping(method = RequestMethod.GET, params = "methodToCall=start")
109 public ModelAndView start(UifFormBase form) {
110 return getControllerService().start(form);
111 }
112
113
114
115
116 @RequestMapping(params = "methodToCall=sessionTimeout")
117 public ModelAndView sessionTimeout(UifFormBase form) {
118 return getControllerService().sessionTimeout(form);
119 }
120
121
122
123
124 @RequestMapping(params = "methodToCall=cancel")
125 public ModelAndView cancel(UifFormBase form) {
126 return getControllerService().cancel(form);
127 }
128
129
130
131
132 @RequestMapping(params = "methodToCall=back")
133 public ModelAndView back(UifFormBase form) {
134 return getNavigationControllerService().back(form);
135 }
136
137
138
139
140 @RequestMapping(params = "methodToCall=returnToPrevious")
141 public ModelAndView returnToPrevious(UifFormBase form) {
142 return getNavigationControllerService().returnToPrevious(form);
143 }
144
145
146
147
148 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=save")
149 public ModelAndView save(UifFormBase form) throws Exception{
150
151 return getSaveControllerService().save(form);
152 }
153
154
155
156
157 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=saveField")
158 public ModelAndView saveField(UifFormBase form) throws Exception{
159
160 return getSaveControllerService().saveField(form);
161 }
162
163
164
165
166 @RequestMapping(params = "methodToCall=returnToHub")
167 public ModelAndView returnToHub(UifFormBase form) {
168 return getNavigationControllerService().returnToHub(form);
169 }
170
171
172
173
174 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addFileUploadLine")
175 public ModelAndView addFileUploadLine(UifFormBase form) {
176 return getFileControllerService().addFileUploadLine(form);
177 }
178
179
180
181
182 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteFileUploadLine")
183 public ModelAndView deleteFileUploadLine(UifFormBase form) {
184 return getFileControllerService().deleteFileUploadLine(form);
185 }
186
187
188
189
190
191 @RequestMapping(method = RequestMethod.GET, params = "methodToCall=getFileFromLine")
192 public void getFileFromLine(UifFormBase form, HttpServletResponse response) {
193 getFileControllerService().getFileFromLine(form, response);
194 }
195
196
197
198
199 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=navigate")
200 public ModelAndView navigate(UifFormBase form) {
201 return getNavigationControllerService().navigate(form);
202 }
203
204
205
206
207 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLine")
208 public ModelAndView addLine(UifFormBase form) {
209 return getCollectionControllerService().addLine(form);
210 }
211
212
213
214
215 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addBlankLine")
216 public ModelAndView addBlankLine(UifFormBase form) {
217 return getCollectionControllerService().addBlankLine(form);
218 }
219
220
221
222
223 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=retrieveEditLineDialog")
224 public ModelAndView retrieveEditLineDialog(UifFormBase form) {
225 return getCollectionControllerService().retrieveEditLineDialog(form);
226 }
227
228
229
230
231 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=editLine")
232 public ModelAndView editLine(UifFormBase form) {
233 return getCollectionControllerService().editLine(form);
234 }
235
236
237
238
239 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=closeEditLineDialog")
240 public ModelAndView closeEditLineDialog(UifFormBase form) {
241 return getCollectionControllerService().closeEditLineDialog(form);
242 }
243
244
245
246
247 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=saveLine")
248 public ModelAndView saveLine(UifFormBase form) {
249 return getCollectionControllerService().saveLine(form);
250 }
251
252
253
254
255 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteLine")
256 public ModelAndView deleteLine(final UifFormBase form) {
257 return getCollectionControllerService().deleteLine(form);
258 }
259
260
261
262
263 @RequestMapping(params = "methodToCall=retrieveCollectionPage")
264 public ModelAndView retrieveCollectionPage(UifFormBase form) {
265 return getCollectionControllerService().retrieveCollectionPage(form);
266 }
267
268
269
270
271 @RequestMapping(method = RequestMethod.GET, params = "methodToCall=tableJsonRetrieval")
272 public ModelAndView tableJsonRetrieval(UifFormBase form) {
273 return getCollectionControllerService().tableJsonRetrieval(form);
274 }
275
276
277
278
279 @MethodAccessible
280 @RequestMapping(params = "methodToCall=refresh")
281 public ModelAndView refresh(UifFormBase form) {
282 return getRefreshControllerService().refresh(form);
283 }
284
285
286
287
288 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=performLookup")
289 public ModelAndView performLookup(UifFormBase form) {
290 return getQueryControllerService().performLookup(form);
291 }
292
293
294
295
296 @RequestMapping(method = RequestMethod.GET, params = "methodToCall=performFieldSuggest")
297 @ResponseBody
298 public AttributeQueryResult performFieldSuggest(UifFormBase form) {
299 return getQueryControllerService().performFieldSuggest(form);
300 }
301
302
303
304
305 @RequestMapping(method = RequestMethod.GET, params = "methodToCall=performFieldQuery")
306 @ResponseBody
307 public AttributeQueryResult performFieldQuery(UifFormBase form) {
308 return getQueryControllerService().performFieldQuery(form);
309 }
310
311
312
313
314 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=checkForm")
315 public ModelAndView checkForm(UifFormBase form) {
316 return getModelAndViewService().checkForm(form);
317 }
318
319
320
321
322
323 protected ModelAndView showDialog(String dialogId, boolean confirmation, UifFormBase form) {
324 return getModelAndViewService().showDialog(dialogId, confirmation, form);
325 }
326
327
328
329
330
331 protected ModelAndView performRedirect(UifFormBase form, String baseUrl, Properties urlParameters) {
332 return getModelAndViewService().performRedirect(form, baseUrl, urlParameters);
333 }
334
335
336
337
338
339 protected ModelAndView performRedirect(UifFormBase form, String redirectUrl) {
340 return getModelAndViewService().performRedirect(form, redirectUrl);
341 }
342
343
344
345
346
347 protected ModelAndView getMessageView(UifFormBase form, String headerText, String messageText) {
348 return getModelAndViewService().getMessageView(form, headerText, messageText);
349 }
350
351
352
353
354 protected ModelAndView getModelAndView(UifFormBase form) {
355 return getModelAndViewService().getModelAndView(form);
356 }
357
358
359
360
361
362 protected ModelAndView getModelAndView(UifFormBase form, String pageId) {
363 return getModelAndViewService().getModelAndView(form, pageId);
364 }
365
366
367
368
369
370 protected ModelAndView getModelAndView(UifFormBase form, Map<String, Object> additionalViewAttributes) {
371 return getModelAndViewService().getModelAndView(form, additionalViewAttributes);
372 }
373
374
375
376
377
378 protected ModelAndView getModelAndViewWithInit(UifFormBase form, String viewId) {
379 return getModelAndViewService().getModelAndViewWithInit(form, viewId);
380 }
381
382
383
384
385
386 protected ModelAndView getModelAndViewWithInit(UifFormBase form, String viewId, String pageId) {
387 return getModelAndViewService().getModelAndViewWithInit(form, viewId, pageId);
388 }
389
390 protected ControllerService getControllerService() {
391 return controllerService;
392 }
393
394 public void setControllerService(ControllerService controllerService) {
395 this.controllerService = controllerService;
396 }
397
398 protected NavigationControllerService getNavigationControllerService() {
399 return navigationControllerService;
400 }
401
402 public void setNavigationControllerService(NavigationControllerService navigationControllerService) {
403 this.navigationControllerService = navigationControllerService;
404 }
405
406 protected CollectionControllerService getCollectionControllerService() {
407 return collectionControllerService;
408 }
409
410 public void setCollectionControllerService(CollectionControllerService collectionControllerService) {
411 this.collectionControllerService = collectionControllerService;
412 }
413
414 protected RefreshControllerService getRefreshControllerService() {
415 return refreshControllerService;
416 }
417
418 public void setRefreshControllerService(RefreshControllerService refreshControllerService) {
419 this.refreshControllerService = refreshControllerService;
420 }
421
422 public SaveControllerService getSaveControllerService() {
423 return saveControllerService;
424 }
425
426 public void setSaveControllerService(SaveControllerService saveControllerService) {
427 this.saveControllerService = saveControllerService;
428 }
429
430 protected QueryControllerService getQueryControllerService() {
431 return queryControllerService;
432 }
433
434 public void setQueryControllerService(QueryControllerService queryControllerService) {
435 this.queryControllerService = queryControllerService;
436 }
437
438 protected FileControllerService getFileControllerService() {
439 return fileControllerService;
440 }
441
442 public void setFileControllerService(FileControllerService fileControllerService) {
443 this.fileControllerService = fileControllerService;
444 }
445
446 protected ModelAndViewService getModelAndViewService() {
447 return modelAndViewService;
448 }
449
450 public void setModelAndViewService(ModelAndViewService modelAndViewService) {
451 this.modelAndViewService = modelAndViewService;
452 }
453 }