Class CmsADEConfigData

java.lang.Object
org.opencms.ade.configuration.CmsADEConfigData

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

  • Field Details

  • Constructor Details

  • Method Details

    • combineConfigurationElements

      public static <C extends I_CmsConfigurationObject<C>> List<C> combineConfigurationElements(List<C> parentConfigs, 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 String getParentFormatterKey(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

      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

      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(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

      Gets the active external (non-schema) formatters for this sub-sitemap.

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

      Gets the active formatters for a given container type.
      Parameters:
      containerType - a container type
      Returns:
      the active formatters for the container type
    • getActiveFormattersWithDisplayType

      Gets the active formatters for a given display type.
      Parameters:
      displayType - a display type
      Returns:
      the active formatters for the display type
    • getAddableTypeNames

      Gets the set of names of types active in this sitemap configuration.
      Returns:
      the set of type names of active types
    • getAddContentRestriction

      Gets the 'add content' restriction for this configuration.
      Returns:
      the 'add content' restriction
    • getAllDetailPages

      Gets the list of all detail pages.

      Returns:
      the list of all detail pages
    • getAllDetailPages

      public List<CmsDetailPageInfo> getAllDetailPages(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

      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 String getAttribute(String key, 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
    • getAttributeEditorConfiguration

      Gets the active sitemap attribute editor configuration.
      Returns:
      the active sitemap attribute editor configuration
    • getAttributeEditorConfigurationId

      Gets the structure id of the configured sitemap attribute editor configuration.
      Returns:
      the structure id of the configured sitemap attribute editor configuration
    • getAttributes

      Gets the map of attributes configured for this sitemap, including values inherited from parent sitemaps.
      Returns:
      the map of attributes
    • getBasePath

      public 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
    • getCachedFormatters

      Gets the cached formatters.

      Returns:
      the cached formatters
    • getConfigPaths

      Gets an (immutable) list of paths of configuration files in inheritance order.
      Returns:
      the list of configuration files
    • 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

      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 List<CmsResourceTypeConfig> getCreatableTypes(CmsObject cms, 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
    • getDefaultDetailPage

      Returns the default detail page.

      Returns:
      the default detail page
    • getDefaultModelPage

      Returns the default model page.

      Returns:
      the default model page
    • getDetailInfos

      Gets the detail information for this sitemap config data object.

      Parameters:
      cms - the CMS context
      Returns:
      the list of detail information
    • getDetailPagesForType

      Gets the detail pages for a specific type.

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

      Returns the direct edit permissions for e.g. list elements with the given type.
      Parameters:
      type - the resource type name
      Returns:
      the permissions
    • getDisabledFunctionsMode

      Gets the display mode for deactivated functions in the gallery dialog.
      Parameters:
      defaultValue - the default value to return if it's not set
      Returns:
      the display mode for deactivated types
    • getDisabledTypeMode

      Gets the display mode for deactivated types in the gallery dialog.
      Parameters:
      defaultValue - the default value to return if it's not set
      Returns:
      the display mode for deactivated types
    • getDisplayFormatters

      Returns all available display formatters.

      Parameters:
      cms - the cms context
      Returns:
      the available display formatters
    • getDynamicFunctionAvailability

      Gets the bean that represents the dynamic function availability.
      Parameters:
      formatterConfig - the formatter configuration state
      Returns:
      the dynamic function availability
    • 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

      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

      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

      Gets a named function reference.

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

      Gets the list of configured function references.

      Returns:
      the list of configured function references
    • getInactiveFormatters

      Gets the map of external (non-schema) formatters which are inactive in this sub-sitemap.

      Returns:
      the map inactive external formatters
    • getModelPages

      Gets the list of available model pages.

      Returns:
      the list of available model pages
    • getModelPages

      public List<CmsModelPageConfig> getModelPages(boolean includeDisable)
      Gets the list of available model pages.

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

      Gets the formatter changes for this sitemap configuration.

      Returns:
      the formatter change set
    • getPropertyConfiguration

      Gets the configuration for the available properties.

      Returns:
      the configuration for the available properties
    • getPropertyConfiguration

      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

      Gets the property configuration as a map of CmsXmlContentProperty instances.

      Returns:
      the map of property configurations
    • getResource

      Returns the resource from which this configuration was read.

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

      Returns the configuration for a specific resource type.

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

      Gets a list of all available resource type configurations.

      Returns:
      the available resource type configurations
    • getSearchableTypes

      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<CmsUUID> getSharedSettingOverrides()
      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

      Gets the ids of site plugins which are active in this sitemap configuration.
      Returns:
      the ids of active site plugins
    • getSitePlugins

      Gets the list of site plugins active in this sitemap configuration.
      Returns:
      the list of active site plugins
    • getTypeOrderingMode

      Gets the type ordering mode.
      Returns:
      the type ordering mode
    • getTypesByName

      Gets a map of the active resource type configurations, with type names as keys.
      Returns:
      the map of active types
    • 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

      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, 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

      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.
    • isHideNonMatchingFunctions

      public boolean isHideNonMatchingFunctions()
      Checks if dynamic functions not matching any containers should be hidden.
      Returns:
      true if dynamic functions not matching any containers should be hidden
    • 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

      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

      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

      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.

    • createContentDirectory

      protected void createContentDirectory() throws CmsException
      Creates the content directory for this configuration node if possible.

      Throws:
      CmsException - if something goes wrong
    • 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

      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

      Collects the folder types in a map.

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

      Gets the formatter configuration for a resource type.

      Parameters:
      cms - the current CMS context
      resType - the resource type
      schemaFormatters - the resource schema formatters
      Returns:
      the configuration of formatters for the resource type
    • getFormattersFromSchema

      Gets the formatters from the schema.

      Parameters:
      cms - the current CMS context
      res - the resource for which the formatters should be retrieved
      Returns:
      the formatters from the schema
    • getMeta

      Gets the metadata about how this configuration was referenced.
      Returns:
      the metadata
    • internalGetFunctionReferences

      Internal method for getting the function references.

      Returns:
      the function references
    • internalGetResourceTypes

      protected List<CmsResourceTypeConfig> internalGetResourceTypes(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 List<CmsDetailPageInfo> mergeDetailPages(List<CmsDetailPageInfo> parentDetailPages, 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

      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