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