Example usage for com.liferay.portal.kernel.settings ModifiableSettings setValues

List of usage examples for com.liferay.portal.kernel.settings ModifiableSettings setValues

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.settings ModifiableSettings setValues.

Prototype

public ModifiableSettings setValues(ModifiableSettings modifiableSettings);

Source Link

Usage

From source file:com.liferay.portlet.configuration.web.internal.portlet.PortletConfigurationPortlet.java

License:Open Source License

public void restoreArchivedSetup(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    Portlet portlet = ActionUtil.getPortlet(actionRequest);

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Settings portletInstanceSettings = SettingsFactoryUtil
            .getSettings(new PortletInstanceSettingsLocator(themeDisplay.getLayout(), portlet.getPortletId()));

    ModifiableSettings portletInstanceModifiableSettings = portletInstanceSettings.getModifiableSettings();

    String name = ParamUtil.getString(actionRequest, "name");

    ArchivedSettings archivedSettings = SettingsFactoryUtil.getPortletInstanceArchivedSettings(
            themeDisplay.getSiteGroupId(), portlet.getRootPortletId(), name);

    portletInstanceModifiableSettings.reset();

    portletInstanceModifiableSettings.setValues(archivedSettings);

    portletInstanceModifiableSettings.store();

    String portletResource = ParamUtil.getString(actionRequest, "portletResource");

    SessionMessages.add(actionRequest,/*from   ww w .  ja va  2 s  .  c om*/
            _portal.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET, portletResource);
}