Example usage for com.liferay.portal.kernel.util WebKeys LAYOUT_ASSET_ENTRY

List of usage examples for com.liferay.portal.kernel.util WebKeys LAYOUT_ASSET_ENTRY

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util WebKeys LAYOUT_ASSET_ENTRY.

Prototype

String LAYOUT_ASSET_ENTRY

To view the source code for com.liferay.portal.kernel.util WebKeys LAYOUT_ASSET_ENTRY.

Click Source Link

Usage

From source file:com.liferay.asset.publisher.web.display.context.AssetPublisherDisplayContext.java

License:Open Source License

public void setLayoutAssetEntry(AssetEntry assetEntry) throws PortalException {

    ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

    String defaultAssetPublisherPortletId = _assetPublisherWebUtil
            .getDefaultAssetPublisherId(themeDisplay.getLayout());

    if (isDefaultAssetPublisher() || Validator.isNull(defaultAssetPublisherPortletId)
            || !PortletPermissionUtil.contains(themeDisplay.getPermissionChecker(), themeDisplay.getLayout(),
                    defaultAssetPublisherPortletId, ActionKeys.VIEW)) {

        _request.setAttribute(WebKeys.LAYOUT_ASSET_ENTRY, assetEntry);
    }//from   w ww  .  ja  v a 2 s .c  o  m
}

From source file:com.liferay.asset.publisher.web.internal.portlet.filter.RelatedAssetsRenderParametersPortletFilter.java

License:Open Source License

@Override
public void doFilter(RenderRequest renderRequest, RenderResponse renderResponse, FilterChain filterChain)
        throws IOException, PortletException {

    HttpServletRequest httpServletRequest = _portal.getHttpServletRequest(renderRequest);

    if (httpServletRequest.getAttribute(WebKeys.LAYOUT_ASSET_ENTRY) == null) {

        clearDynamicServletRequestParameters(httpServletRequest);

        clearRenderRequestParameters(renderRequest, httpServletRequest);
    }//from   w  w  w .j  av a2 s .  com

    filterChain.doFilter(renderRequest, renderResponse);
}

From source file:com.liferay.asset.publisher.web.util.RelatedAssetPublisherCustomizer.java

License:Open Source License

@Override
public void setAssetEntryQueryOptions(AssetEntryQuery assetEntryQuery, HttpServletRequest request) {

    AssetEntry layoutAssetEntry = (AssetEntry) request.getAttribute(WebKeys.LAYOUT_ASSET_ENTRY);

    if (layoutAssetEntry != null) {
        assetEntryQuery.setLinkedAssetEntryId(layoutAssetEntry.getEntryId());
    }/*from w w w .  j  a v a 2 s.  c o m*/
}

From source file:com.liferay.journal.internal.events.JournalServicePreAction.java

License:Open Source License

public void servicePre(HttpServletRequest request) throws PortalException {
    String strutsAction = _portal.getStrutsAction(request);

    if (!strutsAction.equals(_PATH_PORTAL_LAYOUT)) {
        return;/*from w w  w.  j a  v a 2  s  .  co  m*/
    }

    long mainJournalArticleId = ParamUtil.getLong(request, "p_j_a_id");

    if (mainJournalArticleId <= 0) {
        return;
    }

    try {
        JournalArticle mainJournalArticle = _journalArticleService.getArticle(mainJournalArticleId);

        AssetEntry layoutAssetEntry = _assetEntryLocalService.getEntry(JournalArticle.class.getName(),
                mainJournalArticle.getResourcePrimKey());

        request.setAttribute(WebKeys.LAYOUT_ASSET_ENTRY, layoutAssetEntry);
    } catch (NoSuchArticleException nsae) {
        if (_log.isWarnEnabled()) {
            _log.warn(nsae.getMessage());
        }
    }
}