/** * @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(); }
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); }
public static String getPath(HstSiteMapItem siteMapItem, String relPath) { StringBuffer path = new StringBuffer(siteMapItem.getValue()); while (siteMapItem.getParentItem() != null) { siteMapItem = siteMapItem.getParentItem(); path.insert(0, "/").insert(0, siteMapItem.getValue()); } if(relPath == null) { return path.toString(); } if(relPath.startsWith("/")) { path.append(relPath); } else { path.append("/").append(relPath); } return path.toString(); }
/** * @return the parent of {@code r} and if {@code r} does not have a parent, return null */ private ResolvedLocationMapTreeItemImpl getResolvedParent(final ResolvedLocationMapTreeItem r) { if (r.getSiteMapItem().getParentItem() == null || !r.getPath().contains("/")) { return null; } return new ResolvedLocationMapTreeItemImpl(StringUtils.substringBeforeLast(r.getPath(), "/"), r.getSiteMapItem().getParentItem(), false); }
while(current.getParentItem() != null) { current = current.getParentItem(); depth++; if(current == this.resolvedSiteMapItem.getHstSiteMapItem()) { HstSiteMapItem current = siteMapItem; List<HstSiteMapItem> parentList = new ArrayList<HstSiteMapItem>(); while(current.getParentItem() != null) { current = current.getParentItem(); parentList.add(current); while(checkForCommonAncestor.getParentItem() != null && commonAncestorMap.size() == 0) { checkForCommonAncestor = checkForCommonAncestor.getParentItem(); for(Entry<HstSiteMapItem, List<HstSiteMapItem>> entry : matchingMapWithParents.entrySet()) { if(entry.getValue().contains(checkForCommonAncestor)) {
while(current.getParentItem() != null) { current = current.getParentItem(); depth++; if(current == this.resolvedSiteMapItem.getHstSiteMapItem()) { HstSiteMapItem current = siteMapItem; List<HstSiteMapItem> parentList = new ArrayList<>(); while(current.getParentItem() != null) { current = current.getParentItem(); parentList.add(current); while(checkForCommonAncestor.getParentItem() != null && commonAncestorMap.size() == 0) { checkForCommonAncestor = checkForCommonAncestor.getParentItem(); for(Entry<HstSiteMapItem, List<HstSiteMapItem>> entry : matchingMapWithParents.entrySet()) { if(entry.getValue().contains(checkForCommonAncestor)) {
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()); } }
@Override protected String getPathInfo() throws ClientException { String pathInfo = ""; if (siteMapItem != null) { if (parentId == null) { pathInfo = "/" + siteMapItem.getName(); } else { // Calling getConfigObject can throw a ClientException HstSiteMapItem parent = siteMapHelper.getConfigObject(parentId); while (parent != null) { pathInfo = parent.getValue() + "/" + pathInfo; parent = parent.getParentItem(); } if (!pathInfo.endsWith("/")) { pathInfo += "/"; } pathInfo = pathInfo + siteMapItem.getName(); } } return pathInfo; } }
HstSiteMapItem parent = siteMapItem.getParentItem(); while (parent != null) { ancestorItems.add(parent); parent = parent.getParentItem();
HstSiteMapItem parent = hstSiteMapItem.getParentItem(); while(parent != null) { ancestorItems.add(parent); parent = parent.getParentItem();
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); return traverseInToSiteMapItem(hstSiteMapItem, params, position, elements, checkedSiteMapItems); } else { return traverseUp(hstSiteMapItem.getParentItem(),params, --position, elements, checkedSiteMapItems );
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); return traverseInToSiteMapItem(hstSiteMapItem, params, position, elements, checkedSiteMapItems); } else { return traverseUp(hstSiteMapItem.getParentItem(),params, --position, elements, checkedSiteMapItems );
current = current.getParentItem();
if (item.getParentItem() != null) { parentId = ((CanonicalInfo) item.getParentItem()).getCanonicalIdentifier(); parentPathInfo = HstSiteMapUtils.getPath(item.getParentItem(), null);
final HstSiteMapItem existingParent = siteMapHelper.getConfigObject(siteMapItem.getId()).getParentItem(); if (existingParent == null || ((existingParent instanceof CanonicalInfo) && !((CanonicalInfo)existingParent).getCanonicalIdentifier().equals(siteMapItem.getParentId()))) {