Search in sources :

Example 1 with UserPref

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);
}
Also used : JSONObject(com.liferay.portal.kernel.json.JSONObject) Layout(com.liferay.portal.model.Layout) UserPref(org.apache.shindig.gadgets.spec.UserPref) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Aggregations

JSONObject (com.liferay.portal.kernel.json.JSONObject)1 Layout (com.liferay.portal.model.Layout)1 ThemeDisplay (com.liferay.portal.theme.ThemeDisplay)1 UserPref (org.apache.shindig.gadgets.spec.UserPref)1