Class AbstractInheritFromHierarchyMergeStrategy
- java.lang.Object
-
- org.craftercms.core.xml.mergers.impl.strategies.AbstractInheritFromHierarchyMergeStrategy
-
- All Implemented Interfaces:
DescriptorMergeStrategy
- Direct Known Subclasses:
CompositeInheritFromHierarchyMergeStrategy,InheritLevelsMergeStrategy,InheritVersionsMergeStrategy
public abstract class AbstractInheritFromHierarchyMergeStrategy extends Object implements DescriptorMergeStrategy
AbstractDescriptorMergeStrategythat defines the base code for strategies that decide which descriptors to "inherit" from upper levels in the folder hierarchy.- Author:
- Sumer Jabri, Alfonso Vásquez
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]baseFolders
-
Constructor Summary
Constructors Constructor Description AbstractInheritFromHierarchyMergeStrategy()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddInheritedDescriptorsInFolder(Context context, CachingOptions cachingOptions, List<MergeableDescriptor> inheritedDescriptors, String folder, String mainDescriptorUrl, org.dom4j.Document mainDescriptorDom)List<MergeableDescriptor>getDescriptors(Context context, CachingOptions cachingOptions, String mainDescriptorUrl, org.dom4j.Document mainDescriptorDom)Returns the list of descriptors in the order they should be merged, given the URI of the primary descriptor.List<MergeableDescriptor>getDescriptors(Context context, CachingOptions cachingOptions, String mainDescriptorUrl, org.dom4j.Document mainDescriptorDom, boolean mainDescriptorOptional)Returns the list of descriptors in the order they should be merged, given the URI of the primary descriptor.protected intgetIndexAfterBaseFolder(String url)voidsetBaseFolders(String[] baseFolders)
-
-
-
Field Detail
-
baseFolders
protected String[] baseFolders
-
-
Method Detail
-
setBaseFolders
public void setBaseFolders(String[] baseFolders)
-
getDescriptors
public List<MergeableDescriptor> getDescriptors(Context context, CachingOptions cachingOptions, String mainDescriptorUrl, org.dom4j.Document mainDescriptorDom) throws XmlMergeException
Description copied from interface:DescriptorMergeStrategyReturns the list of descriptors in the order they should be merged, given the URI of the primary descriptor.- Specified by:
getDescriptorsin interfaceDescriptorMergeStrategy- Parameters:
context- the current contextcachingOptions- caching options in case you need access to itemsmainDescriptorUrl- the URL of the main descriptormainDescriptorDom- the DOM of the main descriptor- Returns:
- a list of
MergeableDescriptors representing the descriptors to merge - Throws:
XmlMergeException
-
getDescriptors
public List<MergeableDescriptor> getDescriptors(Context context, CachingOptions cachingOptions, String mainDescriptorUrl, org.dom4j.Document mainDescriptorDom, boolean mainDescriptorOptional) throws XmlMergeException
Description copied from interface:DescriptorMergeStrategyReturns the list of descriptors in the order they should be merged, given the URI of the primary descriptor.- Specified by:
getDescriptorsin interfaceDescriptorMergeStrategy- Parameters:
context- the current contextcachingOptions- caching options in case you need access to itemsmainDescriptorUrl- the URL of the primary descriptormainDescriptorDom- the DOM of the main descriptormainDescriptorOptional- if the primary descriptor should be marked as optional- Returns:
- a list of
MergeableDescriptors representing the descriptors to merge - Throws:
XmlMergeException
-
getIndexAfterBaseFolder
protected int getIndexAfterBaseFolder(String url)
-
addInheritedDescriptorsInFolder
protected abstract void addInheritedDescriptorsInFolder(Context context, CachingOptions cachingOptions, List<MergeableDescriptor> inheritedDescriptors, String folder, String mainDescriptorUrl, org.dom4j.Document mainDescriptorDom)
-
-