Example usage for com.liferay.portal.kernel.util PortalUtil getLayoutFriendlyURL

List of usage examples for com.liferay.portal.kernel.util PortalUtil getLayoutFriendlyURL

Introduction

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

Prototype

public static String getLayoutFriendlyURL(Layout layout, ThemeDisplay themeDisplay) throws PortalException 

Source Link

Usage

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

License:Open Source License

protected static String getAssetPublisherURL(PortletRequest portletRequest) throws Exception {

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

    Layout layout = themeDisplay.getLayout();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    StringBundler sb = new StringBundler(6);

    String layoutFriendlyURL = GetterUtil.getString(PortalUtil.getLayoutFriendlyURL(layout, themeDisplay));

    if (!layoutFriendlyURL.startsWith(Http.HTTP_WITH_SLASH)
            && !layoutFriendlyURL.startsWith(Http.HTTPS_WITH_SLASH)) {

        sb.append(themeDisplay.getPortalURL());
    }//from  w w  w  .jav  a  2s . c  o m

    sb.append(layoutFriendlyURL);
    sb.append(Portal.FRIENDLY_URL_SEPARATOR);
    sb.append("asset_publisher/");
    sb.append(portletDisplay.getInstanceId());
    sb.append(StringPool.SLASH);

    return sb.toString();
}

From source file:com.liferay.dynamic.data.lists.web.internal.template.DDLDisplayTemplateHelper.java

License:Open Source License

public static String getLayoutFriendlyURL(DDMFormFieldValue recordFieldValue, ThemeDisplay themeDisplay)
        throws PortalException {

    Value value = recordFieldValue.getValue();

    String valueString = value.getString(themeDisplay.getLocale());

    if (Validator.isNull(valueString)) {
        return StringPool.BLANK;
    }//from   w  w  w .  j  a v  a  2  s  . c o m

    JSONObject jsonObject = JSONFactoryUtil.createJSONObject(valueString);

    long groupId = jsonObject.getLong("groupId");
    boolean privateLayout = jsonObject.getBoolean("privateLayout");
    long layoutId = jsonObject.getLong("layoutId");

    Layout layout = LayoutLocalServiceUtil.getLayout(groupId, privateLayout, layoutId);

    return PortalUtil.getLayoutFriendlyURL(layout, themeDisplay);
}

From source file:com.liferay.layout.admin.web.internal.asset.LayoutAssetRenderer.java

License:Open Source License

@Override
public String getURLViewInContext(LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse, String noSuchEntryRedirect) {

    try {/*from w w  w. j  a  v  a 2s  .  co m*/
        ThemeDisplay themeDisplay = (ThemeDisplay) liferayPortletRequest.getAttribute(WebKeys.THEME_DISPLAY);

        Layout layout = LayoutLocalServiceUtil.getLayout(_layout.getPlid());

        return PortalUtil.getLayoutFriendlyURL(layout, themeDisplay);
    } catch (Exception e) {
        return StringPool.BLANK;
    }
}