Example usage for com.liferay.portal.kernel.theme PortletDisplay getRootPortletId

List of usage examples for com.liferay.portal.kernel.theme PortletDisplay getRootPortletId

Introduction

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

Prototype

public String getRootPortletId() 

Source Link

Usage

From source file:com.liferay.portlet.configuration.icon.locator.internal.LegacyConfigurationIconLocator.java

License:Open Source License

@Override
public String getPath(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String portletId = portletDisplay.getRootPortletId();

    Portlet portlet = _portletLocalService.getPortletById(portletId);

    if (portlet == null) {
        return StringPool.BLANK;
    }//from w  ww .  j  av  a  2  s  .c  o m

    Map<String, String> initParams = portlet.getInitParams();

    boolean alwaysDisplayDefaultConfigurationIcons = GetterUtil
            .getBoolean(initParams.get("always-display-default-configuration-icons"));

    if (alwaysDisplayDefaultConfigurationIcons) {
        return StringPool.DASH;
    }

    return StringPool.BLANK;
}

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

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String rootPortletId = portletDisplay.getRootPortletId();

    if (Validator.isNotNull(portletDisplay.getPortletResource())) {
        String portletResource = portletDisplay.getPortletResource();

        Portlet portlet = _portletLocalService.getPortletById(themeDisplay.getCompanyId(), portletResource);

        rootPortletId = portlet.getRootPortletId();
    }//from w  w w  .  jav  a 2  s. c  o  m

    boolean showPermissionsIcon = false;

    Layout layout = themeDisplay.getLayout();

    Group group = themeDisplay.getScopeGroup();

    if (!group.hasStagingGroup() || _STAGING_LIVE_GROUP_LOCKING_ENABLED) {
        try {
            if (PortletPermissionUtil.contains(themeDisplay.getPermissionChecker(), layout, rootPortletId,
                    ActionKeys.PERMISSIONS)) {

                showPermissionsIcon = true;
            }
        } catch (PortalException pe) {

            // LPS-52675

            if (_log.isDebugEnabled()) {
                _log.debug(pe, pe);
            }

            showPermissionsIcon = false;
        }
    }

    if (layout.isLayoutPrototypeLinkActive()) {
        showPermissionsIcon = false;
    }

    if (layout.isTypeControlPanel()) {
        showPermissionsIcon = false;
    }

    return showPermissionsIcon;
}

From source file:com.liferay.staging.configuration.web.internal.portlet.configuration.icon.StagingPortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Group group = themeDisplay.getSiteGroup();

    if (group.isStagedRemotely() || group.hasLocalOrRemoteStagingGroup()) {
        return false;
    }//from  w ww  . j a v  a2s .com

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String rootPortletId = portletDisplay.getRootPortletId();

    if (rootPortletId.equals(ExportImportPortletKeys.EXPORT)
            || rootPortletId.equals(ExportImportPortletKeys.EXPORT_IMPORT)
            || rootPortletId.equals(ExportImportPortletKeys.IMPORT)
            || rootPortletId.equals(StagingConfigurationPortletKeys.STAGING_CONFIGURATION)
            || rootPortletId.equals(StagingProcessesPortletKeys.STAGING_PROCESSES)) {

        return false;
    }

    if (!portletDisplay.isShowStagingIcon()) {
        return false;
    }

    try {
        return GroupPermissionUtil.contains(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroup(),
                ActionKeys.PUBLISH_PORTLET_INFO);
    } catch (PortalException pe) {

        // LPS-52675

        if (_log.isDebugEnabled()) {
            _log.debug(pe, pe);
        }

        return false;
    }
}