@Override protected void updateBaseModel(long baseModelId) throws Exception { WikiPage page = WikiPageLocalServiceUtil.getPage(baseModelId); WikiTestUtil.updatePage(page); }
public static String getURL( HttpServletRequest request, ThemeDisplay themeDisplay, AssetRendererFactory assetRendererFactory, AssetRenderer assetRenderer) throws Exception { long classPK = assetRenderer.getClassPK(); String className = assetRendererFactory.getClassName(); String portletId = PortletProviderUtil.getPortletId(className, PortletProvider.Action.VIEW); PortletURL portletURL = null; if (className.equals(BlogsEntry.class.getName())) { portletURL = PortletURLFactoryUtil.create( request, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcRenderCommandName", "/blogs/view_entry"); portletURL.setParameter("entryId", String.valueOf(classPK)); } else if (className.equals(JournalArticle.class.getName())) { JournalArticle journalArticle = JournalArticleLocalServiceUtil.getLatestArticle(classPK); portletURL = PortletURLFactoryUtil.create( request, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); portletURL.setParameter("struts_action", "/journal_content/view"); portletURL.setParameter("groupId", String.valueOf(journalArticle.getGroupId())); portletURL.setParameter("articleId", journalArticle.getArticleId()); } else if (className.equals(KBArticle.class.getName())) { portletURL = PortletURLFactoryUtil.create( request, PortletKeys.KNOWLEDGE_BASE_ARTICLE_DEFAULT_INSTANCE, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/article/view_article.jsp"); portletURL.setParameter("resourcePrimKey", String.valueOf(classPK)); } else if (className.equals(MBMessage.class.getName())) { portletURL = PortletURLFactoryUtil.create( request, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); portletURL.setParameter("struts_action", "/message_boards/view_message"); portletURL.setParameter("messageId", String.valueOf(classPK)); } else if (className.equals(WikiPage.class.getName())) { WikiPage wikiPage = WikiPageLocalServiceUtil.getPage(classPK); portletURL = PortletURLFactoryUtil.create( request, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); portletURL.setParameter("struts_action", "/wiki/view"); portletURL.setParameter("nodeId", String.valueOf(wikiPage.getNodeId())); portletURL.setParameter("title", wikiPage.getTitle()); } String currentURL = PortalUtil.getCurrentURL(request); if (portletURL == null) { return currentURL; } portletURL.setWindowState(WindowState.MAXIMIZED); portletURL.setPortletMode(PortletMode.VIEW); portletURL.setParameter("returnToFullPageURL", currentURL); return portletURL.toString(); }
@Override protected void addSubscriptionBaseModel(long baseModelId) throws Exception { WikiPage page = WikiPageLocalServiceUtil.getPage(baseModelId); WikiPageLocalServiceUtil.subscribePage(user.getUserId(), page.getNodeId(), page.getTitle()); }