private static int getTotalNumberOfChildren(final HstSiteMapItem parent) { int numChildren = parent.getChildren().size(); for (final HstSiteMapItem item : parent.getChildren()) { numChildren += getTotalNumberOfChildren(item); } return numChildren; }
private void populateDescendants(HstSiteMapItem hstSiteMapItem) { siteMapDescendants.put(hstSiteMapItem.getId(), hstSiteMapItem); for(HstSiteMapItem child : hstSiteMapItem.getChildren()) { populateDescendants(child); } }
public static final void view(StringBuffer buf, String indent, HstSiteMapItem hstSiteMapItem) { if(hstSiteMapItem == null) { buf.append("\n").append(indent).append("+HstSiteMapItem: null"); return; } buf.append("\n").append(indent).append("+HstSiteMapItem: (").append(hstSiteMapItem.hashCode()).append(")"); String newLine = "\n" + indent + SMALL_INDENT + "-"; buf.append(newLine).append("id = ").append(hstSiteMapItem.getId()); buf.append(newLine).append("value = ").append(hstSiteMapItem.getValue()); buf.append(newLine).append("relativecontentpath = ").append(hstSiteMapItem.getRelativeContentPath()); buf.append(newLine).append("componentconfigurationid = ").append(hstSiteMapItem.getComponentConfigurationId()); buf.append(newLine).append("portletcomponentconfigurationid = ").append(hstSiteMapItem.getPortletComponentConfigurationId()); buf.append(newLine).append("iswildcard = ").append(hstSiteMapItem.isWildCard()); for(HstSiteMapItem siteMapItem : hstSiteMapItem.getChildren()) { view(buf, indent+SMALL_INDENT, siteMapItem); } }
public static HstSiteMapItem getSiteMapItem(HstSiteMapItem siteMapItem, String siteMapItemId) { if (!(siteMapItem instanceof CanonicalInfo)) { return null; } if (((CanonicalInfo)siteMapItem).getCanonicalIdentifier().equals(siteMapItemId)) { return siteMapItem; } for (HstSiteMapItem child : siteMapItem.getChildren()) { HstSiteMapItem o = getSiteMapItem(child, siteMapItemId); if (o != null) { return o; } } return null; }
private static void addUsersWithSiteMapItemLock(final HstSiteMapItem item, final Set<String> usersWithLock, final String previewConfigurationPath) { final boolean inherited = !((CanonicalInfo) item).getCanonicalPath().startsWith(previewConfigurationPath + "/"); if (inherited) { // skip inherited sitemap item changes as that is not supported currently return; } if (!(item instanceof ConfigurationLockInfo)) { return; } String lockedBy = ((ConfigurationLockInfo) item).getLockedBy(); if (StringUtils.isNotBlank(lockedBy)) { usersWithLock.add(lockedBy); } for (HstSiteMapItem child : item.getChildren()) { addUsersWithSiteMapItemLock(child, usersWithLock, previewConfigurationPath); } }
private void add2LocationMap(HstSiteMapItem siteMapItem) { String normPath = PathUtils.normalizePath(siteMapItem.getRelativeContentPath()); if( !(normPath == null || "".equals(normPath))) { this.addSiteMapItem(normPath, siteMapItem); } for(HstSiteMapItem child : siteMapItem.getChildren()) { add2LocationMap(child); } }
/** * @param siteMapItems * @return <code>true</code> if any of the <code>siteMapItems</code> or its descendents uses a different scheme than * the scheme of this {@link MountService} */ private Boolean multipleSchemesUsed(final List<HstSiteMapItem> siteMapItems) { for (HstSiteMapItem siteMapItem : siteMapItems) { if (siteMapItem.isSchemeAgnostic()) { continue; } if (!scheme.equals(siteMapItem.getScheme())) { return Boolean.TRUE; } if (multipleSchemesUsed(siteMapItem.getChildren())) { return Boolean.TRUE; } } return Boolean.FALSE; }
private void sanitizeSiteMapItem(final HstSiteMapItem hstSiteMapItem, final HstComponentsConfiguration hstComponentsConfiguration) { HstComponentConfiguration hstComponentConfiguration = hstComponentsConfiguration.getComponentConfiguration(hstSiteMapItem.getComponentConfigurationId()); if(hstComponentConfiguration == null) { log.info("HST Configuration info: The sitemap item '{}' does not point to a HST Component.", hstSiteMapItem.getId()); } else { sanitizeHstComponentConfiguration(hstComponentConfiguration); } for(HstSiteMapItem child : hstSiteMapItem.getChildren()) { sanitizeSiteMapItem(child, hstComponentsConfiguration); } }
private void add2LocationMap(final HstSiteMapItem siteMapItem) { final String normPath = PathUtils.normalizePath(siteMapItem.getRelativeContentPath()); if (siteMapItem.isExcludedForLinkRewriting()){ log.debug("'{}' will not be used for link rewriting as it is marked deleted or is configured to be " + "excluded for link rewriting.", siteMapItem); return; } if (StringUtils.isNotEmpty(normPath)) { log.debug("Adding to location map path '{}' for sitemap item '{}'", normPath, siteMapItem.getQualifiedId()); addSiteMapItem(normPath, siteMapItem); } for(HstSiteMapItem child : siteMapItem.getChildren()) { add2LocationMap(child); } }
private void sanitizeSiteMapItem(HstSiteMapItem hstSiteMapItem) { HstComponentConfiguration hstComponentConfiguration = this.getComponentsConfiguration().getComponentConfiguration(hstSiteMapItem.getComponentConfigurationId()); if(hstComponentConfiguration == null) { log.info("HST Configuration info: The sitemap item '{}' does not point to a HST Component.", hstSiteMapItem.getId()); } else { sanitizeHstComponentConfiguration(hstComponentConfiguration); } for(HstSiteMapItem child : hstSiteMapItem.getChildren()) { sanitizeSiteMapItem(child); } }
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); } }
siteMapPageRepresentation.represent(siteMapItem, parent.getId(), mount, homePagePathInfo, previewConfigurationPath); for (HstSiteMapItem child : siteMapItem.getChildren()) { addPages(child, siteMapPageRepresentation, homePagePathInfo, previewConfigurationPath);
for (HstSiteMapItem child : siteMapItem.getChildren()) { add2LocationMap(child, configuration, mountContentPath, classLoader);
for (HstSiteMapItem child : hstSiteMapItem.getChildren()) { if (!isInvisibleItem(child, pageNotFound)) { setExpandable(true);