1 package org.kuali.rice.krad.web.controller.extension;
2
3 import org.apache.commons.lang.StringUtils;
4 import org.kuali.rice.krad.uif.UifConstants;
5 import org.kuali.rice.krad.uif.view.View;
6 import org.kuali.rice.krad.web.controller.UifControllerBase;
7 import org.kuali.rice.krad.web.form.UifFormBase;
8 import org.springframework.util.Assert;
9 import org.springframework.web.servlet.ModelAndView;
10
11
12
13
14
15
16 public abstract class KsapControllerBase extends UifControllerBase {
17
18
19
20
21
22
23
24
25
26 @Override
27 protected ModelAndView getUIFModelAndView(UifFormBase form, String pageId) {
28 return getUIFModelAndViewHelper(form, pageId);
29 }
30
31
32
33
34
35
36
37
38
39 @Override
40 protected ModelAndView getUIFModelAndViewWithInit(UifFormBase form, String viewId) {
41 View view = getViewService().getViewById(viewId);
42
43 Assert.notNull(view, "View not found with id: " + viewId);
44
45 form.setView(view);
46 form.setViewId(viewId);
47
48 return getUIFModelAndViewHelper(form, form.getPageId());
49 }
50
51
52
53
54
55
56
57
58
59
60 private static ModelAndView getUIFModelAndViewHelper(UifFormBase form, String pageId) {
61 if (StringUtils.isNotBlank(pageId)) {
62 form.setPageId(pageId);
63 }
64
65
66 ModelAndView modelAndView = new ModelAndView();
67 modelAndView.addObject(UifConstants.DEFAULT_MODEL_NAME, form);
68 modelAndView.setViewName("/krad/WEB-INF/ftl/ksapUifRender");
69
70 return modelAndView;
71 }
72 }