Class CmsADEManager
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static enumJSON property name constant.protected static enumA status enum for the initialization status.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final StringUser additional info key constant.protected static final StringUser additional info key constant.protected static final StringUser additional info key constant.static final StringThe client id separator.static final StringThe configuration file name.static final StringThe name of the sitemap configuration file type.static final StringThe path for sitemap configuration files relative from the base path.static final StringThe name of the sitemap configuration file type.static final StringThe content folder name.static final StringThe default detail page type name.static final intDefault favorite/recent list size constant.static final StringThe name of the element view configuration file type.static final StringThe name of the module configuration file type.static final StringThe aADE configuration module name.static final StringNode name for the nav level link value.static final StringNode name for the nav level type value.static final StringThe path to the sitemap editor JSP.
- 
Constructor SummaryConstructorsConstructorDescriptionCmsADEManager(CmsObject adminCms, CmsMemoryMonitor memoryMonitor, CmsSystemConfiguration systemConfiguration) Creates a new ADE manager.
- 
Method SummaryModifier and TypeMethodDescriptionaddFormatterCacheWaitHandle(boolean online) Adds a wait handle for the next cache update to a formatter configuration.voidAdds a sitemap extra info provider.booleanChecks if the sitemap config can be edited by the user in the given CMS context.protected CmsContainerElementBeanelementFromJson(JSONObject data) Creates an element from its serialized data.protected JSONObjectelementToJson(CmsContainerElementBean element, Set<String> excludeSettings) Converts the given element to JSON.findEntryPoint(CmsObject cms, String openPath) Finds the entry point to a sitemap.voidFlushes inheritance group changes so the cache is updated.Gets the complete list of beans for the currently configured detail pages.getCache()Gets the containerpage cache instance.protected org.opencms.ade.configuration.CmsConfigurationCachegetCache(boolean online) Gets the configuration cache instance.getCachedFormatters(boolean online) Gets the cached formatter beans.getCacheState(boolean online) Gets the current ADE configuration cache state.Gets the configuration file type.Returns the names of the bundles configured as workplace bundles in any module configuration.getContentTypeNames(boolean online) Gets the content types configured in any sitemap configuations.getCurrentElement(javax.servlet.ServletRequest req) Reads the current element bean from the request.getDetailIdCache(boolean online) Gets the detail id cache for the Online or Offline projects.getDetailInfo(CmsObject cms) Gets the detail page information for everything.getDetailPage(CmsObject cms, String pageRootPath, String originPath) Gets the detail page for a content element.getDetailPage(CmsObject cms, String rootPath, String linkSource, String targetDetailPage) Gets the detail page for a content element.Gets the detail page finder.getDetailPages(CmsObject cms, String type) Returns the main detail pages for a type in all of the VFS tree.Gets the set of types for which detail pages are defined.getElementSettings(CmsObject cms, CmsResource resource) Returns the element settings for a given resource.getElementViews(CmsObject cms) Returns the available element views.Gets the element view configuration resource type.getFavoriteList(CmsObject cms) Returns the favorite list, or creates it if not available.getFormatterSettings(CmsObject cms, CmsADEConfigData config, I_CmsFormatterBean mainFormatter, CmsResource res, Locale locale, javax.servlet.ServletRequest req) Returns the settings configured for the given formatter which should be editable via ADE.getInheritedContainerState(CmsObject cms, String rootPath, String name) Returns the inheritance state for the given inheritance name and root path.getInheritedContainerState(CmsObject cms, CmsResource resource, String name) Returns the inheritance state for the given inheritance name and resource.intGets the maximum sitemap depth.Gets the module configuration resource type.getNestedFormatters(CmsObject cms, CmsADEConfigData config, CmsResource res, Locale locale, javax.servlet.ServletRequest req) Returns the nested formatters of the given resource.protected org.opencms.ade.configuration.CmsConfigurationCacheGets the offline cache.getOfflineElementUses(CmsResource resource) Creates a stream that produces the pages/groups referencing a given element.protected org.opencms.ade.configuration.CmsConfigurationCacheGets the online cache.getParameters(CmsObject cms) Gets ADE parameters.getParentFolderType(boolean online, String rootPath) Gets the content element type for the given path's parent folder.getPermissionInfo(CmsObject cms, CmsResource resource, String contextPath) Returns the permission info for the given resource.getPluginsForPath(CmsObject cms, String path) Gets a map of plugin wrappers for the given site path.Gets the raw configured detail page information, with no existence checks or path correction.getRecentList(CmsObject cms) Returns the favorite list, or creates it if not available.protected CmsRoleGets the role necessary to edit sitemap configuration files.protected StringgetRootPath(CmsUUID structureId, boolean online) Gets the root path for a given resource structure id.getSitemapAttributeValuesByPath(CmsObject cms, String attribute) Gets a map of sitemap attribute values by sitemap path for a given attribute key.Gets the sitemap configuration resource type.Gets the registered sitemap extra info providers.getSubSitePaths(CmsObject cms, String subSiteRoot) Returns all sub sites below the given path.getSubSiteRoot(CmsObject cms, String rootPath) Tries to get the subsite root for a given resource root path.getSubsitesForSiteSelector(boolean online) Gets the subsites to be displayed in the site selector.protected CmsProjectGets a tempfile project, creating one if it doesn't exist already.Gets the table of upload warnings.voidhandleHtmlRedirect(CmsObject userCms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String htmlRedirect) Processes a HTML redirect content.voidInitializes the configuration by reading all configuration files and caching their data.protected CmsADEConfigDatainternalLookupConfiguration(CmsObject cms, String rootPath) Internal configuration lookup method.booleanisDetailPage(CmsObject cms, CmsResource resource) Checks whether the given resource is configured as a detail page.booleanisEditorRestricted(CmsObject cms, CmsResource res) Checks if the user should be prevented from editing a file.booleanisElementReused(CmsResource resource, Predicate<CmsResource> exclude) Checks if an element is reused in a page or group that is not excluded by a given predicate.booleanChecks whether the ADE manager is initialized (this should usually be the case except during the setup).booleanReturns the show editor help flag.lookupConfiguration(CmsObject cms, String rootPath) Looks up the configuration data for a given sitemap path.lookupConfigurationWithCache(CmsObject cms, String rootPath) Looks up the configuration data for a given sitemap path, but uses a thread-local cache for the current request for efficiency.voidrefresh()Reloads the configuration.voidbooleansaveDetailPages(CmsObject cms, String rootPath, List<CmsDetailPageInfo> detailPages, CmsUUID newId) Saves a list of detail pages.voidsaveFavoriteList(CmsObject cms, List<CmsContainerElementBean> favoriteList) Saves the favorite list, user based.voidsaveInheritedContainer(CmsObject cms, String sitePath, String name, boolean newOrder, List<CmsContainerElementBean> elements) Saves the inheritance container information.voidsaveInheritedContainer(CmsObject cms, CmsResource pageResource, String name, boolean newOrder, List<CmsContainerElementBean> elements) Saves the inheritance container information.voidsaveRecentList(CmsObject cms, List<CmsContainerElementBean> recentList) Saves the favorite list, user based.voidsetShowEditorHelp(CmsObject cms, boolean showHelp) Sets the show editor help flag.voidshutdown()The method which is called when the OpenCms instance is shut down.voidwaitForCacheUpdate(boolean online) Waits until the next time the cache is updated.voidwaitForFormatterCache(boolean online) Waits until the formatter cache has finished updating itself.
- 
Field Details- 
CLIENT_ID_SEPERATORThe client id separator.- See Also:
 
