use of org.apache.shindig.gadgets.spec.UserPref in project liferay-ide by liferay.
the class BaseConfigurationAction method doProcessAction.
protected void doProcessAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
Layout layout = themeDisplay.getLayout();
JSONObject userPrefsJSONObject = JSONFactoryUtil.createJSONObject();
Map<String, UserPref> userPrefs = getUserPrefs(portletConfig, actionRequest);
for (UserPref userPref : userPrefs.values()) {
String name = userPref.getName();
String value = ParamUtil.getString(actionRequest, name);
userPrefsJSONObject.put(name, value);
}
String namespace = ShindigUtil.getPortletResourceNamespace(actionRequest, themeDisplay);
String columnName = ShindigUtil.getColumnUserPrefs(namespace, themeDisplay);
ExpandoValueServiceUtil.addValue(themeDisplay.getCompanyId(), Layout.class.getName(), ShindigUtil.getTableOpenSocial(), columnName, layout.getPlid(), userPrefsJSONObject.toString());
String portletResource = ParamUtil.getString(actionRequest, "portletResource");
SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET, portletResource);
SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_UPDATED_CONFIGURATION);
}
Aggregations