Class DefaultSiteModelInheritanceAssembler
- java.lang.Object
-
- org.apache.maven.doxia.site.inheritance.DefaultSiteModelInheritanceAssembler
-
- All Implemented Interfaces:
SiteModelInheritanceAssembler
@Singleton @Named public class DefaultSiteModelInheritanceAssembler extends java.lang.Object implements SiteModelInheritanceAssembler
Manage inheritance of the site model.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDefaultSiteModelInheritanceAssembler.URLRebaserURL rebaser: based on an old and a new path, can rebase a link based on old path to a value based on the new path.
-
Constructor Summary
Constructors Constructor Description DefaultSiteModelInheritanceAssembler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidassembleBodyInheritance(java.lang.String name, SiteModel child, SiteModel parent, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer)private voidassembleCustomInheritance(SiteModel child, SiteModel parent)voidassembleModelInheritance(java.lang.String name, SiteModel child, SiteModel parent, java.lang.String childBaseUrl, java.lang.String parentBaseUrl)Manage inheritance of the site model between a parent and child.private java.util.List<LinkItem>mergeLinkItemLists(java.util.List<LinkItem> childList, java.util.List<LinkItem> parentList, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer, boolean cutParentAfterDuplicate)private java.util.List<Menu>mergeMenus(java.util.List<Menu> childMenus, java.util.List<Menu> parentMenus, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer)private java.util.List<Logo>mergePoweredByLists(java.util.List<Logo> childList, java.util.List<Logo> parentList, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer)private voidrebaseLinkItemPaths(LinkItem item, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer)private voidrebaseMenuPaths(java.util.List<MenuItem> items, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer)private java.lang.StringrelativizeLink(java.lang.String link, java.lang.String baseUri)private voidrelativizeLinkItemPaths(LinkItem item, java.lang.String baseUrl)private voidrelativizeMenuPaths(java.util.List<MenuItem> items, java.lang.String baseUrl)voidresolvePaths(SiteModel siteModel, java.lang.String baseUrl)Resolve relative paths for a SiteModel given a base URL.
-
-
-
Method Detail
-
assembleModelInheritance
public void assembleModelInheritance(java.lang.String name, SiteModel child, SiteModel parent, java.lang.String childBaseUrl, java.lang.String parentBaseUrl)Manage inheritance of the site model between a parent and child. Any relative links in the parent model will be re-based to work from the merged child model, otherwise no content from either the parent or child model should be modified.- Specified by:
assembleModelInheritancein interfaceSiteModelInheritanceAssembler- Parameters:
name- a name, used for breadcrumb. If the parent model contains breadcrumbs and the child doesn't, a child breadcrumb will be added to the merged model with this name. Not null.child- the child SiteModel to be merged with parent. Not null. If parent == null, the child is unchanged, otherwise child will contain the merged model upon exit.parent- the parent SiteModel. Unchanged upon exit. May be null in which case the child is not changed.childBaseUrl- the child base URL. May be null, in which case relative links inherited from the parent will not be resolved in the merged child.parentBaseUrl- the parent base URL. May be null, in which case relative links inherited from the parent will not be resolved in the merged child.
-
resolvePaths
public void resolvePaths(SiteModel siteModel, java.lang.String baseUrl)
Resolve relative paths for a SiteModel given a base URL. Note that 'resolve' here means 'relativize' in the sense ofURI.relativize(java.net.URI), ie if any link in the site model has a base URL that is equal to the given baseUrl, it is replaced by a relative link with respect to that base.- Specified by:
resolvePathsin interfaceSiteModelInheritanceAssembler- Parameters:
siteModel- the SiteModel. Not null.baseUrl- the base URL. May be null in which case the site model is unchanged.
-
assembleCustomInheritance
private void assembleCustomInheritance(SiteModel child, SiteModel parent)
-
assembleBodyInheritance
private void assembleBodyInheritance(java.lang.String name, SiteModel child, SiteModel parent, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer)
-
mergeMenus
private java.util.List<Menu> mergeMenus(java.util.List<Menu> childMenus, java.util.List<Menu> parentMenus, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer)
-
relativizeMenuPaths
private void relativizeMenuPaths(java.util.List<MenuItem> items, java.lang.String baseUrl)
-
rebaseMenuPaths
private void rebaseMenuPaths(java.util.List<MenuItem> items, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer)
-
relativizeLinkItemPaths
private void relativizeLinkItemPaths(LinkItem item, java.lang.String baseUrl)
-
rebaseLinkItemPaths
private void rebaseLinkItemPaths(LinkItem item, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer)
-
mergeLinkItemLists
private java.util.List<LinkItem> mergeLinkItemLists(java.util.List<LinkItem> childList, java.util.List<LinkItem> parentList, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer, boolean cutParentAfterDuplicate)
-
mergePoweredByLists
private java.util.List<Logo> mergePoweredByLists(java.util.List<Logo> childList, java.util.List<Logo> parentList, DefaultSiteModelInheritanceAssembler.URLRebaser urlContainer)
-
relativizeLink
private java.lang.String relativizeLink(java.lang.String link, java.lang.String baseUri)
-
-