Example usage for com.liferay.portal.kernel.model Portlet getRootPortletId

List of usage examples for com.liferay.portal.kernel.model Portlet getRootPortletId

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model Portlet getRootPortletId.

Prototype

public String getRootPortletId();

Source Link

Document

Returns the root portlet ID of the portlet.

Usage

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

License:Open Source License

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;//from w  ww  .  j  ava 2 s  .co  m

    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();
    }
}

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  w  w w  .  jav  a  2s  . co m*/
            _portal.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET, portletResource);
}

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

License:Open Source License

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();/*from   w  w w  .  j a  v a2 s.com*/
}

From source file:com.liferay.site.internal.exportimport.data.handler.StagedGroupStagedModelDataHandler.java

License:Open Source License

protected Set<String> checkDataSiteLevelPortlets(PortletDataContext portletDataContext, Group group)
        throws Exception {

    List<Portlet> dataSiteLevelPortlets = _exportImportHelper
            .getDataSiteLevelPortlets(portletDataContext.getCompanyId());

    Group liveGroup = group;//ww  w.j a  va2s. c  o  m

    if (liveGroup.isStagingGroup()) {
        liveGroup = liveGroup.getLiveGroup();
    }

    Set<String> portletIds = new LinkedHashSet<>();

    for (Portlet portlet : dataSiteLevelPortlets) {
        String portletId = portlet.getRootPortletId();

        if (ExportImportThreadLocal.isStagingInProcess() && !liveGroup.isStagedPortlet(portletId)) {

            continue;
        }

        // Calculate the amount of exported data

        if (BackgroundTaskThreadLocal.hasBackgroundTask()) {
            Map<String, Boolean> exportPortletControlsMap = _exportImportHelper.getExportPortletControlsMap(
                    portletDataContext.getCompanyId(), portletId, portletDataContext.getParameterMap(),
                    portletDataContext.getType());

            if (exportPortletControlsMap.get(PortletDataHandlerKeys.PORTLET_DATA)) {

                PortletDataHandler portletDataHandler = portlet.getPortletDataHandlerInstance();

                portletDataHandler.prepareManifestSummary(portletDataContext);
            }
        }

        // Add portlet ID to exportable portlets list

        portletIds.add(portletId);
    }

    return portletIds;
}