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

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

Introduction

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

Prototype

public String getPortletResource() 

Source Link

Usage

From source file:com.liferay.asset.publisher.web.servlet.taglib.ui.BaseConfigurationFormNavigatorEntry.java

License:Open Source License

protected boolean isDynamicAssetSelection() {
    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    PortletPreferences portletSetup = themeDisplay.getStrictLayoutPortletSetup(themeDisplay.getLayout(),
            portletDisplay.getPortletResource());

    String selectionStyle = GetterUtil.getString(portletSetup.getValue("selectionStyle", null), "dynamic");

    if (Objects.equals(selectionStyle, "dynamic")) {
        return true;
    }/*from w  w  w.  j  a v a2  s  .c  o  m*/

    return false;
}

From source file:com.liferay.asset.publisher.web.servlet.taglib.ui.OrderingAndGroupingFormNavigatorEntry.java

License:Open Source License

@Override
public boolean isVisible(User user, Object object) {
    if (!isDynamicAssetSelection()) {
        return false;
    }/*from   www.j  a v  a  2  s . c  o  m*/

    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

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

    AssetPublisherCustomizer assetPublisherCustomizer = assetPublisherCustomizerRegistry
            .getAssetPublisherCustomizer(portlet.getRootPortletId());

    if (assetPublisherCustomizer == null) {
        return true;
    }

    return assetPublisherCustomizer.isOrderingAndGroupingEnabled(serviceContext.getRequest());
}

From source file:com.liferay.dynamic.data.lists.form.web.internal.display.context.DDLFormDisplayContext.java

License:Open Source License

protected String getPortletResource() {
    ThemeDisplay themeDisplay = getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    return portletDisplay.getPortletResource();
}

From source file:com.liferay.journal.web.internal.display.context.util.JournalWebRequestHelper.java

License:Open Source License

public JournalGroupServiceConfiguration getJournalGroupServiceConfiguration() {

    try {/*w w w. j  av a2 s  .  c om*/
        if (_journalGroupServiceConfiguration == null) {
            ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

            PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

            if (Validator.isNotNull(portletDisplay.getPortletResource())) {
                _journalGroupServiceConfiguration = ConfigurationProviderUtil.getConfiguration(
                        JournalGroupServiceConfiguration.class,
                        new ParameterMapSettingsLocator(_request.getParameterMap(),
                                new GroupServiceSettingsLocator(themeDisplay.getSiteGroupId(),
                                        JournalConstants.SERVICE_NAME)));
            } else {
                _journalGroupServiceConfiguration = ConfigurationProviderUtil.getConfiguration(
                        JournalGroupServiceConfiguration.class, new GroupServiceSettingsLocator(
                                themeDisplay.getSiteGroupId(), JournalConstants.SERVICE_NAME));
            }
        }

        return _journalGroupServiceConfiguration;
    } catch (PortalException pe) {
        throw new SystemException(pe);
    }
}

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   www  . j  a va  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;
}