List of usage examples for com.liferay.portal.kernel.diff CompareVersionsException CompareVersionsException
public CompareVersionsException(Throwable cause)
From source file:com.liferay.journal.util.impl.JournalUtil.java
License:Open Source License
public static String diffHtml(long groupId, String articleId, double sourceVersion, double targetVersion, String languageId, PortletRequestModel portletRequestModel, ThemeDisplay themeDisplay) throws Exception { JournalArticle sourceArticle = JournalArticleLocalServiceUtil.getArticle(groupId, articleId, sourceVersion); if (!JournalArticleLocalServiceUtil.isRenderable(sourceArticle, portletRequestModel, themeDisplay)) { throw new CompareVersionsException(sourceVersion); }/*from www . j av a2s. c om*/ JournalArticleDisplay sourceArticleDisplay = JournalArticleLocalServiceUtil.getArticleDisplay(sourceArticle, null, Constants.VIEW, languageId, 1, portletRequestModel, themeDisplay); JournalArticle targetArticle = JournalArticleLocalServiceUtil.getArticle(groupId, articleId, targetVersion); if (!JournalArticleLocalServiceUtil.isRenderable(targetArticle, portletRequestModel, themeDisplay)) { throw new CompareVersionsException(targetVersion); } JournalArticleDisplay targetArticleDisplay = JournalArticleLocalServiceUtil.getArticleDisplay(targetArticle, null, Constants.VIEW, languageId, 1, portletRequestModel, themeDisplay); return DiffHtmlUtil.diff(new UnsyncStringReader(sourceArticleDisplay.getContent()), new UnsyncStringReader(targetArticleDisplay.getContent())); }