List of usage examples for com.liferay.portal.kernel.util PortalUtil getGroupFriendlyURL
public static String getGroupFriendlyURL(LayoutSet layoutSet, ThemeDisplay themeDisplay) throws PortalException
From source file:com.liferay.journal.web.asset.JournalArticleAssetRenderer.java
License:Open Source License
@Override public String getURLViewInContext(LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse, String noSuchEntryRedirect) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) liferayPortletRequest.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = _article.getLayout(); if (layout == null) { layout = themeDisplay.getLayout(); }/*from w ww.j a v a2 s .co m*/ String portletId = (String) liferayPortletRequest.getAttribute(WebKeys.PORTLET_ID); PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getStrictLayoutPortletSetup(layout, portletId); String linkToLayoutUuid = GetterUtil.getString(portletSetup.getValue("portletSetupLinkToLayoutUuid", null)); if (Validator.isNotNull(_article.getLayoutUuid()) && Validator.isNull(linkToLayoutUuid)) { Group group = themeDisplay.getScopeGroup(); if (group.getGroupId() != _article.getGroupId()) { group = GroupLocalServiceUtil.getGroup(_article.getGroupId()); } String groupFriendlyURL = PortalUtil.getGroupFriendlyURL( LayoutSetLocalServiceUtil.getLayoutSet(group.getGroupId(), layout.isPrivateLayout()), themeDisplay); return PortalUtil.addPreservedParameters(themeDisplay, groupFriendlyURL .concat(JournalArticleConstants.CANONICAL_URL_SEPARATOR).concat(_article.getUrlTitle())); } String hitLayoutURL = getHitLayoutURL(layout.isPrivateLayout(), noSuchEntryRedirect, themeDisplay); if (hitLayoutURL.equals(noSuchEntryRedirect)) { hitLayoutURL = getHitLayoutURL(!layout.isPrivateLayout(), noSuchEntryRedirect, themeDisplay); } return hitLayoutURL; }