|
29 | 29 | import com.liferay.portal.configuration.metatype.bnd.util.ConfigurableUtil;
|
30 | 30 | import com.liferay.portal.kernel.json.JSONFactoryUtil;
|
31 | 31 | import com.liferay.portal.kernel.json.JSONObject;
|
| 32 | +import com.liferay.portal.kernel.language.LanguageUtil; |
32 | 33 | import com.liferay.portal.kernel.log.Log;
|
33 | 34 | import com.liferay.portal.kernel.log.LogFactoryUtil;
|
34 | 35 | import com.liferay.portal.kernel.model.WorkflowInstanceLink;
|
|
40 | 41 | import com.liferay.portal.kernel.service.WorkflowInstanceLinkLocalService;
|
41 | 42 | import com.liferay.portal.kernel.servlet.SessionErrors;
|
42 | 43 | import com.liferay.portal.kernel.theme.ThemeDisplay;
|
| 44 | +import com.liferay.portal.kernel.util.ListUtil; |
| 45 | +import com.liferay.portal.kernel.util.LocaleUtil; |
43 | 46 | import com.liferay.portal.kernel.util.MimeTypesUtil;
|
44 | 47 | import com.liferay.portal.kernel.util.ParamUtil;
|
45 | 48 | import com.liferay.portal.kernel.util.Validator;
|
|
66 | 69 |
|
67 | 70 | import java.io.IOException;
|
68 | 71 |
|
69 |
| -import java.util.Enumeration; |
| 72 | +import java.util.ArrayList; |
| 73 | +import java.util.Arrays; |
| 74 | +import java.util.List; |
| 75 | +import java.util.Locale; |
70 | 76 | import java.util.Map;
|
71 | 77 | import java.util.Objects;
|
72 | 78 |
|
@@ -377,26 +383,25 @@ protected void saveInPortletSession(
|
377 | 383 | *
|
378 | 384 | * @param resourceRequest the resource request
|
379 | 385 | * @param resourceResponse the resource response
|
380 |
| - * @throws Exception if an exception occurred |
381 | 386 | */
|
382 | 387 | protected void saveInPortletSession(
|
383 |
| - ResourceRequest resourceRequest, ResourceResponse resourceResponse) |
384 |
| - throws Exception { |
| 388 | + ResourceRequest resourceRequest, ResourceResponse resourceResponse) { |
385 | 389 |
|
386 |
| - Enumeration<String> enumeration = resourceRequest.getParameterNames(); |
| 390 | + Map<String, String[]> parameterMap = resourceRequest.getParameterMap(); |
387 | 391 |
|
388 |
| - while (enumeration.hasMoreElements()) { |
389 |
| - String name = enumeration.nextElement(); |
| 392 | + PortletSession portletSession = resourceRequest.getPortletSession(); |
390 | 393 |
|
391 |
| - if (Objects.equals(name, "doAsUserId")) { |
| 394 | + for (String parameterName : |
| 395 | + ListUtil.concat( |
| 396 | + _getLocalizedParameterNames(), _parameterNames)) { |
| 397 | + |
| 398 | + if (!parameterMap.containsKey(parameterName)) { |
392 | 399 | continue;
|
393 | 400 | }
|
394 | 401 |
|
395 |
| - PortletSession portletSession = resourceRequest.getPortletSession(); |
396 |
| - |
397 |
| - String value = ParamUtil.getString(resourceRequest, name); |
398 |
| - |
399 |
| - portletSession.setAttribute(name, value); |
| 402 | + portletSession.setAttribute( |
| 403 | + parameterName, |
| 404 | + ParamUtil.getString(resourceRequest, parameterName)); |
400 | 405 | }
|
401 | 406 | }
|
402 | 407 |
|
@@ -519,9 +524,28 @@ protected void setDisplayContext(
|
519 | 524 | @Reference
|
520 | 525 | protected StorageEngine storageEngine;
|
521 | 526 |
|
| 527 | + private List<String> _getLocalizedParameterNames() { |
| 528 | + List<String> localizedParameters = new ArrayList<>(); |
| 529 | + |
| 530 | + for (Locale availableLocale : LanguageUtil.getAvailableLocales()) { |
| 531 | + localizedParameters.add( |
| 532 | + "description" + LocaleUtil.toLanguageId(availableLocale)); |
| 533 | + localizedParameters.add( |
| 534 | + "name" + LocaleUtil.toLanguageId(availableLocale)); |
| 535 | + } |
| 536 | + |
| 537 | + return localizedParameters; |
| 538 | + } |
| 539 | + |
522 | 540 | private static final Log _log = LogFactoryUtil.getLog(
|
523 | 541 | KaleoFormsAdminPortlet.class);
|
524 | 542 |
|
| 543 | + private static final List<String> _parameterNames = Arrays.asList( |
| 544 | + "backURL", "ddmStructureId", "ddmStructureName", "ddmTemplateId", |
| 545 | + "historyKey", "kaleoProcessId", "kaleoTaskFormPairsData", "mvcPath", |
| 546 | + "redirect", "translatedLanguagesDescription", "translatedLanguagesName", |
| 547 | + "workflowDefinition"); |
| 548 | + |
525 | 549 | @Reference
|
526 | 550 | private DDLExporterFactory _ddlExporterFactory;
|
527 | 551 |
|
|
0 commit comments