- 
CONFIG_FILE_NAMEThe configuration file name.- See Also:
 
- 
CONFIG_FOLDER_TYPEThe name of the sitemap configuration file type.- See Also:
 
- 
CONFIG_SUFFIXThe path for sitemap configuration files relative from the base path.- See Also:
 
- 
CONFIG_TYPEThe name of the sitemap configuration file type.- See Also:
 
- 
CONTENT_FOLDER_NAMEThe content folder name.- See Also:
 
- 
DEFAULT_DETAILPAGE_TYPEThe default detail page type name.- See Also:
 
- 
DEFAULT_ELEMENT_LIST_SIZEDefault favorite/recent list size constant.- See Also:
 
- 
ELEMENT_VIEW_TYPEThe name of the element view configuration file type.- See Also:
 
- 
MODULE_CONFIG_TYPEThe name of the module configuration file type.- See Also:
 
- 
MODULE_NAME_ADE_CONFIGThe aADE configuration module name.- See Also:
 
- 
N_LINKNode name for the nav level link value.- See Also:
 
- 
N_TYPENode name for the nav level type value.- See Also:
 
- 
PATH_SITEMAP_EDITOR_JSPThe path to the sitemap editor JSP.- See Also:
 
- 
ADDINFO_ADE_FAVORITE_LISTUser additional info key constant.- See Also:
 
