List of usage examples for com.liferay.portal.kernel.util WebKeys JOURNAL_ARTICLE_DISPLAY
String JOURNAL_ARTICLE_DISPLAY
To view the source code for com.liferay.portal.kernel.util WebKeys JOURNAL_ARTICLE_DISPLAY.
Click Source Link
From source file:com.liferay.journal.content.web.internal.display.context.JournalContentDisplayContext.java
License:Open Source License
public JournalArticleDisplay getArticleDisplay() { if (_articleDisplay != null) { return _articleDisplay; }//from www . j ava 2 s .c o m _articleDisplay = (JournalArticleDisplay) _portletRequest.getAttribute(WebKeys.JOURNAL_ARTICLE_DISPLAY); if (_articleDisplay != null) { return _articleDisplay; } JournalArticle article = getArticle(); if (article == null) { return null; } ThemeDisplay themeDisplay = (ThemeDisplay) _portletRequest.getAttribute(WebKeys.THEME_DISPLAY); if (article.isApproved()) { JournalContent journalContent = (JournalContent) _portletRequest .getAttribute(JournalWebKeys.JOURNAL_CONTENT); _articleDisplay = journalContent.getDisplay(article.getGroupId(), article.getArticleId(), article.getVersion(), null, null, themeDisplay.getLanguageId(), 1, new PortletRequestModel(_portletRequest, _portletResponse), themeDisplay); } else { try { _articleDisplay = JournalArticleLocalServiceUtil.getArticleDisplay(article, null, null, themeDisplay.getLanguageId(), 1, new PortletRequestModel(_portletRequest, _portletResponse), themeDisplay); } catch (PortalException pe) { _log.error(pe, pe); } } return _articleDisplay; }
From source file:com.liferay.journal.content.web.internal.display.context.JournalContentDisplayContext.java
License:Open Source License
public List<ContentMetadataAssetAddonEntry> getSelectedContentMetadataAssetAddonEntries() { if (_contentMetadataAssetAddonEntries != null) { return _contentMetadataAssetAddonEntries; }/*from w ww . jav a2s. co m*/ _contentMetadataAssetAddonEntries = new ArrayList<>(); String contentMetadataAssetAddonEntryKeysKeysString = _journalContentPortletInstanceConfiguration .contentMetadataAssetAddonEntryKeys(); if (Validator.isNull(contentMetadataAssetAddonEntryKeysKeysString)) { return _contentMetadataAssetAddonEntries; } String[] contentMetadataAssetAddonEntryKeys = StringUtil .split(contentMetadataAssetAddonEntryKeysKeysString); for (String contentMetadataAssetAddonEntryKey : contentMetadataAssetAddonEntryKeys) { ContentMetadataAssetAddonEntry contentMetadataAssetAddonEntry = ContentMetadataAssetAddonEntryTracker .getContentMetadataAssetAddonEntry(contentMetadataAssetAddonEntryKey); if (contentMetadataAssetAddonEntry != null) { _contentMetadataAssetAddonEntries.add(contentMetadataAssetAddonEntry); } } _portletRequest.setAttribute(WebKeys.JOURNAL_ARTICLE, getArticle()); _portletRequest.setAttribute(WebKeys.JOURNAL_ARTICLE_DISPLAY, getArticleDisplay()); return _contentMetadataAssetAddonEntries; }
From source file:com.liferay.journal.content.web.internal.display.context.JournalContentDisplayContext.java
License:Open Source License
public List<UserToolAssetAddonEntry> getSelectedUserToolAssetAddonEntries() { if (_userToolAssetAddonEntries != null) { return _userToolAssetAddonEntries; }//www .ja v a 2 s.c o m _userToolAssetAddonEntries = new ArrayList<>(); String userToolAssetAddonEntryKeysString = _journalContentPortletInstanceConfiguration .userToolAssetAddonEntryKeys(); if (Validator.isNull(userToolAssetAddonEntryKeysString)) { return _userToolAssetAddonEntries; } String[] userToolAssetAddonEntryKeys = StringUtil.split(userToolAssetAddonEntryKeysString); for (String userToolAssetAddonEntryKey : userToolAssetAddonEntryKeys) { UserToolAssetAddonEntry userToolAssetAddonEntry = UserToolAssetAddonEntryTracker .getUserToolAssetAddonEntry(userToolAssetAddonEntryKey); if (userToolAssetAddonEntry != null) { _userToolAssetAddonEntries.add(userToolAssetAddonEntry); } } _portletRequest.setAttribute(WebKeys.JOURNAL_ARTICLE, getArticle()); _portletRequest.setAttribute(WebKeys.JOURNAL_ARTICLE_DISPLAY, getArticleDisplay()); return _userToolAssetAddonEntries; }
From source file:com.liferay.journal.content.web.internal.portlet.JournalContentPortlet.java
License:Open Source License
@Override public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { PortletPreferences portletPreferences = renderRequest.getPreferences(); ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); long articleGroupId = PrefsParamUtil.getLong(portletPreferences, renderRequest, "groupId", themeDisplay.getScopeGroupId()); String articleId = PrefsParamUtil.getString(portletPreferences, renderRequest, "articleId"); String ddmTemplateKey = PrefsParamUtil.getString(portletPreferences, renderRequest, "ddmTemplateKey"); JournalArticle article = null;//from w w w . ja v a 2 s .c om JournalArticleDisplay articleDisplay = null; if ((articleGroupId > 0) && Validator.isNotNull(articleId)) { String viewMode = ParamUtil.getString(renderRequest, "viewMode"); String languageId = LanguageUtil.getLanguageId(renderRequest); int page = ParamUtil.getInteger(renderRequest, "page", 1); article = _journalArticleLocalService.fetchLatestArticle(articleGroupId, articleId, WorkflowConstants.STATUS_APPROVED); try { if (article == null) { article = _journalArticleLocalService.getLatestArticle(articleGroupId, articleId, WorkflowConstants.STATUS_ANY); } if (Validator.isNull(ddmTemplateKey)) { ddmTemplateKey = article.getDDMTemplateKey(); } articleDisplay = _journalContent.getDisplay(article, ddmTemplateKey, viewMode, languageId, page, new PortletRequestModel(renderRequest, renderResponse), themeDisplay); } catch (Exception e) { renderRequest.removeAttribute(WebKeys.JOURNAL_ARTICLE); } } if (article != null) { renderRequest.setAttribute(WebKeys.JOURNAL_ARTICLE, article); } if (articleDisplay != null) { renderRequest.setAttribute(WebKeys.JOURNAL_ARTICLE_DISPLAY, articleDisplay); } else { renderRequest.removeAttribute(WebKeys.JOURNAL_ARTICLE_DISPLAY); } super.doView(renderRequest, renderResponse); }
From source file:com.liferay.journal.web.asset.JournalArticleAssetRenderer.java
License:Open Source License
@Override public boolean include(HttpServletRequest request, HttpServletResponse response, String template) throws Exception { request.setAttribute(WebKeys.JOURNAL_ARTICLE, _article); request.setAttribute(WebKeys.JOURNAL_ARTICLE_DISPLAY, getArticleDisplay(request, response)); return super.include(request, response, template); }