Package org.opencms.ade.configuration
Class CmsADEConfigCacheState
- java.lang.Object
-
- org.opencms.ade.configuration.CmsADEConfigCacheState
-
public class CmsADEConfigCacheState extends java.lang.Object
An immutable object which represents the complete ADE configuration (sitemap and module configurations) at a certain instant in time.
-
-
Constructor Summary
Constructors Constructor Description CmsADEConfigCacheState(CmsObject cms, java.util.Map<CmsUUID,CmsADEConfigDataInternal> siteConfigurations, java.util.List<CmsADEConfigDataInternal> moduleConfigs, java.util.Map<CmsUUID,CmsElementView> elementViews, java.util.Map<CmsUUID,CmsSitePlugin> sitePlugins, java.util.Map<CmsUUID,CmsSitemapAttributeEditorConfiguration> attributeEditorConfigurations)Creates a new configuration cache state.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>computeFolderTypes()Computes the map from folder paths to content types for this ADE configuration state.CmsADEConfigCacheStatecreateUpdatedCopy(java.util.Map<CmsUUID,CmsADEConfigDataInternal> sitemapUpdates, java.util.List<CmsADEConfigDataInternal> moduleUpdates, java.util.Map<CmsUUID,CmsElementView> elementViewUpdates, java.util.Map<CmsUUID,CmsSitePlugin> sitePluginUpdates, java.util.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 CmsADEConfigCacheStateemptyState(CmsObject cms)Creates an empty ADE configuration cache state.protected java.util.List<CmsDetailPageInfo>getAllDetailPages()Gets all detail page info beans which are defined anywhere in the configuration.CmsSitemapAttributeEditorConfigurationgetAttributeEditorConfiguration(CmsUUID id)Gets the sitemap attribute editor configuration with the given id (or null, if there isn't one).protected CmsObjectgetCms()Gets the CMS context used for VFS operations.java.util.List<CmsADEConfigData.DetailInfo>getDetailInfosForSubsites(CmsObject cms)Gets the detail page information for everything.protected java.util.List<java.lang.String>getDetailPages(java.lang.String type)Gets all the detail pages for a given type.java.util.Set<java.lang.String>getDetailPageTypes()Gets the set of type names for which detail pages are configured in any sitemap configuration.java.util.Map<CmsUUID,CmsElementView>getElementViews()Returns the element views.java.util.Map<java.lang.String,java.lang.String>getFolderTypes()Gets the map of folder types.protected CmsADEConfigDatagetModuleConfiguration()Gets the merged module configuration.java.lang.StringgetParentFolderType(java.lang.String rootPath)Helper method to retrieve the parent folder type ornullif none available.java.util.List<CmsDetailPageInfo>getRawDetailPages()Gets the raw detail page information, with no existence checks or path corrections.protected CmsADEConfigDataInternalgetSiteConfigData(java.lang.String path)Helper method for getting the best matching sitemap configuration object for a given root path, ignoring the module configuration.protected java.util.List<java.lang.String>getSiteConfigPaths(java.lang.String path)Finds the paths of sitemap configuration base paths above a given path.java.util.Set<java.lang.String>getSiteConfigurationPaths()Returns the root paths to all configured sites and sub sites.java.util.Map<CmsUUID,CmsSitePlugin>getSitePlugins()The map of site plugins, by structure id.java.util.List<java.lang.String>getSubsitesForSiteSelector()Gets subsites to be included in the site selector.protected booleanisDetailPage(CmsObject cms, CmsResource resource)Checks whether the given resource is configured as a detail page.CmsADEConfigDatalookupConfiguration(java.lang.String rootPath)Looks up the sitemap configuration for a root path.protected CmsADEConfigDataInternalmergeConfigurations(java.util.List<CmsADEConfigDataInternal> configurations)Merges a list of multiple configuration objects into a single configuration object.
-
-
-
Constructor Detail
-
CmsADEConfigCacheState
public CmsADEConfigCacheState(CmsObject cms, java.util.Map<CmsUUID,CmsADEConfigDataInternal> siteConfigurations, java.util.List<CmsADEConfigDataInternal> moduleConfigs, java.util.Map<CmsUUID,CmsElementView> elementViews, java.util.Map<CmsUUID,CmsSitePlugin> sitePlugins, java.util.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 Detail
-
emptyState
public static CmsADEConfigCacheState emptyState(CmsObject cms)
Creates an empty ADE configuration cache state.- Parameters:
cms- the CMS context- Returns:
- the empty configuration cache state
-
computeFolderTypes
public java.util.Map<java.lang.String,java.lang.String> computeFolderTypes() throws CmsException
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(java.util.Map<CmsUUID,CmsADEConfigDataInternal> sitemapUpdates, java.util.List<CmsADEConfigDataInternal> moduleUpdates, java.util.Map<CmsUUID,CmsElementView> elementViewUpdates, java.util.Map<CmsUUID,CmsSitePlugin> sitePluginUpdates, java.util.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
public CmsSitemapAttributeEditorConfiguration getAttributeEditorConfiguration(CmsUUID id)
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
-
getDetailInfosForSubsites
public java.util.List<CmsADEConfigData.DetailInfo> getDetailInfosForSubsites(CmsObject cms)
Gets the detail page information for everything.- Parameters:
cms- the current CMS context- Returns:
- the list containing all detail information
-
getDetailPageTypes
public java.util.Set<java.lang.String> 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
public java.util.Map<CmsUUID,CmsElementView> getElementViews()
Returns the element views.- Returns:
- the element views
-
getFolderTypes
public java.util.Map<java.lang.String,java.lang.String> getFolderTypes()
Gets the map of folder types.- Returns:
- the map of folder types
-
getParentFolderType
public java.lang.String getParentFolderType(java.lang.String rootPath)
Helper method to retrieve the parent folder type ornullif none available.- Parameters:
rootPath- the path of a resource- Returns:
- the parent folder content type
-
getRawDetailPages
public java.util.List<CmsDetailPageInfo> getRawDetailPages()
Gets the raw detail page information, with no existence checks or path corrections.- Returns:
- the detail page information
-
getSiteConfigurationPaths
public java.util.Set<java.lang.String> getSiteConfigurationPaths()
Returns the root paths to all configured sites and sub sites.- Returns:
- the root paths to all configured sites and sub sites
-
getSitePlugins
public java.util.Map<CmsUUID,CmsSitePlugin> getSitePlugins()
The map of site plugins, by structure id.- Returns:
- the map of site plugins
-
getSubsitesForSiteSelector
public java.util.List<java.lang.String> 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
public CmsADEConfigData lookupConfiguration(java.lang.String rootPath)
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
protected java.util.List<CmsDetailPageInfo> getAllDetailPages()
Gets all detail page info beans which are defined anywhere in the configuration.- Returns:
- the list of detail page info beans
-
getCms
protected CmsObject getCms()
Gets the CMS context used for VFS operations.- Returns:
- the CMS context used for VFS operations
-
getDetailPages
protected java.util.List<java.lang.String> getDetailPages(java.lang.String type)
Gets all the detail pages for a given type.- Parameters:
type- the name of the type- Returns:
- the detail pages for that type
-
getModuleConfiguration
protected CmsADEConfigData getModuleConfiguration()
Gets the merged module configuration.- Returns:
- the merged module configuration instance
-
getSiteConfigData
protected CmsADEConfigDataInternal getSiteConfigData(java.lang.String path)
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
protected java.util.List<java.lang.String> getSiteConfigPaths(java.lang.String path)
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
protected boolean isDetailPage(CmsObject cms, CmsResource resource)
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(java.util.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
-
-