Package org.opencms.ade.configuration
Class CmsADEConfigCacheState
java.lang.Object
org.opencms.ade.configuration.CmsADEConfigCacheState
An immutable object which represents the complete ADE configuration (sitemap and module configurations)
at a certain instant in time.
-
Constructor Summary
ConstructorDescriptionCmsADEConfigCacheState
(CmsObject cms, Map<CmsUUID, CmsADEConfigDataInternal> siteConfigurations, List<CmsADEConfigDataInternal> moduleConfigs, Map<CmsUUID, CmsElementView> elementViews, Map<CmsUUID, CmsSitePlugin> sitePlugins, Map<CmsUUID, CmsSitemapAttributeEditorConfiguration> attributeEditorConfigurations) Creates a new configuration cache state. -
Method Summary
Modifier and TypeMethodDescriptionComputes the map from folder paths to content types for this ADE configuration state.createUpdatedCopy
(Map<CmsUUID, CmsADEConfigDataInternal> sitemapUpdates, List<CmsADEConfigDataInternal> moduleUpdates, Map<CmsUUID, CmsElementView> elementViewUpdates, Map<CmsUUID, CmsSitePlugin> sitePluginUpdates, Map<CmsUUID, CmsSitemapAttributeEditorConfiguration> attributeEditorConfigurations) Creates a new object which represents the changed configuration state given some updates, without changing the current configuration state (this object instance).static CmsADEConfigCacheState
emptyState
(CmsObject cms) Creates an empty ADE configuration cache state.protected List<CmsDetailPageInfo>
Gets all detail page info beans which are defined anywhere in the configuration.Gets the sitemap attribute editor configuration with the given id (or null, if there isn't one).protected CmsObject
getCms()
Gets the CMS context used for VFS operations.Gets the set of content types configured anywhere in sitemap configurations.Gets the detail page information for everything.getDetailPages
(String type) Gets all the detail pages for a given type.Gets the set of type names for which detail pages are configured in any sitemap configuration.Returns the element views.Gets the map of folder types.protected CmsADEConfigData
Gets the merged module configuration.getParentFolderType
(String rootPath) Helper method to retrieve the parent folder type ornull
if none available.Gets the raw detail page information, with no existence checks or path corrections.protected CmsADEConfigDataInternal
getSiteConfigData
(String path) Helper method for getting the best matching sitemap configuration object for a given root path, ignoring the module configuration.getSiteConfigPaths
(String path) Finds the paths of sitemap configuration base paths above a given path.Returns the root paths to all configured sites and sub sites.The map of site plugins, by structure id.Gets subsites to be included in the site selector.protected boolean
isDetailPage
(CmsObject cms, CmsResource resource) Checks whether the given resource is configured as a detail page.lookupConfiguration
(String rootPath) Looks up the sitemap configuration for a root path.protected CmsADEConfigDataInternal
mergeConfigurations
(List<CmsADEConfigDataInternal> configurations) Merges a list of multiple configuration objects into a single configuration object.
-
Constructor Details
-
CmsADEConfigCacheState
public CmsADEConfigCacheState(CmsObject cms, Map<CmsUUID, CmsADEConfigDataInternal> siteConfigurations, List<CmsADEConfigDataInternal> moduleConfigs, Map<CmsUUID, CmsElementView> elementViews, Map<CmsUUID, CmsSitePlugin> sitePlugins, Map<CmsUUID, CmsSitemapAttributeEditorConfiguration> attributeEditorConfigurations) Creates a new configuration cache state.- Parameters:
cms
- the CMS context to usesiteConfigurations
- the map of sitemap configuration beans by structure idmoduleConfigs
- the complete list of module configurationselementViews
- the available element viewssitePlugins
- the map of sitemap pluginsattributeEditorConfigurations
- the attribute editor configurations
-
-
Method Details
-
emptyState
Creates an empty ADE configuration cache state.- Parameters:
cms
- the CMS context- Returns:
- the empty configuration cache state
-
computeFolderTypes
Computes the map from folder paths to content types for this ADE configuration state.- Returns:
- the map of content types by folder root paths
- Throws:
CmsException
- if something goes wrong
-
createUpdatedCopy
public CmsADEConfigCacheState createUpdatedCopy(Map<CmsUUID, CmsADEConfigDataInternal> sitemapUpdates, List<CmsADEConfigDataInternal> moduleUpdates, Map<CmsUUID, CmsElementView> elementViewUpdates, Map<CmsUUID, CmsSitePlugin> sitePluginUpdates, Map<CmsUUID, CmsSitemapAttributeEditorConfiguration> attributeEditorConfigurations) Creates a new object which represents the changed configuration state given some updates, without changing the current configuration state (this object instance).- Parameters:
sitemapUpdates
- a map containing changed sitemap configurations indexed by structure id (the map values are null if the corresponding sitemap configuration is not valid or could not be found)moduleUpdates
- the list of *all* module configurations, or null if no module configuration update is neededelementViewUpdates
- the updated element views, or null if no update neededsitePluginUpdates
- the new map of site plugins, or null if no update neededattributeEditorConfigurations
- the sitemap attribute editor configurations- Returns:
- the new configuration state
-
getAttributeEditorConfiguration
Gets the sitemap attribute editor configuration with the given id (or null, if there isn't one).- Parameters:
id
- the structure id of an attribute editor configuration- Returns:
- the attribute editor configuration for the id
-
getContentTypes
Gets the set of content types configured anywhere in sitemap configurations.- Returns:
- the set of content types
-
getDetailInfosForSubsites
Gets the detail page information for everything.- Parameters:
cms
- the current CMS context- Returns:
- the list containing all detail information
-
getDetailPageTypes
Gets the set of type names for which detail pages are configured in any sitemap configuration.- Returns:
- the set of type names with configured detail pages
-
getElementViews
Returns the element views.- Returns:
- the element views
-
getFolderTypes
Gets the map of folder types.- Returns:
- the map of folder types
-
getParentFolderType
Helper method to retrieve the parent folder type ornull
if none available.- Parameters:
rootPath
- the path of a resource- Returns:
- the parent folder content type
-
getRawDetailPages
Gets the raw detail page information, with no existence checks or path corrections.- Returns:
- the detail page information
-
getSiteConfigurationPaths
Returns the root paths to all configured sites and sub sites.- Returns:
- the root paths to all configured sites and sub sites
-
getSitePlugins
The map of site plugins, by structure id.- Returns:
- the map of site plugins
-
getSubsitesForSiteSelector
Gets subsites to be included in the site selector.- Returns:
- the list of root paths of subsites that should be included in the site selector
-
lookupConfiguration
Looks up the sitemap configuration for a root path.- Parameters:
rootPath
- the root path for which to look up the configuration- Returns:
- the sitemap configuration for the given root path
-
getAllDetailPages
Gets all detail page info beans which are defined anywhere in the configuration.- Returns:
- the list of detail page info beans
-
getCms
Gets the CMS context used for VFS operations.- Returns:
- the CMS context used for VFS operations
-
getDetailPages
Gets all the detail pages for a given type.- Parameters:
type
- the name of the type- Returns:
- the detail pages for that type
-
getModuleConfiguration
Gets the merged module configuration.- Returns:
- the merged module configuration instance
-
getSiteConfigData
Helper method for getting the best matching sitemap configuration object for a given root path, ignoring the module configuration.For example, if there are configurations available for the paths /a, /a/b/c, /a/b/x and /a/b/c/d/e, then the method will return the configuration object for /a/b/c when passed the path /a/b/c/d. If no configuration data is found for the path, null will be returned.
- Parameters:
path
- a root path- Returns:
- the configuration data for the given path, or null if none was found
-
getSiteConfigPaths
Finds the paths of sitemap configuration base paths above a given path.- Parameters:
path
- the path for which to find the base paths of all valid sitemap configurations- Returns:
- the list of base paths
-
isDetailPage
Checks whether the given resource is configured as a detail page.- Parameters:
cms
- the current CMS contextresource
- the resource to test- Returns:
- true if the resource is configured as a detail page
-
mergeConfigurations
protected CmsADEConfigDataInternal mergeConfigurations(List<CmsADEConfigDataInternal> configurations) Merges a list of multiple configuration objects into a single configuration object.- Parameters:
configurations
- the list of configuration objects.- Returns:
- the merged configuration object
-