List of usage examples for com.liferay.portal.kernel.util WebKeys PORTLET_PREFERENCES_MAP
String PORTLET_PREFERENCES_MAP
To view the source code for com.liferay.portal.kernel.util WebKeys PORTLET_PREFERENCES_MAP.
Click Source Link
From source file:com.verce.action.ConfigurationActionImpl.java
License:Open Source License
@Override public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, "cmd"); if (cmd.equals("update")) { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); UnicodeProperties properties = PropertiesParamUtil.getProperties(actionRequest, PREFERENCES_PREFIX); String portletResource = ParamUtil.getString(actionRequest, "portletResource"); PortletPermissionUtil.check(themeDisplay.getPermissionChecker(), themeDisplay.getLayout(), portletResource, ActionKeys.CONFIGURATION); PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);//from w w w . ja va 2 s . c o m for (Map.Entry<String, String> entry : properties.entrySet()) { String name = entry.getKey(); String value = entry.getValue(); portletPreferences.setValue(name, value); } Map<String, String[]> portletPreferencesMap = (Map<String, String[]>) actionRequest .getAttribute(WebKeys.PORTLET_PREFERENCES_MAP); if (portletPreferencesMap != null) { for (Map.Entry<String, String[]> entry : portletPreferencesMap.entrySet()) { String name = entry.getKey(); String[] values = entry.getValue(); portletPreferences.setValues(name, values); } } if (SessionErrors.isEmpty(actionRequest)) { portletPreferences.store(); LiferayPortletConfig liferayPortletConfig = (LiferayPortletConfig) portletConfig; SessionMessages.add(actionRequest, liferayPortletConfig.getPortletId() + ".refreshPortlet", portletResource); SessionMessages.add(actionRequest, liferayPortletConfig.getPortletId() + ".updatedConfiguration"); } } }