List of usage examples for com.liferay.portal.kernel.model Portlet getFriendlyURLMapping
public String getFriendlyURLMapping();
From source file:com.liferay.blogs.internal.util.PingbackMethodImpl.java
License:Open Source License
protected ServiceContext buildServiceContext(long companyId, long groupId, String urlTitle) throws Exception { ServiceContext serviceContext = new ServiceContext(); String pingbackUserName = LanguageUtil.get(LocaleUtil.getSiteDefault(), "pingback"); serviceContext.setAttribute("pingbackUserName", pingbackUserName); StringBundler sb = new StringBundler(5); String portletId = PortletProviderUtil.getPortletId(BlogsEntry.class.getName(), PortletProvider.Action.VIEW); if (Validator.isNull(portletId)) { return serviceContext; }/* w ww . j ava 2s.c o m*/ String layoutFullURL = PortalUtil.getLayoutFullURL(groupId, portletId); sb.append(layoutFullURL); sb.append(Portal.FRIENDLY_URL_SEPARATOR); Portlet portlet = _portletLocalService.getPortletById(companyId, portletId); sb.append(portlet.getFriendlyURLMapping()); sb.append(StringPool.SLASH); sb.append(urlTitle); serviceContext.setAttribute("redirect", sb.toString()); serviceContext.setLayoutFullURL(layoutFullURL); return serviceContext; }
From source file:com.liferay.blogs.internal.util.PingbackMethodImplTest.java
License:Open Source License
protected void setUpPortletLocalServiceUtil() { Portlet portlet = Mockito.mock(Portlet.class); when(portlet.getFriendlyURLMapperInstance()).thenReturn(_friendlyURLMapper); when(portlet.getFriendlyURLMapping()).thenReturn(_FRIENDLY_URL_MAPPING); when(_portletLocalService.getPortletById(BlogsPortletKeys.BLOGS)).thenReturn(portlet); when(_portletLocalService.getPortletById(Matchers.anyLong(), Matchers.eq(BlogsPortletKeys.BLOGS))) .thenReturn(portlet);//from w ww . j a v a2 s.c o m }