- 
ADDINFO_ADE_RECENT_LISTUser additional info key constant.- See Also:
 
- 
ADDINFO_ADE_SHOW_EDITOR_HELPUser additional info key constant.- See Also:
 
 
- 
- 
Constructor Details- 
CmsADEManagerpublic CmsADEManager(CmsObject adminCms, CmsMemoryMonitor memoryMonitor, CmsSystemConfiguration systemConfiguration) Creates a new ADE manager.- Parameters:
- adminCms- a CMS context with admin privileges
- memoryMonitor- the memory monitor instance
- systemConfiguration- the system configuration
 
 
- 
- 
Method Details- 
addFormatterCacheWaitHandleAdds a wait handle for the next cache update to a formatter configuration.- Parameters:
- online- true if we want to add a wait handle to the online cache, else the offline cache
- Returns:
- the wait handle that has been added
 
- 
addSitemapExtraInfoProviderAdds a sitemap extra info provider.- Parameters:
- provider- the provider to add
 
- 
canEditSitemapConfigurationChecks if the sitemap config can be edited by the user in the given CMS context.Note: Even if this returns true, there may be other reasons preventing the sitemap configuration from being edited by the user. - Parameters:
- cms- the CMS context to check
- Returns:
- false if the user should not be able to edit the sitemap configuration
 
- 
findEntryPointFinds the entry point to a sitemap.- Parameters:
- cms- the CMS context
- openPath- the resource path to find the sitemap to
- Returns:
- the sitemap entry point
 
- 
flushInheritanceGroupChangesFlushes inheritance group changes so the cache is updated.This is useful for test cases. 
- 
getAllDetailPagesGets the complete list of beans for the currently configured detail pages.- Parameters:
- cms- the CMS context to use
- Returns:
- the list of detail page infos
 
- 
getCacheGets the containerpage cache instance.- Returns:
- the containerpage cache instance
 
- 
getCachedFormattersGets the cached formatter beans.- Parameters:
- online- true if the Online project formatters should be returned, false for the Offline formatters
- Returns:
- the formatter configuration cache state
 
- 
getCacheStateGets the current ADE configuration cache state.- Parameters:
- online- true if you want the online state, false for the offline state
- Returns:
- the configuration cache state
 
- 
getConfigurationTypeGets the configuration file type.- Returns:
- the configuration file type
 
- 
getConfiguredWorkplaceBundlesReturns the names of the bundles configured as workplace bundles in any module configuration.- Returns:
- the names of the bundles configured as workplace bundles in any module configuration.
 
- 
getContentTypeNamesGets the content types configured in any sitemap configuations.- Parameters:
- online- true if the types for the Online project should be fetched
- Returns:
- the set of content types
 
- 
getCurrentElementpublic CmsContainerElementBean getCurrentElement(javax.servlet.ServletRequest req) throws CmsException Reads the current element bean from the request.- Parameters:
- req- the servlet request
- Returns:
- the element bean
- Throws:
- CmsException- if no current element is set
 
- 
getDetailIdCacheGets the detail id cache for the Online or Offline projects.- Parameters:
- online- if true, gets the Online project detail id
- Returns:
- the detail name cache
 
- 
getDetailInfoGets the detail page information for everything.- Parameters:
- cms- the current CMS context
- Returns:
- the list with all the detail page information
 
- 
getDetailPageGets the detail page for a content element.- Parameters:
- cms- the CMS context
- pageRootPath- the element's root path
- originPath- the path in which the the detail page is being requested
- Returns:
- the detail page for the content element
 
