Class CmsADEConfigData


  • public class CmsADEConfigData
    extends java.lang.Object
    A class which represents the accessible configuration data at a given point in a sitemap.

    • Method Detail

      • combineConfigurationElements

        public static <C extends I_CmsConfigurationObject<C>> java.util.List<C> combineConfigurationElements​(java.util.List<C> parentConfigs,
                                                                                                             java.util.List<C> childConfigs,
                                                                                                             boolean preserveDisabled)
        Generic method to merge lists of named configuration objects.

        The lists are merged such that the configuration objects from the child list rise to the front of the result list, and two configuration objects will be merged themselves if they share the same name.

        For example, if we have two lists of configuration objects:

        parent: A1, B1, C1

        child: D2, B2

        then the resulting list will look like:

        D2, B3, A1, C1

        where B3 is the result of merging B1 and B2.

        Type Parameters:
        C - the type of configuration object
        Parameters:
        parentConfigs - the parent configurations
        childConfigs - the child configurations
        preserveDisabled - if true, try to merge parents with disabled children instead of discarding them
        Returns:
        the merged configuration object list
      • getParentFormatterKey

        public static final java.lang.String getParentFormatterKey​(java.lang.String key)
        If the given formatter key has a sub-formatter suffix, returns the part before it, otherwise returns null.
        Parameters:
        key - the formatter key
        Returns:
        the parent formatter key
      • applyAllFormatterChanges

        public void applyAllFormatterChanges​(CmsFormatterIndex formatterIndex,
                                             CmsFormatterConfigurationCacheState formatterCacheState)
        Applies the formatter change sets of this and all parent configurations to a formatter index
        Parameters:
        formatterIndex - the collection of formatters to apply the changes to
        formatterCacheState - the formatter cache state from which new external formatters should be fetched
      • findFormatter

        public I_CmsFormatterBean findFormatter​(CmsUUID id)
        Gets the 'best' formatter for the given ID.

        If the formatter with the ID has a key, then the active formatter with the same key is returned. Otherwise, the formatter matching the ID is returned. So being active and having the same key is prioritized over an exact ID match.

        Parameters:
        id - the formatter ID
        Returns:
        the best formatter the given ID
      • findFormatter

        public I_CmsFormatterBean findFormatter​(CmsUUID id,
                                                boolean noWarn)
        Gets the 'best' formatter for the given ID.

        If the formatter with the ID has a key, then the active formatter with the same key is returned. Otherwise, the formatter matching the ID is returned. So being active and having the same key is prioritized over an exact ID match.

        Parameters:
        id - the formatter ID
        noWarn - if true, disables warnings
        Returns:
        the best formatter the given ID
      • findFormatter

        public I_CmsFormatterBean findFormatter​(java.lang.String name)
        Gets the 'best' formatter for the given name.

        The name can be either a formatter key, or a formatter UUID. If it's a key, an active formatter with that key is returned. If it's a UUID, and the formatter with that UUID has no key, it will be returned. If it does have a key, the active formatter with that key is returned (so being active and having the same key is prioritized over an exact ID match).

        Parameters:
        name - a formatter name (key or ID)
        Returns:
        the best formatter for that name, or null if no formatter could be found
      • findFormatter

        public I_CmsFormatterBean findFormatter​(java.lang.String name,
                                                boolean noWarn)
        Gets the 'best' formatter for the given name.

        The name can be either a formatter key, or a formatter UUID. If it's a key, an active formatter with that key is returned. If it's a UUID, and the formatter with that UUID has no key, it will be returned. If it does have a key, the active formatter with that key is returned (so being active and having the same key is prioritized over an exact ID match).

        Parameters:
        name - a formatter name (key or ID)
        noWarn - if true, disables warnings
        Returns:
        the best formatter for that name, or null if no formatter could be found
      • getActiveFormatters

        public java.util.Map<CmsUUID,​I_CmsFormatterBeangetActiveFormatters()
        Gets the active external (non-schema) formatters for this sub-sitemap.

        Returns:
        the map of active external formatters by structure id
      • getActiveFormattersWithContainerType

        public java.util.List<I_CmsFormatterBeangetActiveFormattersWithContainerType​(java.lang.String containerType)
        Gets the active formatters for a given container type.
        Parameters:
        containerType - a container type
        Returns:
        the active formatters for the container type
      • getActiveFormattersWithDisplayType

        public java.util.List<I_CmsFormatterBeangetActiveFormattersWithDisplayType​(java.lang.String displayType)
        Gets the active formatters for a given display type.
        Parameters:
        displayType - a display type
        Returns:
        the active formatters for the display type
      • getAddableTypeNames

        public java.util.Set<java.lang.String> getAddableTypeNames()
        Gets the set of names of types active in this sitemap configuration.
        Returns:
        the set of type names of active types
      • getAllDetailPages

        public java.util.List<CmsDetailPageInfogetAllDetailPages​(boolean update)
        Gets a list of all detail pages.

        Parameters:
        update - if true, this method will try to correct the root paths in the returned objects if the corresponding resources have been moved
        Returns:
        the list of all detail pages
      • getAncestorTypeNames

        public java.util.Set<java.lang.String> getAncestorTypeNames()
        Gets the set of names of types configured in this or any ancestor sitemap configurations.
        Returns:
        the set of type names from all ancestor configurations
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String key,
                                             java.lang.String defaultValue)
        Gets the value of an attribute, or a default value
        Parameters:
        key - the attribute key
        defaultValue - the value to return if no attribute with the given name is found
        Returns:
        the attribute value
      • getAttributeEditorConfigurationId

        public CmsUUID getAttributeEditorConfigurationId()
        Gets the structure id of the configured sitemap attribute editor configuration.
        Returns:
        the structure id of the configured sitemap attribute editor configuration
      • getBasePath

        public java.lang.String getBasePath()
        Gets the configuration base path.

        For example, if the configuration file is located at /sites/default/.content/.config, the base path is /sites/default.

        Returns:
        the base path of the configuration
      • getConfigPaths

        public java.util.List<java.lang.String> getConfigPaths()
        Gets an (immutable) list of paths of configuration files in inheritance order.
        Returns:
        the list of configuration files
      • getConfiguredWorkplaceBundles

        public java.util.Set<java.lang.String> getConfiguredWorkplaceBundles()
        Returns 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.
      • getContentFolderPath

        public java.lang.String getContentFolderPath()
        Gets the content folder path.

        For example, if the configuration file is located at /sites/default/.content/.config, the content folder path is /sites/default/.content

        Returns:
        the content folder path
      • getCreatableTypes

        public java.util.List<CmsResourceTypeConfiggetCreatableTypes​(CmsObject cms,
                                                                       java.lang.String pageFolderRootPath)
                                                                throws CmsException
        Returns a list of the creatable resource types.

        Parameters:
        cms - the CMS context used to check whether the resource types are creatable
        pageFolderRootPath - the root path of the current container page
        Returns:
        the list of creatable resource type
        Throws:
        CmsException - if something goes wrong
      • getDetailPagesForType

        public java.util.List<CmsDetailPageInfogetDetailPagesForType​(java.lang.String type)
        Gets the detail pages for a specific type.

        Parameters:
        type - the type name
        Returns:
        the list of detail pages for that type
      • getExternalDetailContentExclusionFolder

        public java.lang.String getExternalDetailContentExclusionFolder()
        Gets the root path of the closest subsite going up the tree which has the 'exclude external detail contents' option enabled, or '/' if no such subsite exists.
        Returns:
        the root path of the closest subsite with 'external detail contents excluded'
      • getFormatterChangeSets

        public java.util.List<CmsFormatterChangeSetgetFormatterChangeSets()
        Returns the formatter change sets for this and all parent sitemaps, ordered by increasing folder depth of the sitemap.

        Returns:
        the formatter change sets for all ancestor sitemaps
      • getFormatters

        public CmsFormatterConfiguration getFormatters​(CmsObject cms,
                                                       CmsResource res)
        Gets the formatter configuration for a resource.

        Parameters:
        cms - the current CMS context
        res - the resource for which the formatter configuration should be retrieved
        Returns:
        the configuration of formatters for the resource
      • getFunctionReference

        public CmsFunctionReference getFunctionReference​(java.lang.String name)
        Gets a named function reference.

        Parameters:
        name - the name of the function reference
        Returns:
        the function reference for the given name
      • getInactiveFormatters

        public java.util.Map<CmsUUID,​I_CmsFormatterBeangetInactiveFormatters()
        Gets the map of external (non-schema) formatters which are inactive in this sub-sitemap.

        Returns:
        the map inactive external formatters
      • getModelPages

        public java.util.List<CmsModelPageConfiggetModelPages()
        Gets the list of available model pages.

        Returns:
        the list of available model pages
      • getModelPages

        public java.util.List<CmsModelPageConfiggetModelPages​(boolean includeDisable)
        Gets the list of available model pages.

        Parameters:
        includeDisable - true to include disabled model pages
        Returns:
        the list of available model pages
      • getPropertyConfiguration

        public java.util.List<CmsPropertyConfiggetPropertyConfiguration()
        Gets the configuration for the available properties.

        Returns:
        the configuration for the available properties
      • getPropertyConfiguration

        public java.util.Map<java.lang.String,​CmsXmlContentPropertygetPropertyConfiguration​(java.util.Map<java.lang.String,​CmsXmlContentProperty> defaultProperties)
        Computes the ordered map of properties to display in the property dialog, given the map of default property configurations passed as a parameter.
        Parameters:
        defaultProperties - the default property configurations
        Returns:
        the ordered map of property configurations for the property dialog
      • getPropertyConfigurationAsMap

        public java.util.Map<java.lang.String,​CmsXmlContentPropertygetPropertyConfigurationAsMap()
        Gets the property configuration as a map of CmsXmlContentProperty instances.

        Returns:
        the map of property configurations
      • getResource

        public CmsResource getResource()
        Returns the resource from which this configuration was read.

        Returns:
        the resource from which this configuration was read
      • getResourceType

        public CmsResourceTypeConfig getResourceType​(java.lang.String typeName)
        Returns the configuration for a specific resource type.

        Parameters:
        typeName - the name of the type
        Returns:
        the resource type configuration for that type
      • getResourceTypes

        public java.util.List<CmsResourceTypeConfiggetResourceTypes()
        Gets a list of all available resource type configurations.

        Returns:
        the available resource type configurations
      • getSearchableTypes

        public java.util.Collection<CmsResourceTypeConfiggetSearchableTypes​(CmsObject cms)
        Gets the searchable resource type configurations.

        Parameters:
        cms - the current CMS context
        Returns:
        the searchable resource type configurations
      • getSharedSettingOverrides

        public com.google.common.collect.ImmutableList<CmsUUIDgetSharedSettingOverrides()
        Gets the list of structure ids of the shared setting overrides, ordered by increasing specificity.
        Returns:
        the list of structure ids of shared setting overrides
      • getSitePluginIds

        public java.util.Set<CmsUUIDgetSitePluginIds()
        Gets the ids of site plugins which are active in this sitemap configuration.
        Returns:
        the ids of active site plugins
      • getSitePlugins

        public java.util.List<CmsSitePlugingetSitePlugins()
        Gets the list of site plugins active in this sitemap configuration.
        Returns:
        the list of active site plugins
      • getTypesByName

        public java.util.Map<java.lang.String,​CmsResourceTypeConfiggetTypesByName()
        Gets a map of the active resource type configurations, with type names as keys.
        Returns:
        the map of active types
      • getTypesWithActiveSchemaFormatters

        public java.util.Set<java.lang.String> getTypesWithActiveSchemaFormatters()
        Gets the set of resource type names for which schema formatters can be enabled or disabled and which are not disabled in this sub-sitemap.

        Returns:
        the set of types for which schema formatters are active
      • getTypesWithModifiableFormatters

        public java.util.Set<java.lang.String> getTypesWithModifiableFormatters()
        Gets the set of names of resource types which have schema-based formatters that can be enabled or disabled.

        Returns:
        the set of names of resource types which have schema-based formatters that can be enabled or disabled
      • hasFormatters

        public boolean hasFormatters​(CmsObject cms,
                                     I_CmsResourceType resType,
                                     java.util.Collection<CmsContainer> containers)
        Checks if there are any matching formatters for the given set of containers.

        Parameters:
        cms - the current CMS context
        resType - the resource type for which the formatter configuration should be retrieved
        containers - the page containers
        Returns:
        if there are any matching formatters
      • isCreateContentsLocally

        public boolean isCreateContentsLocally()
        Returns the value of the "create contents locally" flag.

        If this flag is set, contents of types configured in a super-sitemap will be created in the sub-sitemap (if the user creates them from the sub-sitemap).

        Returns:
        the "create contents locally" flag
      • isDiscardInheritedModelPages

        public boolean isDiscardInheritedModelPages()
        Returns the value of the "discard inherited model pages" flag.

        If this flag is set, inherited model pages will be discarded for this sitemap.

        Returns:
        the "discard inherited model pages" flag
      • isDiscardInheritedProperties

        public boolean isDiscardInheritedProperties()
        Returns the value of the "discard inherited properties" flag.

        If this is flag is set, inherited property definitions will be discarded for this sitemap.

        Returns:
        the "discard inherited properties" flag.

      • isDiscardInheritedTypes

        public boolean isDiscardInheritedTypes()
        Returns the value of the "discard inherited types" flag.

        If this flag is set, inherited resource types from a super-sitemap will be discarded for this sitemap.

        Returns:
        the "discard inherited types" flag
      • isExcludeExternalDetailContents

        public boolean isExcludeExternalDetailContents()
        True if detail contents outside this sitemap should not be rendered in detail pages from this sitemap.
        Returns:
        true if detail contents outside this sitemap should not be rendered in detail pages from this sitemap.
      • isIncludeInSiteSelector

        public boolean isIncludeInSiteSelector()
        Returns true if the subsite should be included in the site selector.
        Returns:
        true if the subsite should be included in the site selector
      • isModuleConfiguration

        public boolean isModuleConfiguration()
        Returns true if this is a module configuration instead of a normal sitemap configuration.

        Returns:
        true if this is a module configuration
      • isPreferDetailPagesForLocalContents

        public boolean isPreferDetailPagesForLocalContents()
        Returns true if detail pages from this sitemap should be preferred for links to contents in this sitemap.

        Returns:
        true if detail pages from this sitemap should be preferred for links to contents in this sitemap
      • isSearchContentFormatter

        public boolean isSearchContentFormatter​(CmsUUID jspId)
        Checks if any formatter with the given JSP id has the 'search content' option set to true.
        Parameters:
        jspId - the structure id of a formatter JSP
        Returns:
        true if any of the formatters
      • isUseFormatterKeys

        public boolean isUseFormatterKeys()
        Returns true if the new container page format, which uses formatter keys (but also is different in other ways from the new format
        Returns:
        true if formatter keys should be used
      • parent

        public CmsADEConfigData parent()
        Fetches the parent configuration of this configuration.

        If this configuration is a sitemap configuration with no direct parent configuration, the module configuration will be returned. If this configuration already is a module configuration, null will be returned.

        Returns:
        the parent configuration
      • shouldShowSitemapAttributeDialog

        public boolean shouldShowSitemapAttributeDialog()
        Returns true if the sitemap attribute editor should be available in this subsite.
        Returns:
        true if the sitemap attribute editor dialog should be available
      • clearCaches

        protected void clearCaches()
        Clears the internal formatter caches.

        This should only be used for test cases.

      • getCms

        protected CmsObject getCms()
        Gets the CMS object used for VFS operations.

        Returns:
        the CMS object used for VFS operations
      • getCmsObject

        protected CmsObject getCmsObject()
        Gets the CMS object used for VFS operations.

        Returns:
        the CMS object
      • getDetailPagesMap

        protected java.util.Map<java.lang.String,​java.util.List<CmsDetailPageInfo>> getDetailPagesMap​(java.util.List<CmsDetailPageInfo> detailPages)
        Helper method to converts a list of detail pages to a map from type names to lists of detail pages for each type.

        Parameters:
        detailPages - the list of detail pages
        Returns:
        the map of detail pages
      • getFolderTypes

        protected java.util.Map<java.lang.String,​java.lang.String> getFolderTypes()
                                                                                 throws CmsException
        Collects the folder types in a map.

        Returns:
        the map of folder types
        Throws:
        CmsException - if something goes wrong
      • internalGetResourceTypes

        protected java.util.List<CmsResourceTypeConfiginternalGetResourceTypes​(boolean filterDisabled)
        Helper method for getting the list of resource types.

        Parameters:
        filterDisabled - true if disabled types should be filtered from the result
        Returns:
        the list of resource types
      • mergeDetailPages

        protected java.util.List<CmsDetailPageInfomergeDetailPages​(java.util.List<CmsDetailPageInfo> parentDetailPages,
                                                                     java.util.List<CmsDetailPageInfo> ownDetailPages)
        Merges two lists of detail pages, one from a parent configuration and one from a child configuration.

        Parameters:
        parentDetailPages - the parent's detail pages
        ownDetailPages - the child's detail pages
        Returns:
        the merged detail pages
      • updateUris

        protected java.util.List<CmsDetailPageInfoupdateUris​(java.util.List<CmsDetailPageInfo> detailPages)
        Helper method to correct paths in detail page beans if the corresponding resources have been moved.

        Parameters:
        detailPages - the original list of detail pages
        Returns:
        the corrected list of detail pages