Skip to content

Instantly share code, notes, and snippets.

@evaldeslacasa
Last active August 29, 2015 14:14
Show Gist options
  • Save evaldeslacasa/3975e4a55cc1f67685cc to your computer and use it in GitHub Desktop.
Save evaldeslacasa/3975e4a55cc1f67685cc to your computer and use it in GitHub Desktop.
Retrieve Web Content article in HTML - Liferay 6.1.1 CE. To retrieve the HTML of a web content added in the Site Scope... which is based on a template and structure from Global Scope
protected String retrieveHTMLContent(ThemeDisplay themeDisplay) throws SystemException, PortalException{
String structureId="MY_STRUCTURE_ID";
String templateId = "MY_TEMPLATE_ID";
Company company = CompanyLocalServiceUtil.getCompanyByMx(PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID));
long globalGroupId = company.getGroup().getGroupId();
long groupId = themeDisplay.getLayout().getGroupId();
JournalStructure rememberMe = JournalStructureLocalServiceUtil.getStructure(globalGroupId,structureId);
JournalArticle rememberMeContent =
JournalArticleLocalServiceUtil.getStructureArticles(groupId, structureId).get(0);
String articleId = rememberMeContent.getArticleId();
String content = JournalContentUtil.
getContent(groupId, articleId, templateId, themeDisplay.getLocale().toString(), themeDisplay);
return content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment