public HstSiteMapService(HstSite hstSite, Node siteMapNode, HstSiteMapItemHandlersConfiguration siteMapItemHandlersConfiguration) throws RepositoryException, ServiceException { super(siteMapNode); this.hstSite = hstSite; this.siteMapRootNodePath = siteMapNode.getPath(); this.siteMapItemHandlersConfiguration = siteMapItemHandlersConfiguration; if(!siteMapNode.isNodeType(HstNodeTypes.NODETYPE_HST_SITEMAP)) { this.closeValueProvider(false); throw new ServiceException("Cannot create SitemapServiceImpl: Expected nodeType '"+HstNodeTypes.NODETYPE_HST_SITEMAP+"' but was '"+siteMapNode.getPrimaryNodeType().getName()+"'"); } // initialize all sitemap items init(siteMapNode); // add lookups to any descendant sitemap item for(HstSiteMapItem child : this.rootSiteMapItems.values()) { populateDescendants(child); } }
private void checkAndLogAccessibleRootComponents() { for(HstSiteMapItem hstSiteMapItem :this.siteMapService.getSiteMapItems()){ sanitizeSiteMapItem(hstSiteMapItem); } }
private void populateDescendants(HstSiteMapItem hstSiteMapItem) { siteMapDescendants.put(hstSiteMapItem.getId(), hstSiteMapItem); for(HstSiteMapItem child : hstSiteMapItem.getChildren()) { populateDescendants(child); } }
return sm; HstSiteMap sm = new HstSiteMapService(this, siteMapNode, mountSiteMapConfiguration, getSiteMapItemHandlersConfiguration()); siteMap = Optional.of(sm); if (componentsConfiguration != null) {
private void populateDescendants(HstSiteMapItem hstSiteMapItem) throws ModelLoadingException { try { siteMapDescendants.put(hstSiteMapItem.getId(), hstSiteMapItem); } catch (IllegalArgumentException e) { throw new ModelLoadingException("HstSiteMapItem with already existing id encountered. Not allowed to have duplicate id's within one HstSiteMap. Duplicate id = '"+hstSiteMapItem.getId()+"'" , e); } if(hstSiteMapItem.getRefId() != null) { HstSiteMapItem prevValue = siteMapDescendantsByRefId.put(hstSiteMapItem.getRefId(), hstSiteMapItem); if(prevValue != null) { log.warn("HstSiteMapItem with already existing refId encountered. Not allowed to have duplicate refId's within one HstSiteMap. Duplicate refId = '{}' for HstSiteMapItem with id='{}'. Previous HstSiteMapItem with same refId is replaced.",hstSiteMapItem.getRefId(), hstSiteMapItem.getId()); } } for(HstSiteMapItem child : hstSiteMapItem.getChildren()) { populateDescendants(child); } }
this.siteMapService = new HstSiteMapService(this, siteMapNode, siteMapItemHandlersConfigurationService);