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, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET, portletResource); }
public void deleteArchivedSetups(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { Portlet portlet = ActionUtil.getPortlet(actionRequest); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String[] names = null; String name = ParamUtil.getString(actionRequest, "name"); if (Validator.isNotNull(name)) { names = new String[] {name}; } else { names = ParamUtil.getStringValues(actionRequest, "rowIds"); } for (String curName : names) { ArchivedSettings archivedSettings = SettingsFactoryUtil.getPortletInstanceArchivedSettings( themeDisplay.getSiteGroupId(), portlet.getRootPortletId(), curName); archivedSettings.delete(); } }
public void updateArchivedSetup(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { Portlet portlet = ActionUtil.getPortlet(actionRequest); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String name = ParamUtil.getString(actionRequest, "name"); ArchivedSettings archivedSettings = SettingsFactoryUtil.getPortletInstanceArchivedSettings( themeDisplay.getSiteGroupId(), portlet.getRootPortletId(), name); Settings portletInstanceSettings = SettingsFactoryUtil.getSettings( new PortletInstanceSettingsLocator(themeDisplay.getLayout(), portlet.getPortletId())); ModifiableSettings portletInstanceModifiableSettings = portletInstanceSettings.getModifiableSettings(); archivedSettings.setValues(portletInstanceModifiableSettings); archivedSettings.store(); }