private HstSiteMapItem validateAndReturnSiteMapItem(final String siteMapItemUUId, final Mount targetMount) { HstSiteMapItem hstSiteMapItem = getConfigObject(siteMapItemUUId, targetMount); if (hstSiteMapItem == null) { String message = String.format("Cannot copy because there is no siteMapItem for id '%s'.", siteMapItemUUId); throw new ClientException(message, ClientError.ITEM_CANNOT_BE_CLONED, Collections.singletonMap("errorReason", message)); } String pathInfo = HstSiteMapUtils.getPath(hstSiteMapItem); if (pathInfo.contains(HstNodeTypes.WILDCARD) || pathInfo.contains(HstNodeTypes.ANY)) { String message = String.format("Cannot copy a page for siteMapItem '%s' because it contains " + "wildcards and this is not supported.", ((CanonicalInfo)hstSiteMapItem).getCanonicalPath()); throw new ClientException(message, ClientError.ITEM_CANNOT_BE_CLONED, Collections.singletonMap("errorReason", message)); } return hstSiteMapItem; }
public HstLink create(HstSiteMapItem toHstSiteMapItem, Mount mount) { return postProcess(new HstLinkImpl(HstSiteMapUtils.getPath(toHstSiteMapItem), mount)); }
private boolean isInvisibleItem(final HstSiteMapItem item, final String pageNotFound) { if (!item.isExplicitPath() || item.isContainerResource() || item.isHiddenInChannelManager()) { return true; } if (HstSiteMapUtils.getPath(item, null).equals(pageNotFound)) { return true; } return false; }
public SiteMenuItemLink(HstSiteMenuItemConfiguration item, Mount mount) { final String externalLink = item.getExternalLink(); final String siteMapItemPath = item.getSiteMapItemPath(); mountPath = mount.getMountPath(); if (externalLink != null && siteMapItemPath == null) { link = externalLink; linkType = LinkType.EXTERNAL; pathInfo = link; } else if (siteMapItemPath != null && externalLink == null) { final String path = HstSiteMapUtils.getPath(mount, siteMapItemPath); link = siteMapItemPath; linkType = LinkType.SITEMAPITEM; pathInfo = path; } else { link = null; linkType = LinkType.NONE; pathInfo = null; } }
private HstLinkImpl(final String path, final Mount mount, final HstSiteMapItem siteMapItem, final Type type, boolean rewriteHomePagePath) { if (path != null && path.startsWith("//")) { // fully qualified path this.path = "//" + PathUtils.normalizePath(path); } else { this.path = PathUtils.normalizePath(path); } this.mount = mount; if (siteMapItem != null) { this.siteMapItem = Optional.of(siteMapItem); } this.type = type; if (type == Type.UNKNOWN && mount != null) { if (mount.getVirtualHost().getVirtualHosts().isHstFilterExcludedPath("/" + path)) { this.type = Type.CONTAINER_RESOURCE; } } if (rewriteHomePagePath) { // check whether path is equal to homepage : if so, replace with "" if (this.path != null && mount != null) { // get the homePagePath : the mount.getHomePage can be the homepage path OR the sitemap item refId // with HstSiteMapUtils.getPath we get the homepage path regardless whether mount.getHomePage() is the path of the refId String homePagePath = HstSiteMapUtils.getPath(mount, mount.getHomePage()); if (path.equals(homePagePath) || ("/" + path).equals(homePagePath)) { // homepage link : Set path to ""; this.path = ""; } } } }
Location findParentLocation(final Mount mount, final HstSiteMapItem item) { String prefix = mount.getVirtualHost().getHostName(); if (StringUtils.isNotEmpty(mount.getMountPath())) { prefix += mount.getMountPath(); } if (item.getParentItem() == null) { return new Location(prefix + "/", null); } else { pathInfo = HstSiteMapUtils.getPath(item.getParentItem(), null); if (pathInfo.equals(HstSiteMapUtils.getPath(mount, mount.getHomePage()))) { pathInfo = "/"; } else if (!pathInfo.startsWith("/")) { pathInfo = "/" + pathInfo; } return new Location(prefix + pathInfo + "/", ((CanonicalInfo) item.getParentItem()).getCanonicalIdentifier()); } }
if(!resolverProperties.virtual && nodePath.equals(tryMount.getContentPath())) { String pathInfo = HstSiteMapUtils.getPath(tryMount, tryMount.getHomePage()); if (pathInfo != null) { hstLinkList.add(new HstLinkImpl(pathInfo, tryMount, false)); String pathInfo = HstSiteMapUtils.getPath(tryMount, tryMount.getHomePage()); if (pathInfo != null) { hstLinkList.add(new HstLinkImpl(pathInfo, tryMount, false));
public SiteMapPagesRepresentation represent(final HstSiteMap siteMap, final Mount mount, final String previewConfigurationPath) throws IllegalArgumentException { id = ((CanonicalInfo)siteMap).getCanonicalIdentifier(); host = mount.getVirtualHost().getHostName(); this.mount = mount.getMountPath(); final String homePagePathInfo = HstSiteMapUtils.getPath(mount, mount.getHomePage()); for (HstSiteMapItem child : siteMap.getSiteMapItems()) { addPages(child, null, homePagePathInfo, previewConfigurationPath); } Collections.sort(pages, (o1, o2) -> o1.getPathInfo().compareTo(o2.getPathInfo())); // move homepage to first location return this; }
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; }
if(!resolverProperties.virtual && nodePath.equals(tryMount.getContentPath())) { String pathInfo = HstSiteMapUtils.getPath(tryMount, tryMount.getHomePage()); return pathInfo == null ? null : new HstLinkImpl(pathInfo, tryMount, false); } else if(!resolverProperties.virtual && nodePath.startsWith(tryMount.getContentPath() + "/")) { } else if (resolverProperties.virtual && nodePath.equals(tryMount.getContentPath())) { String pathInfo = HstSiteMapUtils.getPath(tryMount, tryMount.getHomePage()); return pathInfo == null ? null : new HstLinkImpl(pathInfo, tryMount, false); } else if (resolverProperties.virtual && nodePath.startsWith(tryMount.getContentPath() + "/")) {
siteMapPathInfo = HstSiteMapUtils.getPath(siteMapItemByRefId); } else { siteMapPathInfo = siteMapItemRefIdOrPath;
siteMapPathInfo = HstSiteMapUtils.getPath(mount, mount.getHomePage()); if(siteMapPathInfo == null || "".equals(siteMapPathInfo) || "/".equals(siteMapPathInfo)) { log.warn("Mount '{}' for host '{}' does not have a homepage configured and the path info is empty. Cannot map to sitemap item. Return null", } catch(NotFoundException e){ log.debug("Cannot match '{}'. Try getting the pagenotfound", siteMapPathInfo); String pageNotFound = HstSiteMapUtils.getPath(mount, mount.getPageNotFound()); if(pageNotFound == null) { throw new MatchException("There is no pagenotfound configured for '"+mount.getName()+"'");
id = ((CanonicalInfo) item).getCanonicalIdentifier(); this.pathInfo = HstSiteMapUtils.getPath(item, null); final String homePagePathInfo = HstSiteMapUtils.getPath(mount, mount.getHomePage()); if (this.pathInfo.equals(homePagePathInfo)) { this.pathInfo = "/"; parentPathInfo = HstSiteMapUtils.getPath(item.getParentItem(), null);
if (StringUtils.isEmpty(hstLink.getPath())) { setPathInfo(HstSiteMapUtils.getPath(editingMount, editingMount.getHomePage())); } else { setPathInfo(hstLink.getPath());
new String[] { mountAlias, mountType, path }); Mount requestedMount = reqContext.getResolvedMount().getMount(); link = reqContext.getHstLinkCreator().create(HstSiteMapUtils.getPath(requestedMount, requestedMount.getPageNotFound()), requestedMount);
hstSiteMapItemPath = HstSiteMapUtils.getPath(siteMapItemByRefId);
setPathInfo(HstSiteMapUtils.getPath(hstSiteMapItem, null)); Collections.sort(getItems(), comparator); return this;