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

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

Introduction

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

Prototype

public boolean isShowStagingIcon() 

Source Link

Usage

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;
    }/* w ww  .  j  a  v  a 2 s .co m*/

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