use of com.liferay.portlet.journal.NoSuchArticleException in project liferay-ide by liferay.
the class JournalArticleAssetRendererFactory method getAssetRenderer.
@Override
public AssetRenderer getAssetRenderer(long classPK, int type) throws PortalException, SystemException {
JournalArticle article = null;
try {
article = JournalArticleLocalServiceUtil.getArticle(classPK);
} catch (NoSuchArticleException nsae1) {
JournalArticleResource articleResource = JournalArticleResourceLocalServiceUtil.getArticleResource(classPK);
boolean approvedArticleAvailable = true;
if (type == TYPE_LATEST_APPROVED) {
try {
article = JournalArticleLocalServiceUtil.getDisplayArticle(articleResource.getGroupId(), articleResource.getArticleId());
} catch (NoSuchArticleException nsae2) {
approvedArticleAvailable = false;
}
}
if ((type != TYPE_LATEST_APPROVED) || !approvedArticleAvailable) {
article = JournalArticleLocalServiceUtil.getLatestArticle(articleResource.getGroupId(), articleResource.getArticleId(), WorkflowConstants.STATUS_ANY);
}
}
JournalArticleAssetRenderer journalArticleAssetRenderer = new JournalArticleAssetRenderer(article);
journalArticleAssetRenderer.setAssetRendererType(type);
return journalArticleAssetRenderer;
}
Aggregations