Example usage for com.liferay.portal.util PropsValues PORTLET_PUBLIC_RENDER_PARAMETER_DISTRIBUTION_LAYOUT

List of usage examples for com.liferay.portal.util PropsValues PORTLET_PUBLIC_RENDER_PARAMETER_DISTRIBUTION_LAYOUT

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues PORTLET_PUBLIC_RENDER_PARAMETER_DISTRIBUTION_LAYOUT.

Prototype

boolean PORTLET_PUBLIC_RENDER_PARAMETER_DISTRIBUTION_LAYOUT

To view the source code for com.liferay.portal.util PropsValues PORTLET_PUBLIC_RENDER_PARAMETER_DISTRIBUTION_LAYOUT.

Click Source Link

Usage

From source file:com.liferay.portlet.PublicRenderParametersPool.java

License:Open Source License

public static Map<String, String[]> get(HttpServletRequest request, long plid) {

    if (PropsValues.PORTLET_PUBLIC_RENDER_PARAMETER_DISTRIBUTION_LAYOUT) {
        return RenderParametersPool.get(request, plid, _PUBLIC_RENDER_PARAMETERS);
    }/*from   w w w  .  j av  a  2 s.c  o m*/

    HttpSession session = request.getSession();

    Map<Long, Map<String, String[]>> publicRenderParametersPool = (Map<Long, Map<String, String[]>>) session
            .getAttribute(WebKeys.PUBLIC_RENDER_PARAMETERS_POOL);

    if (publicRenderParametersPool == null) {
        publicRenderParametersPool = new ConcurrentHashMap<Long, Map<String, String[]>>();

        session.setAttribute(WebKeys.PUBLIC_RENDER_PARAMETERS_POOL, publicRenderParametersPool);
    }

    try {
        Layout layout = LayoutLocalServiceUtil.getLayout(plid);

        LayoutSet layoutSet = layout.getLayoutSet();

        Map<String, String[]> publicRenderParameters = publicRenderParametersPool
                .get(layoutSet.getLayoutSetId());

        if (publicRenderParameters == null) {
            publicRenderParameters = new HashMap<String, String[]>();

            publicRenderParametersPool.put(layoutSet.getLayoutSetId(), publicRenderParameters);
        }

        return publicRenderParameters;
    } catch (Exception e) {
        if (_log.isWarnEnabled()) {
            _log.warn(e, e);
        }

        return new HashMap<String, String[]>();
    }
}