List of usage examples for com.liferay.portal.kernel.module.configuration ConfigurationProviderUtil getConfiguration
public static <T> T getConfiguration(Class<T> clazz, SettingsLocator settingsLocator) throws ConfigurationException
From source file:com.liferay.bookmarks.web.internal.portlet.toolbar.contributor.BookmarksPortletToolbarContributor.java
License:Open Source License
private BookmarksFolder _getFolder(ThemeDisplay themeDisplay, PortletRequest portletRequest) { BookmarksFolder folder = (BookmarksFolder) portletRequest.getAttribute(BookmarksWebKeys.BOOKMARKS_FOLDER); if (folder != null) { return folder; }// w w w .j a v a 2 s . c o m long rootFolderId = BookmarksFolderConstants.DEFAULT_PARENT_FOLDER_ID; try { BookmarksGroupServiceOverriddenConfiguration bookmarksGroupServiceOverriddenConfiguration = ConfigurationProviderUtil .getConfiguration(BookmarksGroupServiceOverriddenConfiguration.class, new GroupServiceSettingsLocator(themeDisplay.getScopeGroupId(), BookmarksConstants.SERVICE_NAME)); rootFolderId = bookmarksGroupServiceOverriddenConfiguration.rootFolderId(); } catch (ConfigurationException ce) { _log.error("Unable to obtain bookmarks root folder ID for group " + themeDisplay.getScopeGroupId()); } long folderId = BeanParamUtil.getLong(folder, portletRequest, "folderId", rootFolderId); if (folderId != BookmarksFolderConstants.DEFAULT_PARENT_FOLDER_ID) { try { folder = _bookmarksFolderService.getFolder(folderId); } catch (NoSuchFolderException nsfe) { folder = null; } catch (PortalException pe) { _log.error(pe, pe); } } return folder; }
From source file:com.liferay.dynamic.data.mapping.web.internal.context.util.DDMWebRequestHelper.java
License:Open Source License
protected <T> T getConfiguration(Class<T> clazz) throws ConfigurationException { if (Validator.isNotNull(getPortletResource())) { HttpServletRequest request = getRequest(); return (T) ConfigurationProviderUtil.getConfiguration(clazz, new ParameterMapSettingsLocator(request.getParameterMap(), new GroupServiceSettingsLocator(getSiteGroupId(), DDMConstants.SERVICE_NAME))); } else {/*from w w w . j av a 2s .c om*/ return (T) ConfigurationProviderUtil.getConfiguration(clazz, new GroupServiceSettingsLocator(getSiteGroupId(), DDMConstants.SERVICE_NAME)); } }
From source file:com.liferay.journal.web.internal.display.context.util.JournalWebRequestHelper.java
License:Open Source License
public JournalGroupServiceConfiguration getJournalGroupServiceConfiguration() { try {//from w w w. j a va2 s . co m if (_journalGroupServiceConfiguration == null) { ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); if (Validator.isNotNull(portletDisplay.getPortletResource())) { _journalGroupServiceConfiguration = ConfigurationProviderUtil.getConfiguration( JournalGroupServiceConfiguration.class, new ParameterMapSettingsLocator(_request.getParameterMap(), new GroupServiceSettingsLocator(themeDisplay.getSiteGroupId(), JournalConstants.SERVICE_NAME))); } else { _journalGroupServiceConfiguration = ConfigurationProviderUtil.getConfiguration( JournalGroupServiceConfiguration.class, new GroupServiceSettingsLocator( themeDisplay.getSiteGroupId(), JournalConstants.SERVICE_NAME)); } } return _journalGroupServiceConfiguration; } catch (PortalException pe) { throw new SystemException(pe); } }
From source file:com.liferay.wiki.asset.WikiPageAssetRenderer.java
License:Open Source License
public WikiPageAssetRenderer(WikiPage page, WikiEngineRenderer wikiEngineRenderer) throws PortalException { _page = page;//from w ww . jav a 2 s . c o m _wikiEngineRenderer = wikiEngineRenderer; _wikiGroupServiceOverriddenConfiguration = ConfigurationProviderUtil.getConfiguration( WikiGroupServiceOverriddenConfiguration.class, new GroupServiceSettingsLocator(page.getGroupId(), WikiConstants.SERVICE_NAME)); }
From source file:com.liferay.wiki.web.internal.asset.WikiPageAssetRenderer.java
License:Open Source License
@Override public String getDiscussionPath() { if (_wikiGroupServiceOverriddenConfiguration == null) { try {/*from www . ja va 2 s . c om*/ _wikiGroupServiceOverriddenConfiguration = ConfigurationProviderUtil.getConfiguration( WikiGroupServiceOverriddenConfiguration.class, new GroupServiceSettingsLocator(_page.getGroupId(), WikiConstants.SERVICE_NAME)); } catch (Exception e) { _log.error(e, e); return null; } } if (_wikiGroupServiceOverriddenConfiguration.pageCommentsEnabled()) { return "edit_page_discussion"; } else { return null; } }
From source file:com.liferay.wiki.web.internal.display.context.util.WikiRequestHelper.java
License:Open Source License
public WikiGroupServiceOverriddenConfiguration getWikiGroupServiceOverriddenConfiguration() { try {//from w w w . j a v a2 s. com if (_wikiGroupServiceOverriddenConfiguration == null) { String portletResource = getPortletResource(); if (Validator.isNotNull(portletResource)) { _wikiGroupServiceOverriddenConfiguration = ConfigurationProviderUtil.getConfiguration( WikiGroupServiceOverriddenConfiguration.class, new ParameterMapSettingsLocator(getRequest().getParameterMap(), new GroupServiceSettingsLocator(getSiteGroupId(), WikiConstants.SERVICE_NAME))); } else { _wikiGroupServiceOverriddenConfiguration = ConfigurationProviderUtil.getConfiguration( WikiGroupServiceOverriddenConfiguration.class, new GroupServiceSettingsLocator(getSiteGroupId(), WikiConstants.SERVICE_NAME)); } } return _wikiGroupServiceOverriddenConfiguration; } catch (PortalException pe) { throw new SystemException(pe); } }
From source file:com.liferay.wiki.web.internal.display.context.util.WikiRequestHelper.java
License:Open Source License
public WikiPortletInstanceOverriddenConfiguration getWikiPortletInstanceOverridenConfiguration() { try {//from w w w .j a v a 2 s .c o m if (_wikiPortletInstanceOverridenConfiguration == null) { String portletResource = getPortletResource(); if (Validator.isNotNull(portletResource)) { _wikiPortletInstanceOverridenConfiguration = ConfigurationProviderUtil.getConfiguration( WikiPortletInstanceOverriddenConfiguration.class, new ParameterMapSettingsLocator(getRequest().getParameterMap(), new PortletInstanceSettingsLocator(getLayout(), getResourcePortletId()))); } else { _wikiPortletInstanceOverridenConfiguration = ConfigurationProviderUtil.getConfiguration( WikiPortletInstanceOverriddenConfiguration.class, new PortletInstanceSettingsLocator(getLayout(), getPortletId())); } } return _wikiPortletInstanceOverridenConfiguration; } catch (PortalException pe) { throw new SystemException(pe); } }
From source file:com.liferay.wiki.web.internal.portlet.action.ActionUtil.java
License:Open Source License
public static WikiNode getFirstNode(PortletRequest portletRequest) throws PortalException { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); long groupId = themeDisplay.getScopeGroupId(); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); List<WikiNode> nodes = WikiNodeLocalServiceUtil.getNodes(groupId); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); WikiPortletInstanceOverriddenConfiguration wikiPortletInstanceOverriddenConfiguration = ConfigurationProviderUtil .getConfiguration(WikiPortletInstanceOverriddenConfiguration.class, new PortletInstanceSettingsLocator(themeDisplay.getLayout(), portletDisplay.getId())); String[] visibleNodeNames = wikiPortletInstanceOverriddenConfiguration.visibleNodes(); nodes = WikiUtil.orderNodes(nodes, visibleNodeNames); String[] hiddenNodes = wikiPortletInstanceOverriddenConfiguration.hiddenNodes(); Arrays.sort(hiddenNodes);//from w w w.ja v a 2 s .c o m for (WikiNode node : nodes) { if ((Arrays.binarySearch(hiddenNodes, node.getName()) < 0) && WikiNodePermissionChecker.contains(permissionChecker, node, ActionKeys.VIEW)) { return node; } } return null; }
From source file:com.liferay.wiki.web.internal.portlet.action.EditNodeMVCActionCommand.java
License:Open Source License
protected WikiPortletInstanceOverriddenConfiguration getWikiPortletInstanceOverriddenConfiguration( ActionRequest actionRequest) throws PortalException { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); WikiPortletInstanceOverriddenConfiguration wikiPortletInstanceOverriddenConfiguration = ConfigurationProviderUtil .getConfiguration(WikiPortletInstanceOverriddenConfiguration.class, new PortletInstanceSettingsLocator(themeDisplay.getLayout(), portletDisplay.getId())); return wikiPortletInstanceOverriddenConfiguration; }
From source file:com.liferay.wiki.web.internal.portlet.toolbar.item.WikiPortletToolbarContributor.java
License:Open Source License
private WikiNode _getNode(ThemeDisplay themeDisplay, PortletRequest portletRequest) { WikiNode node = (WikiNode) portletRequest.getAttribute(WikiWebKeys.WIKI_NODE); if (node != null) { return node; }/* w w w . j av a2s .co m*/ String initialNodeName = StringPool.BLANK; try { WikiGroupServiceOverriddenConfiguration wikiGroupServiceOverriddenConfiguration = ConfigurationProviderUtil .getConfiguration(WikiGroupServiceOverriddenConfiguration.class, new GroupServiceSettingsLocator(themeDisplay.getScopeGroupId(), WikiConstants.SERVICE_NAME)); initialNodeName = wikiGroupServiceOverriddenConfiguration.initialNodeName(); } catch (ConfigurationException ce) { _log.error("Unable to get initial node name for group " + themeDisplay.getScopeGroupId()); } String name = BeanParamUtil.getString(node, portletRequest, "name", initialNodeName); if (Validator.isNotNull(name)) { try { node = _wikiNodeService.getNode(themeDisplay.getScopeGroupId(), name); } catch (NoSuchNodeException nsne) { node = null; } catch (PortalException pe) { _log.error(pe, pe); } } return node; }