- 
getDetailPagepublic String getDetailPage(CmsObject cms, String rootPath, String linkSource, String targetDetailPage) Gets the detail page for a content element.- Parameters:
- cms- the CMS context
- rootPath- the element's root path
- linkSource- the path in which the the detail page is being requested
- targetDetailPage- the target detail page to use
- Returns:
- the detail page for the content element
 
- 
getDetailPageHandlerGets the detail page finder.- Returns:
- the detail page finder
 
- 
getDetailPagesReturns the main detail pages for a type in all of the VFS tree.- Parameters:
- cms- the current CMS context
- type- the resource type name
- Returns:
- a list of detail page root paths
 
- 
getDetailPageTypesGets the set of types for which detail pages are defined.- Parameters:
- cms- the current CMS context
- Returns:
- the set of types for which detail pages are defined
 
- 
getElementSettingspublic Map<String,CmsXmlContentProperty> getElementSettings(CmsObject cms, CmsResource resource) throws CmsException Returns the element settings for a given resource.- Parameters:
- cms- the current cms context
- resource- the resource
- Returns:
- the element settings for a given resource
- Throws:
- CmsException- if something goes wrong
 
- 
getElementViewsReturns the available element views.- Parameters:
- cms- the cms context
- Returns:
- the element views
 
- 
getElementViewTypeGets the element view configuration resource type.- Returns:
- the element view configuration resource type
 
- 
getFavoriteListReturns the favorite list, or creates it if not available.- Parameters:
- cms- the cms context
- Returns:
- the favorite list
- Throws:
- CmsException- if something goes wrong
 
- 
getFormatterSettingspublic Map<String,CmsXmlContentProperty> getFormatterSettings(CmsObject cms, CmsADEConfigData config, I_CmsFormatterBean mainFormatter, CmsResource res, Locale locale, javax.servlet.ServletRequest req) Returns the settings configured for the given formatter which should be editable via ADE.- Parameters:
- cms- the cms context
- config- the sitemap configuration
- mainFormatter- the formatter
- res- the element resource
- locale- the content locale
- req- the current request, if available
- Returns:
- the settings configured for the given formatter
 
- 
getInheritedContainerStatepublic CmsInheritedContainerState getInheritedContainerState(CmsObject cms, CmsResource resource, String name) Returns the inheritance state for the given inheritance name and resource.- Parameters:
- cms- the current cms context
- resource- the resource
- name- the inheritance name
- Returns:
- the inheritance state
 
- 
getInheritedContainerStatepublic CmsInheritedContainerState getInheritedContainerState(CmsObject cms, String rootPath, String name) throws CmsException Returns the inheritance state for the given inheritance name and root path.- Parameters:
- cms- the current cms context
- rootPath- the root path
- name- the inheritance name
- Returns:
- the inheritance state
- Throws:
- CmsException- if something goes wrong
 
- 
getMaxSitemapDepthGets the maximum sitemap depth.- Returns:
- the maximum sitemap depth
 
- 
getModuleConfigurationTypeGets the module configuration resource type.- Returns:
- the module configuration resource type
 
- 
getNestedFormatterspublic List<I_CmsFormatterBean> getNestedFormatters(CmsObject cms, CmsADEConfigData config, CmsResource res, Locale locale, javax.servlet.ServletRequest req) Returns the nested formatters of the given resource.- Parameters:
- cms- the cms context
- config- the sitemap configuration
- res- the resource
- locale- the content locale
- req- the request, if available
- Returns:
- the nested formatters
 
- 
getOfflineElementUsesCreates a stream that produces the pages/groups referencing a given element.Note that this method doesn't take a CmsObject and just generates all resources referencing the element regardless of whether the current user can read them. So readResource calls for the ids of these resources may fail. - Parameters:
- resource- the element resource
- Returns:
- the stream of resources which use the element
 
- 
getParametersGets ADE parameters.- Parameters:
- cms- the current CMS context
- Returns:
- the ADE parameters for the current user
 
- 
getParentFolderTypeGets the content element type for the given path's parent folder.- Parameters:
- online- true if we want to use the Online project's configuration
- rootPath- the root path of a content
- Returns:
- the parent folder type name, or null if none is defined
 
- 
getPermissionInfopublic CmsPermissionInfo getPermissionInfo(CmsObject cms, CmsResource resource, String contextPath) throws CmsException Returns the permission info for the given resource.- Parameters:
- cms- the cms context
- resource- the resource
- contextPath- the context path
- Returns:
- the permission info
- Throws:
- CmsException- if checking the permissions fails
 
