1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.kuali.rice.krad.web.spring.controller; |
12 | |
|
13 | |
import java.util.Collections; |
14 | |
import java.util.Enumeration; |
15 | |
import java.util.HashMap; |
16 | |
import java.util.HashSet; |
17 | |
import java.util.Map; |
18 | |
import java.util.Map.Entry; |
19 | |
import java.util.Properties; |
20 | |
import java.util.Set; |
21 | |
|
22 | |
import javax.servlet.http.HttpServletRequest; |
23 | |
import javax.servlet.http.HttpServletResponse; |
24 | |
|
25 | |
import org.apache.commons.lang.StringUtils; |
26 | |
import org.kuali.rice.core.api.config.property.ConfigContext; |
27 | |
import org.kuali.rice.core.util.AttributeSet; |
28 | |
import org.kuali.rice.core.web.format.BooleanFormatter; |
29 | |
import org.kuali.rice.kim.api.services.KimApiServiceLocator; |
30 | |
import org.kuali.rice.kim.util.KimConstants; |
31 | |
import org.kuali.rice.krad.UserSession; |
32 | |
import org.kuali.rice.krad.exception.AuthorizationException; |
33 | |
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; |
34 | |
import org.kuali.rice.krad.service.ModuleService; |
35 | |
import org.kuali.rice.krad.service.SessionDocumentService; |
36 | |
import org.kuali.rice.krad.uif.UifConstants; |
37 | |
import org.kuali.rice.krad.uif.UifParameters; |
38 | |
import org.kuali.rice.krad.uif.container.CollectionGroup; |
39 | |
import org.kuali.rice.krad.uif.container.View; |
40 | |
import org.kuali.rice.krad.uif.core.Component; |
41 | |
import org.kuali.rice.krad.uif.service.ViewService; |
42 | |
import org.kuali.rice.krad.uif.field.AttributeQueryResult; |
43 | |
import org.kuali.rice.krad.uif.util.ComponentFactory; |
44 | |
import org.kuali.rice.krad.uif.util.LookupInquiryUtils; |
45 | |
import org.kuali.rice.krad.uif.util.UifWebUtils; |
46 | |
import org.kuali.rice.krad.util.GlobalVariables; |
47 | |
import org.kuali.rice.krad.util.KRADConstants; |
48 | |
import org.kuali.rice.krad.util.KRADUtils; |
49 | |
import org.kuali.rice.krad.util.UrlFactory; |
50 | |
import org.kuali.rice.krad.util.WebUtils; |
51 | |
import org.kuali.rice.krad.web.spring.form.UifFormBase; |
52 | |
import org.springframework.validation.BindingResult; |
53 | |
import org.springframework.web.bind.annotation.ModelAttribute; |
54 | |
import org.springframework.web.bind.annotation.RequestMapping; |
55 | |
import org.springframework.web.bind.annotation.RequestMethod; |
56 | |
import org.springframework.web.bind.annotation.ResponseBody; |
57 | |
import org.springframework.web.servlet.ModelAndView; |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | 0 | public abstract class UifControllerBase { |
77 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(UifControllerBase.class); |
78 | |
|
79 | |
protected static final String REDIRECT_PREFIX = "redirect:"; |
80 | |
private SessionDocumentService sessionDocumentService; |
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
@ModelAttribute(value = "KualiForm") |
90 | |
public UifFormBase initForm(HttpServletRequest request) { |
91 | 0 | UifFormBase form = null; |
92 | 0 | String formKeyParam = request.getParameter(UifParameters.FORM_KEY); |
93 | 0 | String documentNumber = request.getParameter(KRADConstants.DOCUMENT_DOCUMENT_NUMBER); |
94 | |
|
95 | 0 | if (StringUtils.isNotBlank(formKeyParam)) { |
96 | 0 | form = (UifFormBase) request.getSession().getAttribute(formKeyParam); |
97 | |
|
98 | |
|
99 | 0 | if (form == null) { |
100 | 0 | UserSession userSession = (UserSession) request.getSession() |
101 | |
.getAttribute(KRADConstants.USER_SESSION_KEY); |
102 | 0 | form = getSessionDocumentService().getUifDocumentForm(documentNumber, formKeyParam, userSession, |
103 | |
request.getRemoteAddr()); |
104 | 0 | } |
105 | |
} else { |
106 | 0 | form = createInitialForm(request); |
107 | |
} |
108 | |
|
109 | 0 | return form; |
110 | |
} |
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
protected abstract UifFormBase createInitialForm(HttpServletRequest request); |
120 | |
|
121 | 0 | private Set<String> methodToCallsToNotCheckAuthorization = new HashSet<String>(); |
122 | |
{ |
123 | 0 | methodToCallsToNotCheckAuthorization.add("performLookup"); |
124 | 0 | methodToCallsToNotCheckAuthorization.add("performQuestion"); |
125 | 0 | methodToCallsToNotCheckAuthorization.add("performQuestionWithInput"); |
126 | 0 | methodToCallsToNotCheckAuthorization.add("performQuestionWithInputAgainBecauseOfErrors"); |
127 | 0 | methodToCallsToNotCheckAuthorization.add("performQuestionWithoutInput"); |
128 | 0 | methodToCallsToNotCheckAuthorization.add("performWorkgroupLookup"); |
129 | 0 | } |
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
|
136 | |
protected final void addMethodToCallToUncheckedList(String methodToCall) { |
137 | 0 | methodToCallsToNotCheckAuthorization.add(methodToCall); |
138 | 0 | } |
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | |
public Set<String> getMethodToCallsToNotCheckAuthorization() { |
145 | 0 | return Collections.unmodifiableSet(methodToCallsToNotCheckAuthorization); |
146 | |
} |
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
public void checkAuthorization(UifFormBase form, String methodToCall) throws AuthorizationException { |
153 | 0 | String principalId = GlobalVariables.getUserSession().getPrincipalId(); |
154 | 0 | AttributeSet roleQualifier = new AttributeSet(getRoleQualification(form, methodToCall)); |
155 | 0 | AttributeSet permissionDetails = KRADUtils.getNamespaceAndActionClass(this.getClass()); |
156 | |
|
157 | 0 | if (!KimApiServiceLocator.getIdentityManagementService().isAuthorizedByTemplateName(principalId, |
158 | |
KRADConstants.KRAD_NAMESPACE, KimConstants.PermissionTemplateNames.USE_SCREEN, permissionDetails, |
159 | |
roleQualifier)) { |
160 | 0 | throw new AuthorizationException(GlobalVariables.getUserSession().getPerson().getPrincipalName(), |
161 | |
methodToCall, this.getClass().getSimpleName()); |
162 | |
} |
163 | 0 | } |
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
protected Map<String, String> getRoleQualification(UifFormBase form, String methodToCall) { |
170 | 0 | return new HashMap<String, String>(); |
171 | |
} |
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
@RequestMapping(method = RequestMethod.GET, params = "methodToCall=start") |
178 | |
public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, |
179 | |
HttpServletRequest request, HttpServletResponse response) { |
180 | |
|
181 | 0 | return getUIFModelAndView(form); |
182 | |
} |
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
|
189 | |
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLine") |
190 | |
public ModelAndView addLine(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result, |
191 | |
HttpServletRequest request, HttpServletResponse response) { |
192 | |
|
193 | 0 | String selectedCollectionPath = uifForm.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH); |
194 | 0 | if (StringUtils.isBlank(selectedCollectionPath)) { |
195 | 0 | throw new RuntimeException("Selected collection was not set for add line action, cannot add new line"); |
196 | |
} |
197 | |
|
198 | 0 | View view = uifForm.getPreviousView(); |
199 | 0 | view.getViewHelperService().processCollectionAddLine(view, uifForm, selectedCollectionPath); |
200 | |
|
201 | 0 | return getUIFModelAndView(uifForm); |
202 | |
} |
203 | |
|
204 | |
|
205 | |
|
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | |
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteLine") |
211 | |
public ModelAndView deleteLine(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result, |
212 | |
HttpServletRequest request, HttpServletResponse response) { |
213 | |
|
214 | 0 | String selectedCollectionPath = uifForm.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH); |
215 | 0 | if (StringUtils.isBlank(selectedCollectionPath)) { |
216 | 0 | throw new RuntimeException("Selected collection was not set for delete line action, cannot delete line"); |
217 | |
} |
218 | |
|
219 | 0 | int selectedLineIndex = -1; |
220 | 0 | String selectedLine = uifForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX); |
221 | 0 | if (StringUtils.isNotBlank(selectedLine)) { |
222 | 0 | selectedLineIndex = Integer.parseInt(selectedLine); |
223 | |
} |
224 | |
|
225 | 0 | if (selectedLineIndex == -1) { |
226 | 0 | throw new RuntimeException("Selected line index was not set for delete line action, cannot delete line"); |
227 | |
} |
228 | |
|
229 | 0 | View view = uifForm.getPreviousView(); |
230 | 0 | view.getViewHelperService().processCollectionDeleteLine(view, uifForm, selectedCollectionPath, |
231 | |
selectedLineIndex); |
232 | |
|
233 | 0 | return getUIFModelAndView(uifForm); |
234 | |
} |
235 | |
|
236 | |
|
237 | |
|
238 | |
|
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=toggleInactiveRecordDisplay") |
244 | |
public ModelAndView toggleInactiveRecordDisplay(@ModelAttribute("KualiForm") UifFormBase uifForm, |
245 | |
BindingResult result, HttpServletRequest request, HttpServletResponse response) { |
246 | 0 | String collectionGroupId = request.getParameter(UifParameters.REQUESTED_COMPONENT_ID); |
247 | 0 | if (StringUtils.isBlank(collectionGroupId)) { |
248 | 0 | throw new RuntimeException( |
249 | |
"Collection group id to update for inactive record display not found in request"); |
250 | |
} |
251 | |
|
252 | 0 | String showInactiveStr = request.getParameter(UifParameters.SHOW_INACTIVE_RECORDS); |
253 | 0 | Boolean showInactive = false; |
254 | 0 | if (StringUtils.isNotBlank(showInactiveStr)) { |
255 | |
|
256 | 0 | showInactive = (Boolean) (new BooleanFormatter()).convertFromPresentationFormat(showInactiveStr); |
257 | |
} else { |
258 | 0 | throw new RuntimeException("Show inactive records flag not found in request"); |
259 | |
} |
260 | |
|
261 | 0 | CollectionGroup collectionGroup = (CollectionGroup) ComponentFactory.getComponentById(collectionGroupId); |
262 | |
|
263 | |
|
264 | 0 | collectionGroup.setShowInactive(showInactive); |
265 | |
|
266 | |
|
267 | 0 | uifForm.getView().getViewHelperService().performComponentLifecycle(uifForm, collectionGroup, collectionGroupId); |
268 | 0 | uifForm.getView().getViewIndex().indexComponent(collectionGroup); |
269 | |
|
270 | 0 | return UifWebUtils.getComponentModelAndView(collectionGroup, uifForm); |
271 | |
} |
272 | |
|
273 | |
|
274 | |
|
275 | |
|
276 | |
@RequestMapping(params = "methodToCall=cancel") |
277 | |
public ModelAndView cancel(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, |
278 | |
HttpServletRequest request, HttpServletResponse response) { |
279 | 0 | return close(form, result, request, response); |
280 | |
} |
281 | |
|
282 | |
|
283 | |
|
284 | |
|
285 | |
@RequestMapping(params = "methodToCall=close") |
286 | |
public ModelAndView close(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, |
287 | |
HttpServletRequest request, HttpServletResponse response) { |
288 | 0 | Properties props = new Properties(); |
289 | 0 | props.put(UifParameters.METHOD_TO_CALL, UifConstants.MethodToCallNames.REFRESH); |
290 | 0 | if (StringUtils.isNotBlank(form.getReturnFormKey())) { |
291 | 0 | props.put(UifParameters.FORM_KEY, form.getReturnFormKey()); |
292 | |
} |
293 | |
|
294 | |
|
295 | |
|
296 | 0 | String returnUrl = form.getReturnLocation(); |
297 | 0 | if (StringUtils.isBlank(returnUrl)) { |
298 | 0 | returnUrl = ConfigContext.getCurrentContextConfig().getProperty(KRADConstants.APPLICATION_URL_KEY); |
299 | |
} |
300 | |
|
301 | 0 | return performRedirect(form, returnUrl, props); |
302 | |
} |
303 | |
|
304 | |
|
305 | |
|
306 | |
|
307 | |
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=navigate") |
308 | |
public ModelAndView navigate(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, |
309 | |
HttpServletRequest request, HttpServletResponse response) { |
310 | 0 | String pageId = form.getActionParamaterValue(UifParameters.NAVIGATE_TO_PAGE_ID); |
311 | |
|
312 | |
|
313 | 0 | form.setRenderFullView(false); |
314 | |
|
315 | 0 | return getUIFModelAndView(form, form.getViewId(), pageId); |
316 | |
} |
317 | |
|
318 | |
@RequestMapping(params = "methodToCall=refresh") |
319 | |
public ModelAndView refresh(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, |
320 | |
HttpServletRequest request, HttpServletResponse response) throws Exception { |
321 | |
|
322 | |
|
323 | 0 | return getUIFModelAndView(form); |
324 | |
} |
325 | |
|
326 | |
|
327 | |
|
328 | |
|
329 | |
|
330 | |
|
331 | |
|
332 | |
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=updateComponent") |
333 | |
public ModelAndView updateComponent(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, |
334 | |
HttpServletRequest request, HttpServletResponse response) { |
335 | 0 | String requestedComponentId = request.getParameter(UifParameters.REQUESTED_COMPONENT_ID); |
336 | 0 | if (StringUtils.isBlank(requestedComponentId)) { |
337 | 0 | throw new RuntimeException("Requested component id for update not found in request"); |
338 | |
} |
339 | |
|
340 | 0 | Component comp = ComponentFactory.getComponentByIdWithLifecycle(form, requestedComponentId); |
341 | |
|
342 | 0 | return UifWebUtils.getComponentModelAndView(comp, form); |
343 | |
} |
344 | |
|
345 | |
|
346 | |
|
347 | |
|
348 | |
|
349 | |
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=performLookup") |
350 | |
public ModelAndView performLookup(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, |
351 | |
HttpServletRequest request, HttpServletResponse response) { |
352 | 0 | Properties lookupParameters = form.getActionParametersAsProperties(); |
353 | |
|
354 | 0 | String lookupObjectClassName = (String) lookupParameters.get(UifParameters.DATA_OBJECT_CLASS_NAME); |
355 | 0 | Class<?> lookupObjectClass = null; |
356 | |
try { |
357 | 0 | lookupObjectClass = Class.forName(lookupObjectClassName); |
358 | 0 | } catch (ClassNotFoundException e) { |
359 | 0 | LOG.error("Unable to get class for name: " + lookupObjectClassName); |
360 | 0 | throw new RuntimeException("Unable to get class for name: " + lookupObjectClassName, e); |
361 | 0 | } |
362 | |
|
363 | |
|
364 | 0 | String lookupParameterString = (String) lookupParameters.get(UifParameters.LOOKUP_PARAMETERS); |
365 | 0 | if (lookupParameterString != null) { |
366 | 0 | Map<String, String> lookupParameterFields = WebUtils.getMapFromParameterString(lookupParameterString); |
367 | 0 | for (Entry<String, String> lookupParameter : lookupParameterFields.entrySet()) { |
368 | 0 | String lookupParameterValue = LookupInquiryUtils.retrieveLookupParameterValue(form, request, |
369 | |
lookupObjectClass, lookupParameter.getValue(), lookupParameter.getKey()); |
370 | 0 | if (StringUtils.isNotBlank(lookupParameterValue)) { |
371 | 0 | lookupParameters.put(lookupParameter.getValue(), lookupParameterValue); |
372 | |
} |
373 | 0 | } |
374 | |
} |
375 | |
|
376 | |
|
377 | |
|
378 | |
|
379 | |
|
380 | 0 | String baseLookupUrl = (String) lookupParameters.get(UifParameters.BASE_LOOKUP_URL); |
381 | 0 | lookupParameters.remove(UifParameters.BASE_LOOKUP_URL); |
382 | |
|
383 | |
|
384 | 0 | lookupParameters.put(UifParameters.METHOD_TO_CALL, UifConstants.MethodToCallNames.START); |
385 | 0 | String autoSearchString = (String) lookupParameters.get(UifParameters.AUTO_SEARCH); |
386 | 0 | if (Boolean.parseBoolean(autoSearchString)) { |
387 | 0 | lookupParameters.put(UifParameters.METHOD_TO_CALL, UifConstants.MethodToCallNames.SEARCH); |
388 | |
} |
389 | |
|
390 | 0 | lookupParameters.put(UifParameters.RETURN_LOCATION, form.getFormPostUrl()); |
391 | 0 | lookupParameters.put(UifParameters.RETURN_FORM_KEY, form.getFormKey()); |
392 | |
|
393 | |
|
394 | 0 | if (lookupObjectClass != null) { |
395 | 0 | ModuleService responsibleModuleService = KRADServiceLocatorWeb.getKualiModuleService() |
396 | |
.getResponsibleModuleService(lookupObjectClass); |
397 | 0 | if (responsibleModuleService != null && responsibleModuleService.isExternalizable(lookupObjectClass)) { |
398 | 0 | Map<String, String> parameterMap = new HashMap<String, String>(); |
399 | 0 | Enumeration<Object> e = lookupParameters.keys(); |
400 | 0 | while (e.hasMoreElements()) { |
401 | 0 | String paramName = (String) e.nextElement(); |
402 | 0 | parameterMap.put(paramName, lookupParameters.getProperty(paramName)); |
403 | 0 | } |
404 | |
|
405 | 0 | String lookupUrl = responsibleModuleService.getExternalizableBusinessObjectLookupUrl(lookupObjectClass, |
406 | |
parameterMap); |
407 | 0 | return performRedirect(form, lookupUrl, new Properties()); |
408 | |
} |
409 | |
} |
410 | |
|
411 | 0 | return performRedirect(form, baseLookupUrl, lookupParameters); |
412 | |
} |
413 | |
|
414 | |
|
415 | |
|
416 | |
|
417 | |
|
418 | |
|
419 | |
|
420 | |
@RequestMapping(method = RequestMethod.GET, params = "methodToCall=performFieldSuggest") |
421 | |
public @ResponseBody AttributeQueryResult performFieldSuggest(@ModelAttribute("KualiForm") UifFormBase form, |
422 | |
BindingResult result, HttpServletRequest request, HttpServletResponse response) { |
423 | |
|
424 | |
|
425 | 0 | Map<String, String> queryParameters = new HashMap<String, String>(); |
426 | 0 | for (Object parameterName : request.getParameterMap().keySet()) { |
427 | 0 | if (parameterName.toString().startsWith(UifParameters.QUERY_PARAMETER + ".")) { |
428 | 0 | String fieldName = |
429 | |
StringUtils.substringAfter(parameterName.toString(), UifParameters.QUERY_PARAMETER + "."); |
430 | 0 | String fieldValue = request.getParameter(parameterName.toString()); |
431 | 0 | queryParameters.put(fieldName, fieldValue); |
432 | 0 | } |
433 | |
} |
434 | |
|
435 | |
|
436 | 0 | String queryFieldId = request.getParameter(UifParameters.QUERY_FIELD_ID); |
437 | 0 | if (StringUtils.isBlank(queryFieldId)) { |
438 | 0 | throw new RuntimeException( |
439 | |
"Unable to find id for field to perform query on under request parameter name: " + |
440 | |
UifParameters.QUERY_FIELD_ID); |
441 | |
} |
442 | |
|
443 | |
|
444 | 0 | String queryTerm = request.getParameter(UifParameters.QUERY_TERM); |
445 | 0 | if (StringUtils.isBlank(queryTerm)) { |
446 | 0 | throw new RuntimeException( |
447 | |
"Unable to find id for query term value for attribute query on under request parameter name: " + |
448 | |
UifParameters.QUERY_TERM); |
449 | |
} |
450 | |
|
451 | |
|
452 | 0 | AttributeQueryResult queryResult = KRADServiceLocatorWeb.getAttributeQueryService() |
453 | |
.performFieldSuggestQuery(form.getView(), queryFieldId, queryTerm, queryParameters); |
454 | |
|
455 | 0 | return queryResult; |
456 | |
} |
457 | |
|
458 | |
|
459 | |
|
460 | |
|
461 | |
|
462 | |
|
463 | |
|
464 | |
|
465 | |
@RequestMapping(method = RequestMethod.GET, params = "methodToCall=performFieldQuery") |
466 | |
public @ResponseBody AttributeQueryResult performFieldQuery(@ModelAttribute("KualiForm") UifFormBase form, |
467 | |
BindingResult result, HttpServletRequest request, HttpServletResponse response) { |
468 | |
|
469 | |
|
470 | 0 | Map<String, String> queryParameters = new HashMap<String, String>(); |
471 | 0 | for (Object parameterName : request.getParameterMap().keySet()) { |
472 | 0 | if (parameterName.toString().startsWith(UifParameters.QUERY_PARAMETER + ".")) { |
473 | 0 | String fieldName = |
474 | |
StringUtils.substringAfter(parameterName.toString(), UifParameters.QUERY_PARAMETER + "."); |
475 | 0 | String fieldValue = request.getParameter(parameterName.toString()); |
476 | 0 | queryParameters.put(fieldName, fieldValue); |
477 | 0 | } |
478 | |
} |
479 | |
|
480 | |
|
481 | 0 | String queryFieldId = request.getParameter(UifParameters.QUERY_FIELD_ID); |
482 | 0 | if (StringUtils.isBlank(queryFieldId)) { |
483 | 0 | throw new RuntimeException( |
484 | |
"Unable to find id for field to perform query on under request parameter name: " + |
485 | |
UifParameters.QUERY_FIELD_ID); |
486 | |
} |
487 | |
|
488 | |
|
489 | 0 | AttributeQueryResult queryResult = KRADServiceLocatorWeb.getAttributeQueryService() |
490 | |
.performFieldQuery(form.getView(), queryFieldId, queryParameters); |
491 | |
|
492 | 0 | return queryResult; |
493 | |
} |
494 | |
|
495 | |
|
496 | |
|
497 | |
|
498 | |
|
499 | |
|
500 | |
|
501 | |
|
502 | |
|
503 | |
|
504 | |
|
505 | |
|
506 | |
|
507 | |
protected ModelAndView performRedirect(UifFormBase form, String baseUrl, Properties urlParameters) { |
508 | |
|
509 | |
|
510 | 0 | urlParameters.setProperty(UifConstants.UrlParams.HISTORY, form.getFormHistory().getHistoryParameterString()); |
511 | |
|
512 | |
|
513 | |
|
514 | 0 | if (urlParameters.get("ajaxCall") != null && urlParameters.get("ajaxCall").equals("true")) { |
515 | 0 | urlParameters.remove("ajaxCall"); |
516 | 0 | String redirectUrl = UrlFactory.parameterizeUrl(baseUrl, urlParameters); |
517 | |
|
518 | 0 | ModelAndView modelAndView = new ModelAndView("redirectURL"); |
519 | 0 | modelAndView.addObject("redirectUrl", redirectUrl); |
520 | 0 | return modelAndView; |
521 | |
} |
522 | |
|
523 | 0 | String redirectUrl = UrlFactory.parameterizeUrl(baseUrl, urlParameters); |
524 | 0 | ModelAndView modelAndView = new ModelAndView(REDIRECT_PREFIX + redirectUrl); |
525 | |
|
526 | 0 | return modelAndView; |
527 | |
} |
528 | |
|
529 | |
protected ModelAndView getUIFModelAndView(UifFormBase form) { |
530 | 0 | return getUIFModelAndView(form, form.getViewId(), form.getPageId()); |
531 | |
} |
532 | |
|
533 | |
protected ModelAndView getUIFModelAndView(UifFormBase form, String viewId) { |
534 | 0 | return getUIFModelAndView(form, viewId, ""); |
535 | |
} |
536 | |
|
537 | |
|
538 | |
|
539 | |
|
540 | |
|
541 | |
|
542 | |
|
543 | |
|
544 | |
|
545 | |
|
546 | |
|
547 | |
|
548 | |
|
549 | |
|
550 | |
protected ModelAndView getUIFModelAndView(UifFormBase form, String viewId, String pageId) { |
551 | 0 | return UifWebUtils.getUIFModelAndView(form, viewId, pageId); |
552 | |
} |
553 | |
|
554 | |
protected ViewService getViewService() { |
555 | 0 | return KRADServiceLocatorWeb.getViewService(); |
556 | |
} |
557 | |
|
558 | |
public SessionDocumentService getSessionDocumentService() { |
559 | 0 | return KRADServiceLocatorWeb.getSessionDocumentService(); |
560 | |
} |
561 | |
|
562 | |
} |