Class TargetedContentDescriptorMergeStrategy

java.lang.Object
org.craftercms.core.xml.mergers.impl.strategies.AbstractInheritFromHierarchyMergeStrategy
org.craftercms.core.xml.mergers.impl.strategies.InheritLevelsMergeStrategy
org.craftercms.engine.targeting.impl.merge.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 org.craftercms.core.xml.mergers.DescriptorMergeStrategyResolver
     

    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
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    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
     
    void
    setMergeStrategyResolver(org.craftercms.core.xml.mergers.DescriptorMergeStrategyResolver mergeStrategyResolver)
     

    Methods inherited from class org.craftercms.core.xml.mergers.impl.strategies.InheritLevelsMergeStrategy

    addInheritedDescriptorsInFolder

    Methods inherited from class org.craftercms.core.xml.mergers.impl.strategies.AbstractInheritFromHierarchyMergeStrategy

    getIndexAfterBaseFolder, setBaseFolders

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • mergeStrategyResolver

      protected org.craftercms.core.xml.mergers.DescriptorMergeStrategyResolver mergeStrategyResolver
    • candidateTargetedUrlsResolver

      protected CandidateTargetedUrlsResolver candidateTargetedUrlsResolver
  • Constructor Details

    • TargetedContentDescriptorMergeStrategy

      public TargetedContentDescriptorMergeStrategy(String levelDescriptorFileName)
  • Method Details

    • setMergeStrategyResolver

      @Autowired public void setMergeStrategyResolver(@Lazy org.craftercms.core.xml.mergers.DescriptorMergeStrategyResolver mergeStrategyResolver)
    • setCandidateTargetedUrlsResolver

      @Autowired public void setCandidateTargetedUrlsResolver(@Lazy 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)