- 
getPluginsForPathGets a map of plugin wrappers for the given site path.This *only* includes plugins defined in site plugins active on the given path, not those referenced in formatters. - Parameters:
- cms- the CMS context
- path- the path for which to get the plugins
- Returns:
- the map of plugin wrappers, with the plugin groups as keys
 
- 
getRawDetailPagesGets the raw configured detail page information, with no existence checks or path correction.- Parameters:
- cms- the CMS context
- Returns:
- the list of raw detail page info beans
 
- 
getRecentListReturns the favorite list, or creates it if not available.- Parameters:
- cms- the cms context
- Returns:
- the favorite list
- Throws:
- CmsException- if something goes wrong
 
- 
getSitemapAttributeValuesByPathGets a map of sitemap attribute values by sitemap path for a given attribute key.- Parameters:
- cms- the current CMS context
- attribute- the sitemap attribute key
- Returns:
- the map of attribute values, with the root paths of the corresponding subsitemaps as keys
 
- 
getSitemapConfigurationTypeGets the sitemap configuration resource type.- Returns:
- the resource type for sitemap configurations
 
- 
getSitemapExtraInfoProvidersGets the registered sitemap extra info providers.- Returns:
- the list of providers
 
- 
getSubSitePathsReturns all sub sites below the given path.- Parameters:
- cms- the cms context
- subSiteRoot- the sub site root path
- Returns:
- the sub site root paths
 
- 
getSubSiteRootTries to get the subsite root for a given resource root path.- Parameters:
- cms- the current CMS context
- rootPath- the root path for which the subsite root should be found
- Returns:
- the subsite root
 
- 
getSubsitesForSiteSelectorGets the subsites to be displayed in the site selector.- Parameters:
- online- true if we want the subsites for the Online project
- Returns:
- the subsites to be displayed in the site selector
 
- 
getUploadWarningTableGets the table of upload warnings.- Returns:
- the table of upload warnings
 
- 
handleHtmlRedirectpublic void handleHtmlRedirect(CmsObject userCms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String htmlRedirect) throws CmsException Processes a HTML redirect content.This needs to be in the ADE manager because the user for whom the HTML redirect is being loaded does not necessarily have read permissions for the redirect target, so we read the redirect target with admin privileges. - Parameters:
- userCms- the CMS context of the current user
- request- the servlet request
- response- the servlet response
- htmlRedirect- the path of the HTML redirect resource
- Throws:
- CmsException- if something goes wrong
 
- 
initializeInitializes the configuration by reading all configuration files and caching their data.
- 
isDetailPageChecks whether the given resource is configured as a detail page.- Parameters:
- cms- the current CMS context
- resource- the resource which should be tested
- Returns:
- true if the resource is configured as a detail page
 
- 
isEditorRestrictedChecks if the user should be prevented from editing a file.This is not a permission check, but an additional mechanism to prevent users from editing configuration files even if they technically need or have write permissions for these files. - Parameters:
- cms- the CMS context
- res- the resource to check
- Returns:
- true if the user should be prevented from editing the file
 
- 
isElementReusedChecks if an element is reused in a page or group that is not excluded by a given predicate.- Parameters:
- resource- the resource to check
- exclude- predicate used to ignore reuses which match it
- Returns:
- true if the element is reused
 
- 
isInitializedChecks whether the ADE manager is initialized (this should usually be the case except during the setup).- Returns:
- true if the ADE manager is initialized
 
- 
isShowEditorHelpReturns the show editor help flag.- Parameters:
- cms- the cms context
- Returns:
- the show editor help flag
 
- 
lookupConfigurationLooks up the configuration data for a given sitemap path.- Parameters:
- cms- the current CMS context
- rootPath- the root path for which the configuration data should be looked up
- Returns:
- the configuration data
 
- 
lookupConfigurationWithCacheLooks up the configuration data for a given sitemap path, but uses a thread-local cache for the current request for efficiency.- Parameters:
- cms- the current CMS context
- rootPath- the root path for which the configuration data should be looked up
- Returns:
- the configuration data
 
