this.resolvedSiteMount = resolvedSiteMount; HstSite hstSite = hstSiteMapItem.getHstSiteMap().getSite(); if (hstSiteMapItem.getComponentConfigurationId() == null && hstSiteMapItem.getPortletComponentConfigurationId() == null) { log.debug("The ResolvedSiteMapItemImpl does not have a component configuration id because the sitemap item '{}' does not have one", hstSiteMapItem.getId()); } else { String componentConfigurationId = hstSiteMapItem.getComponentConfigurationId(); String portletComponentConfigurationId = hstSiteMapItem.getPortletComponentConfigurationId(); for(Entry<String, String> entry : hstSiteMapItem.getParameters().entrySet()) { Object o = pp.resolveProperty(entry.getKey(), entry.getValue()); resolvedParameters.put(entry.getKey(), o); for(Entry<String, String> entry : hstSiteMapItem.getLocalParameters().entrySet()) { Object o = pp.resolveProperty(entry.getKey(), entry.getValue()); localResolvedParameters.put(entry.getKey(), o); relativeContentPath = (String)pp.resolveProperty("relativeContentPath", hstSiteMapItem.getRelativeContentPath());
throw new IllegalArgumentException("Expected object of type ConfigurationLockInfo"); name = NodeNameCodec.decode(item.getValue()); id = ((CanonicalInfo) item).getCanonicalIdentifier(); if (item.getParentItem() != null) { parentId = ((CanonicalInfo) item.getParentItem()).getCanonicalIdentifier(); parentPathInfo = HstSiteMapUtils.getPath(item.getParentItem(), null); pageTitle = item.getPageTitle(); componentConfigurationId = item.getComponentConfigurationId(); final HstComponentConfiguration page = mount.getHstSite().getComponentsConfiguration().getComponentConfiguration(componentConfigurationId); hasContainerItemInPageDefinition = hasContainerItemInPageDefinition(page); cacheable = item.isCacheable(); workspaceConfiguration = ((CanonicalInfo) item).isWorkspaceConfiguration(); inherited = !((CanonicalInfo) item).getCanonicalPath().startsWith(mount.getHstSite().getConfigurationPath() + "/"); relativeContentPath = item.getRelativeContentPath(); scheme = item.getScheme(); wildCard = item.isWildCard(); any = item.isAny(); containsWildCard = item.containsWildCard(); containsAny = item.containsAny(); isExplicitElement = item.isExplicitElement(); localParameters = item.getLocalParameters(); roles = item.getRoles();
if( (s = hstSiteMapItemService.getChild(elements[position])) != null && !checkedSiteMapItems.contains(s) && !s.isMarkedDeleted()) { if (s.isAny() || s.isWildCard()) { } else if( (s = hstSiteMapItemService.getWildCardPatternChild(elements[position], checkedSiteMapItems)) != null && !s.isMarkedDeleted()) { String parameter = getStrippedParameter((HstSiteMapItemService)s, elements[position]); params.put(String.valueOf(params.size()+1), parameter); return traverseInToSiteMapItem(s, params, ++position, elements, checkedSiteMapItems); } else if( (s = hstSiteMapItemService.getChild(WILDCARD)) != null && !checkedSiteMapItems.contains(s) && !s.isMarkedDeleted()) { params.put(String.valueOf(params.size()+1), elements[position]); return traverseInToSiteMapItem(s, params, ++position, elements, checkedSiteMapItems); } else if( (s = hstSiteMapItemService.getAnyPatternChild(elements, position, checkedSiteMapItems)) != null && !s.isMarkedDeleted()) { StringBuffer remainder = new StringBuffer(elements[position]); while(++position < elements.length) { return s; else if(hstSiteMapItemService.getChild(ANY) != null && !hstSiteMapItemService.getChild(ANY).isMarkedDeleted()) { StringBuffer remainder = new StringBuffer(elements[position]); while(++position < elements.length) { return hstSiteMapItem.getChild(ANY);
/** * @param siteMapItem * @return String representation of the path */ public static String getPath(HstSiteMapItem siteMapItem) { StringBuffer path = new StringBuffer(siteMapItem.getValue()); while (siteMapItem.getParentItem() != null) { siteMapItem = siteMapItem.getParentItem(); path.insert(0, "/").insert(0, siteMapItem.getValue()); } return path.toString(); }
private void populateDescendants(HstSiteMapItem hstSiteMapItem) { siteMapDescendants.put(hstSiteMapItem.getId(), hstSiteMapItem); for(HstSiteMapItem child : hstSiteMapItem.getChildren()) { populateDescendants(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); } }
applicationId = StringPool.get(node.getValueProvider().getString(SITEMAPITEM_PROPERTY_APPLICATION_ID)); } else if (parentItem != null) { applicationId = parentItem.getApplicationId(); if(parentItem == null || parentItem.getRelativeContentPath() == null) { log.error("Cannot use '{}' for a sitemap item that does not have a parent or a parent without relative content path. Used at: '{}'", PARENT_PROPERTY_PLACEHOLDER, id); } else { relativeContentPath = relativeContentPath.replace(PARENT_PROPERTY_PLACEHOLDER, parentItem.getRelativeContentPath()); locale = node.getValueProvider().getString(GENERAL_PROPERTY_LOCALE); } else if(parentItem != null){ locale = parentItem.getLocale(); } else { locale = mountSiteMapConfiguration.getLocale(); authenticated = node.getValueProvider().getBoolean(SITEMAPITEM_PROPERTY_AUTHENTICATED); } else if(this.parentItem != null){ authenticated = parentItem.isAuthenticated(); CollectionUtils.addAll(this.roles, rolesProp); } else if (this.parentItem != null){ roles = new HashSet<>(parentItem.getRoles()); } else { roles = new HashSet<>(0); CollectionUtils.addAll(this.users, usersProp); } else if (parentItem != null){ users = new HashSet<>(parentItem.getUsers()); } else {
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); } }
!WEB_FILE_NAMED_PIPELINE_NAME.equals(webFileSiteMapItem.getNamedPipeline())){ log.warn("Cannot create web file link for site '{}' because it does not have a sitemap " + "that contains a sitemap item with properties '{} = {}' and '{} = {}'", StringBuilder webFilesPrefix = new StringBuilder("/"); while (current != null) { if (current.containsAny() || current.containsWildCard() || current.isAny() || current.isWildCard()) { log.warn("Cannot create web file link for site '{}' because the sitemap item " + "for the web file '{}' contains wildcards (or one of its parents).", hstSite.getConfigurationPath(), webFileSiteMapItem.getQualifiedId()); return EVAL_PAGE; webFilesPrefix.insert(0, current.getValue()).insert(0, "/"); current = current.getParentItem();
/** * Create a HstLinkResolver instance with the current context <code>resolvedSiteMapItem</code>. The {@link HstSite} is taken from this context * @param node * @param resolvedSiteMapItem */ HstLinkResolver(Node node, ResolvedSiteMapItem resolvedSiteMapItem){ this.node = node; this.resolvedSiteMapItem = resolvedSiteMapItem; HstSiteMap hstSiteMap = resolvedSiteMapItem.getHstSiteMapItem().getHstSiteMap(); hstSite = (HstSiteService)hstSiteMap.getSite(); }
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); if (siteMapItem.getComponentConfigurationId() != null && siteMapItem.isExplicitPath()) { final HstComponentConfiguration cc = configuration.getComponentConfiguration(siteMapItem.getComponentConfigurationId()); if (cc == null) { log.warn("'{}' for site '{}' contains unresolvable hst:componentconfigurationid '{}'.", siteMapItem, siteMapItem.getHstSiteMap().getSite().getName(), siteMapItem.getComponentConfigurationId()); } else { for (Map.Entry<String, String> param : siteMapItem.getParameters().entrySet()) { if (param.getKey() == null || param.getValue() == null) { if (StringUtils.isNotEmpty(normalizedParsedDocumentPath)) { log.debug("Adding document path '{}' from page to location map for sitemap item '{}'", normalizedParsedDocumentPath, siteMapItem.getQualifiedId()); addSiteMapItem(normalizedParsedDocumentPath.split("/"), siteMapItem); for (HstSiteMapItem child : siteMapItem.getChildren()) { add2LocationMap(child, configuration, mountContentPath, classLoader);
private void resolveComponentConfiguration() { // check whether there is a more specific mapping String componentConfigurationId = resolveMappedConponentConfigurationId(); HstSite hstSite = hstSiteMapItem.getHstSiteMap().getSite(); if (componentConfigurationId == null && hstSiteMapItem.getComponentConfigurationId() == null) { log.debug("The ResolvedSiteMapItemImpl does not have a component configuration id because the sitemap item '{}' does not have one", hstSiteMapItem.getId()); } else { if (componentConfigurationId == null) { log.debug("No mapped component configuration id, getting the default componentconfiguration id"); componentConfigurationId = hstSiteMapItem.getComponentConfigurationId(); } if (componentConfigurationId != null) { final String resolvedComponentConfigurationId = (String)pp.resolveProperty("componentConfigurationId", componentConfigurationId); hstComponentConfiguration = hstSite.getComponentsConfiguration().getComponentConfiguration(resolvedComponentConfigurationId); if (hstComponentConfiguration == null) { log.warn("ResolvedSiteMapItemImpl cannot be created correctly, because the component configuration id {} cannot be found.", componentConfigurationId); } } } isComponentResolved = true; }
private String getSiteMapItemPath(final HstSiteMapItem matchedSiteMapItem) { String path = matchedSiteMapItem.getId(); path = path.replace(WILDCARD, "*"); path = path.replace(ANY, "**"); return path; }
final String homePagePathInfo, final String previewConfigurationPath) { if (!siteMapItem.isExplicitElement()) { return; if (INDEX.equals(siteMapItem.getValue())) { log.debug("Skip '{}' from page overview because '{}' items do not need to be shown as pages since the " + "parent item shows the same page", siteMapItem, INDEX); return; if (siteMapItem.isContainerResource() || siteMapItem.isHiddenInChannelManager()) { log.debug("Skip '{}' from page overview because represents container resource or is marked " + "explicitly to be hidden in channel manager", siteMapItem); siteMapPageRepresentation.represent(siteMapItem, parent.getId(), mount, homePagePathInfo, previewConfigurationPath); for (HstSiteMapItem child : siteMapItem.getChildren()) { addPages(child, siteMapPageRepresentation, homePagePathInfo, previewConfigurationPath);
public void addSiteMapItem(String unresolvedPath, HstSiteMapItem hstSiteMapItem){ if(unresolvedPath == null) { log.debug("HstSiteMapItem '{}' will not be used for linkrewriting as it has an empty relative content path.", hstSiteMapItem.getId()); return; if(hstSiteMapItem.isExcludedForLinkRewriting()){ log.debug("HstSiteMapItem '{}' will not be used for linkrewriting as is configured to be excluded for linkrewriting.", hstSiteMapItem.getId()); return; HstSiteMapItem parent = hstSiteMapItem.getParentItem(); while(parent != null) { ancestorItems.add(parent); parent = parent.getParentItem(); String propertyPlaceHolder = PropertyParser.DEFAULT_PLACEHOLDER_PREFIX + ((String)param) + PropertyParser.DEFAULT_PLACEHOLDER_SUFFIX; if(!unresolvedPath.contains(propertyPlaceHolder)) { log.debug("The SiteMapItem with id '{}' and relative content path '{}' can only be used in a context aware link rewriting", hstSiteMapItem.getId(), hstSiteMapItem.getRelativeContentPath()); ((HstSiteMapItemService)hstSiteMapItem).setUseableInRightContextOnly(true); log.warn("Unable to translate relative content path : '{}' because the wildcards in sitemap item path ('{}') does not match the property placeholders in the relative content path. We skip this path for linkrewriting", unresolvedPath, hstSiteMapItem.getId()); return;
HstSiteMapItem parent = siteMapItem.getParentItem(); while (parent != null) { ancestorItems.add(parent); parent = parent.getParentItem(); if (!siteMapItem.isExplicitPath()) { int index = ancestorItems.size(); while (index-- != 0) { if(!unresolvedPath.contains(propertyPlaceHolder)) { log.debug("The SiteMapItem with id '{}' and relative content path '{}' can only be used in a context aware link rewriting", siteMapItem.getId(), siteMapItem.getRelativeContentPath()); ((HstSiteMapItemService)siteMapItem).setUseableInRightContextOnly(true);
public SiteMapPageRepresentation represent(final HstSiteMapItem item, final String parentId, final String mountPath, final String homePagePathInfo, final String previewConfigurationPath) throws IllegalArgumentException { id = ((CanonicalInfo)item).getCanonicalIdentifier(); this.parentId = parentId; name = NodeNameCodec.decode(item.getValue()); pageTitle = item.getPageTitle(); pathInfo = HstSiteMapUtils.getPath(item, null); if (pathInfo.equals(homePagePathInfo)) { pathInfo = "/"; renderPathInfo = mountPath; } else { if (pathInfo.startsWith("/")){ renderPathInfo = mountPath + pathInfo; } else { renderPathInfo = mountPath + "/" + pathInfo; } } componentConfigurationId = item.getComponentConfigurationId(); workspaceConfiguration = ((CanonicalInfo) item).isWorkspaceConfiguration(); inherited = !((CanonicalInfo) item).getCanonicalPath().startsWith(previewConfigurationPath + "/"); relativeContentPath = item.getRelativeContentPath(); return this; }
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); } }
if(hstSiteMapItem.isWildCard()) { if( (s = hstSiteMapItem.getChild(WILDCARD)) != null && !checkedSiteMapItems.contains(s)){ return traverseInToSiteMapItem(hstSiteMapItem, params, position, elements, checkedSiteMapItems); } else if( (s = hstSiteMapItemService.getWildCardPatternChild(elements[position], checkedSiteMapItems)) != null && !checkedSiteMapItems.contains(s)) { return traverseInToSiteMapItem(hstSiteMapItem, params, position, elements, checkedSiteMapItems); }else if(hstSiteMapItem.getChild(ANY) != null) { return traverseInToSiteMapItem(hstSiteMapItem, params,position, elements, checkedSiteMapItems); } else if( (s = hstSiteMapItemService.getAnyPatternChild(elements, position, checkedSiteMapItems)) != null && !checkedSiteMapItems.contains(s)) { return traverseUp(hstSiteMapItem.getParentItem(),params, --position, elements, checkedSiteMapItems ); } else if( (s = hstSiteMapItem.getChild(WILDCARD)) != null && !checkedSiteMapItems.contains(s)){ return traverseInToSiteMapItem(hstSiteMapItem, params, position, elements, checkedSiteMapItems); } else if( (s = hstSiteMapItemService.getWildCardPatternChild(elements[position], checkedSiteMapItems)) != null && !checkedSiteMapItems.contains(s)) { return traverseInToSiteMapItem(hstSiteMapItem, params, position, elements, checkedSiteMapItems); } else if(hstSiteMapItem.getChild(ANY) != null ){ return traverseInToSiteMapItem(hstSiteMapItem, params,position, elements, checkedSiteMapItems); } else if( (s = hstSiteMapItemService.getAnyPatternChild(elements, position, checkedSiteMapItems)) != null && !checkedSiteMapItems.contains(s)) { return traverseInToSiteMapItem(hstSiteMapItem, params, position, elements, checkedSiteMapItems); } else { return traverseUp(hstSiteMapItem.getParentItem(),params, --position, elements, checkedSiteMapItems );
public static AbstractTreePickerRepresentation representExpandedParentTree(final PageComposerContextService pageComposerContextService, final HstSiteMapItem expandToItem) { List<HstSiteMapItem> expansionList = new ArrayList<>(); expansionList.add(expandToItem); HstSiteMapItem parent = expandToItem.getParentItem(); while(parent != null) { expansionList.add(0, parent); parent = parent.getParentItem(); } return new SiteMapTreePickerRepresentation().represent(pageComposerContextService, expandToItem.getHstSiteMap(), expansionList); }