Class TargetedContentDescriptorMergeStrategy

  • All Implemented Interfaces:
    org.craftercms.core.xml.mergers.DescriptorMergeStrategy

    public class TargetedContentDescriptorMergeStrategy
    extends org.craftercms.core.xml.mergers.impl.strategies.InheritLevelsMergeStrategy
    implements org.craftercms.core.xml.mergers.DescriptorMergeStrategy
    DescriptorMergeStrategy used for merging descriptors of a targeted content hierarchy. The exact descriptors to merge differ depending on the TargetedUrlStrategy used by the CandidateTargetedUrlsResolver, but basically the list consists of the level descriptors in the folder hierarchy followed by the candidate targeted URLs. For example, assuming we're using the folder targeted URL strategy, the fallback target ID in the configuration is "en", and that main descriptor URL is /site/website/es_CR/products/index.xml, the mergeable descriptor list will look like this:
    • /crafter-level-descriptor.level.xml
    • /site/crafter-level-descriptor.level.xml
    • /site/website/crafter-level-descriptor.level.xml
    • /site/website/en/crafter-level-descriptor.level.xml
    • /site/website/en/products/crafter-level-descriptor.level.xml
    • /site/website/en/products/index.xml
    • /site/website/es/crafter-level-descriptor.level.xml
    • /site/website/es/products/crafter-level-descriptor.level.xml
    • /site/website/es/products/index.xml
    • /site/website/es_CR/crafter-level-descriptor.level.xml
    • /site/website/es_CR/products/crafter-level-descriptor.level.xml
    • /site/website/es_CR/products/index.xml
    Author:
    avasquez
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected CandidateTargetedUrlsResolver candidateTargetedUrlsResolver  
      protected org.craftercms.core.xml.mergers.DescriptorMergeStrategyResolver mergeStrategyResolver  
      • Fields inherited from class org.craftercms.core.xml.mergers.impl.strategies.InheritLevelsMergeStrategy

        levelDescriptorFileName
      • Fields inherited from class org.craftercms.core.xml.mergers.impl.strategies.AbstractInheritFromHierarchyMergeStrategy

        baseFolders
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.dom4j.Document getDescriptorDom​(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String url)  
      List<org.craftercms.core.xml.mergers.MergeableDescriptor> getDescriptors​(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String mainDescriptorUrl, org.dom4j.Document mainDescriptorDom)  
      List<org.craftercms.core.xml.mergers.MergeableDescriptor> getDescriptors​(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String mainDescriptorUrl, org.dom4j.Document mainDescriptorDom, boolean mainDescriptorOptional)  
      void setCandidateTargetedUrlsResolver​(CandidateTargetedUrlsResolver candidateTargetedUrlsResolver)  
      void setMergeStrategyResolver​(org.craftercms.core.xml.mergers.DescriptorMergeStrategyResolver mergeStrategyResolver)  
      • Methods inherited from class org.craftercms.core.xml.mergers.impl.strategies.InheritLevelsMergeStrategy

        addInheritedDescriptorsInFolder, setLevelDescriptorFileName
      • Methods inherited from class org.craftercms.core.xml.mergers.impl.strategies.AbstractInheritFromHierarchyMergeStrategy

        getIndexAfterBaseFolder, setBaseFolders
    • Field Detail

      • mergeStrategyResolver

        protected org.craftercms.core.xml.mergers.DescriptorMergeStrategyResolver mergeStrategyResolver
    • Constructor Detail

      • TargetedContentDescriptorMergeStrategy

        public TargetedContentDescriptorMergeStrategy()
    • Method Detail

      • setMergeStrategyResolver

        public void setMergeStrategyResolver​(org.craftercms.core.xml.mergers.DescriptorMergeStrategyResolver mergeStrategyResolver)
      • setCandidateTargetedUrlsResolver

        public void setCandidateTargetedUrlsResolver​(CandidateTargetedUrlsResolver candidateTargetedUrlsResolver)
      • getDescriptors

        public List<org.craftercms.core.xml.mergers.MergeableDescriptor> getDescriptors​(org.craftercms.core.service.Context context,
                                                                                        org.craftercms.core.service.CachingOptions cachingOptions,
                                                                                        String mainDescriptorUrl,
                                                                                        org.dom4j.Document mainDescriptorDom)
                                                                                 throws org.craftercms.core.exception.XmlMergeException
        Specified by:
        getDescriptors in interface org.craftercms.core.xml.mergers.DescriptorMergeStrategy
        Overrides:
        getDescriptors in class org.craftercms.core.xml.mergers.impl.strategies.AbstractInheritFromHierarchyMergeStrategy
        Throws:
        org.craftercms.core.exception.XmlMergeException
      • getDescriptors

        public List<org.craftercms.core.xml.mergers.MergeableDescriptor> getDescriptors​(org.craftercms.core.service.Context context,
                                                                                        org.craftercms.core.service.CachingOptions cachingOptions,
                                                                                        String mainDescriptorUrl,
                                                                                        org.dom4j.Document mainDescriptorDom,
                                                                                        boolean mainDescriptorOptional)
                                                                                 throws org.craftercms.core.exception.XmlMergeException
        Specified by:
        getDescriptors in interface org.craftercms.core.xml.mergers.DescriptorMergeStrategy
        Overrides:
        getDescriptors in class org.craftercms.core.xml.mergers.impl.strategies.AbstractInheritFromHierarchyMergeStrategy
        Throws:
        org.craftercms.core.exception.XmlMergeException
      • getDescriptorDom

        protected org.dom4j.Document getDescriptorDom​(org.craftercms.core.service.Context context,
                                                      org.craftercms.core.service.CachingOptions cachingOptions,
                                                      String url)