- 
refreshReloads the configuration.Normally you shouldn't call this directly since the event handlers take care of updating the configuration. 
- 
removeSitemapExtraInfoProvider
- 
saveDetailPagespublic boolean saveDetailPages(CmsObject cms, String rootPath, List<CmsDetailPageInfo> detailPages, CmsUUID newId) throws CmsException Saves a list of detail pages.- Parameters:
- cms- the cms context
- rootPath- the root path
- detailPages- the detail pages
- newId- the id to use for new detail pages without an id
- Returns:
- true if the detail pages could be successfully saved
- Throws:
- CmsException- if something goes wrong
 
- 
saveFavoriteListpublic void saveFavoriteList(CmsObject cms, List<CmsContainerElementBean> favoriteList) throws CmsException Saves the favorite list, user based.- Parameters:
- cms- the cms context
- favoriteList- the element list
- Throws:
- CmsException- if something goes wrong
 
- 
saveInheritedContainerpublic void saveInheritedContainer(CmsObject cms, CmsResource pageResource, String name, boolean newOrder, List<CmsContainerElementBean> elements) throws CmsException Saves the inheritance container information.- Parameters:
- cms- the current cms context
- pageResource- the resource or parent folder
- name- the inheritance name
- newOrder- if the element have been reordered
- elements- the elements
- Throws:
- CmsException- if something goes wrong
 
- 
saveInheritedContainerpublic void saveInheritedContainer(CmsObject cms, String sitePath, String name, boolean newOrder, List<CmsContainerElementBean> elements) throws CmsException Saves the inheritance container information.- Parameters:
- cms- the current cms context
- sitePath- the site path of the resource or parent folder
- name- the inheritance name
- newOrder- if the element have been reordered
- elements- the elements
- Throws:
- CmsException- if something goes wrong
 
- 
saveRecentListpublic void saveRecentList(CmsObject cms, List<CmsContainerElementBean> recentList) throws CmsException Saves the favorite list, user based.- Parameters:
- cms- the cms context
- recentList- the element list
- Throws:
- CmsException- if something goes wrong
 
- 
setShowEditorHelpSets the show editor help flag.- Parameters:
- cms- the cms context
- showHelp- the show help flag
- Throws:
- CmsException- if writing the user info fails
 
- 
shutdownThe method which is called when the OpenCms instance is shut down.
- 
waitForCacheUpdateWaits until the next time the cache is updated.- Parameters:
- online- true if we want to wait for the online cache, false for the offline cache
 
- 
waitForFormatterCacheWaits until the formatter cache has finished updating itself.This method is only intended for use in test cases. - Parameters:
- online- true if we should wait for the online formatter cache,false for the offline cache
 
- 
elementFromJsonCreates an element from its serialized data.- Parameters:
- data- the serialized data
- Returns:
- the restored element bean
- Throws:
- JSONException- if the serialized data got corrupted
 
- 
elementToJsonConverts the given element to JSON.- Parameters:
- element- the element to convert
- excludeSettings- the keys of settings which should not be written to the JSON
- Returns:
- the JSON representation
 
- 
getCacheGets the configuration cache instance.- Parameters:
- online- true if you want the online cache, false for the offline cache
- Returns:
- the ADE configuration cache instance
 
- 
getOfflineCacheGets the offline cache.- Returns:
- the offline configuration cache
 
- 
getOnlineCacheGets the online cache.- Returns:
- the online configuration cache
 
- 
getRoleForSitemapConfigEditingGets the role necessary to edit sitemap configuration files.- Returns:
- the role needed for editing sitemap configurations
 
- 
getRootPathGets the root path for a given resource structure id.- Parameters:
- structureId- the structure id
- online- if true, the resource will be looked up in the online project ,else in the offline project
- Returns:
- the root path for the given structure id
- Throws:
- CmsException- if something goes wrong
 
- 
getTempfileProjectGets a tempfile project, creating one if it doesn't exist already.- Parameters:
- cms- the CMS context to use
- Returns:
- the tempfile project
- Throws:
- CmsException- if something goes wrong
 
- 
internalLookupConfigurationInternal configuration lookup method.- Parameters:
- cms- the cms context
- rootPath- the root path for which to look up the configuration
- Returns:
- the configuration for the given path
 
 
-