List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay getScopeGroupId
public long getScopeGroupId()
From source file:com.liferay.journal.web.internal.portlet.action.ActionUtil.java
License:Open Source License
public static boolean hasArticle(ActionRequest actionRequest) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String articleId = ParamUtil.getString(actionRequest, "articleId"); if (Validator.isNull(articleId)) { String[] articleIds = StringUtil.split(ParamUtil.getString(actionRequest, "rowIds")); if (articleIds.length <= 0) { return false; }/*from ww w .ja v a2s . com*/ articleId = articleIds[0]; } int pos = articleId.lastIndexOf(JournalPortlet.VERSION_SEPARATOR); if (pos != -1) { articleId = articleId.substring(0, pos); } JournalArticle article = JournalArticleLocalServiceUtil.fetchArticle(themeDisplay.getScopeGroupId(), articleId); if (article == null) { return false; } return true; }
From source file:com.liferay.journal.web.internal.portlet.configuration.icon.FeedsPermissionsPortletConfigurationIcon.java
License:Open Source License
@Override public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) { String url = StringPool.BLANK; ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); try {/*from w w w .j a v a 2 s. c om*/ url = PermissionsURLTag.doTag(StringPool.BLANK, "com.liferay.journal", HtmlUtil.escape(themeDisplay.getScopeGroupName()), null, String.valueOf(themeDisplay.getScopeGroupId()), LiferayWindowState.POP_UP.toString(), null, themeDisplay.getRequest()); } catch (Exception e) { } return url; }
From source file:com.liferay.journal.web.internal.portlet.configuration.icon.FeedsPermissionsPortletConfigurationIcon.java
License:Open Source License
@Override public boolean isShow(PortletRequest portletRequest) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); return JournalPermission.contains(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), ActionKeys.PERMISSIONS);//from w w w . j a v a2 s.c om }
From source file:com.liferay.journal.web.internal.portlet.configuration.icon.StructuresPortletConfigurationIcon.java
License:Open Source License
@Override public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); Portlet portlet = _portletLocalService.getPortletById(portletDisplay.getId()); PortletURL portletURL = PortletURLFactoryUtil.create(portletRequest, PortletProviderUtil.getPortletId(DDMStructure.class.getName(), PortletProvider.Action.VIEW), PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/view.jsp"); portletURL.setParameter("backURL", themeDisplay.getURLCurrent()); portletURL.setParameter("groupId", String.valueOf(themeDisplay.getScopeGroupId())); portletURL.setParameter("refererPortletName", JournalPortletKeys.JOURNAL); portletURL.setParameter("refererWebDAVToken", WebDAVUtil.getStorageToken(portlet)); portletURL.setParameter("showAncestorScopes", Boolean.TRUE.toString()); portletURL.setParameter("showCacheableInput", Boolean.TRUE.toString()); portletURL.setParameter("showManageTemplates", Boolean.TRUE.toString()); return portletURL.toString(); }
From source file:com.liferay.journal.web.internal.portlet.configuration.icon.TemplatesPortletConfigurationIcon.java
License:Open Source License
@Override public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); Portlet portlet = _portletLocalService.getPortletById(portletDisplay.getId()); PortletURL portletURL = PortletURLFactoryUtil.create(portletRequest, PortletProviderUtil.getPortletId(DDMTemplate.class.getName(), PortletProvider.Action.VIEW), PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/view_template.jsp"); portletURL.setParameter("navigationStartsOn", DDMNavigationHelper.VIEW_TEMPLATES); portletURL.setParameter("backURL", themeDisplay.getURLCurrent()); portletURL.setParameter("groupId", String.valueOf(themeDisplay.getScopeGroupId())); portletURL.setParameter("classNameId", String.valueOf(_portal.getClassNameId(DDMStructure.class))); portletURL.setParameter("resourceClassNameId", String.valueOf(_portal.getClassNameId(JournalArticle.class))); portletURL.setParameter("refererPortletName", JournalPortletKeys.JOURNAL); portletURL.setParameter("refererWebDAVToken", WebDAVUtil.getStorageToken(portlet)); portletURL.setParameter("showAncestorScopes", Boolean.TRUE.toString()); portletURL.setParameter("showCacheableInput", Boolean.TRUE.toString()); portletURL.setParameter("showHeader", Boolean.TRUE.toString()); return portletURL.toString(); }
From source file:com.liferay.journal.web.internal.portlet.JournalPortlet.java
License:Open Source License
public void deleteFeeds(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long[] deleteFeedIds = null; long deleteFeedId = ParamUtil.getLong(actionRequest, "deleteFeedId"); if (deleteFeedId > 0) { deleteFeedIds = new long[] { deleteFeedId }; } else {//ww w . j a v a 2 s .c o m deleteFeedIds = ParamUtil.getLongValues(actionRequest, "rowIds"); } for (long curDeleteFeedId : deleteFeedIds) { _journalFeedService.deleteFeed(themeDisplay.getScopeGroupId(), String.valueOf(curDeleteFeedId)); } }
From source file:com.liferay.journal.web.internal.portlet.JournalPortlet.java
License:Open Source License
public void expireEntries(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long[] expireFolderIds = ParamUtil.getLongValues(actionRequest, "rowIdsJournalFolder"); ServiceContext serviceContext = ServiceContextFactory.getInstance(JournalArticle.class.getName(), actionRequest);/*from w w w. ja v a 2 s .c o m*/ for (long expireFolderId : expireFolderIds) { ActionUtil.expireFolder(themeDisplay.getScopeGroupId(), expireFolderId, serviceContext); } String[] expireArticleIds = ParamUtil.getStringValues(actionRequest, "rowIdsJournalArticle"); for (String expireArticleId : expireArticleIds) { ActionUtil.expireArticle(actionRequest, HtmlUtil.unescape(expireArticleId)); } sendEditEntryRedirect(actionRequest, actionResponse); }
From source file:com.liferay.journal.web.internal.portlet.JournalPortlet.java
License:Open Source License
public void moveEntries(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { long newFolderId = ParamUtil.getLong(actionRequest, "newFolderId"); long[] folderIds = ParamUtil.getLongValues(actionRequest, "rowIdsJournalFolder"); ServiceContext serviceContext = ServiceContextFactory.getInstance(JournalArticle.class.getName(), actionRequest);//from w ww . ja v a 2 s .c o m for (long folderId : folderIds) { _journalFolderService.moveFolder(folderId, newFolderId, serviceContext); } List<String> invalidArticleIds = new ArrayList<>(); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String[] articleIds = ParamUtil.getStringValues(actionRequest, "rowIdsJournalArticle"); for (String articleId : articleIds) { try { _journalArticleService.moveArticle(themeDisplay.getScopeGroupId(), HtmlUtil.unescape(articleId), newFolderId, serviceContext); } catch (InvalidDDMStructureException iddmse) { if (_log.isWarnEnabled()) { _log.warn(iddmse.getMessage()); } invalidArticleIds.add(articleId); } } if (!invalidArticleIds.isEmpty()) { StringBundler sb = new StringBundler(4); sb.append("Folder "); sb.append(newFolderId); sb.append(" does not allow the structures for articles: "); sb.append(StringUtil.merge(invalidArticleIds)); throw new InvalidDDMStructureException(sb.toString()); } sendEditEntryRedirect(actionRequest, actionResponse); }
From source file:com.liferay.journal.web.internal.portlet.JournalPortlet.java
License:Open Source License
public void subscribeFolder(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long folderId = ParamUtil.getLong(actionRequest, "folderId"); _journalFolderService.subscribe(themeDisplay.getScopeGroupId(), folderId); }
From source file:com.liferay.journal.web.internal.portlet.JournalPortlet.java
License:Open Source License
public void subscribeStructure(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long ddmStructureId = ParamUtil.getLong(actionRequest, "ddmStructureId"); _journalArticleService.subscribeStructure(themeDisplay.getScopeGroupId(), themeDisplay.getUserId(), ddmStructureId);/*from w w w .j a v a2 s .c o m*/ sendEditArticleRedirect(actionRequest, actionResponse); }