@Override public String toString() { return "HstSiteMapItemService{" + "canonicalPath='" + canonicalPath + '\'' + ", site=" + hstSiteMap.getSite() + '}'; } }
private static HstSiteMapItem getHstSiteMapItem(final String siteMapItemRefIdOrPath, final PageComposerContextService service) { if (StringUtils.isEmpty(siteMapItemRefIdOrPath)) { return null; } final HstSite site = service.getEditingPreviewSite(); final HstSiteMap siteMap = site.getSiteMap(); HstSiteMapItem item = siteMap.getSiteMapItem(siteMapItemRefIdOrPath); if (item == null) { item = siteMap.getSiteMapItemById(siteMapItemRefIdOrPath); } if (item == null){ item = siteMap.getSiteMapItemByRefId(siteMapItemRefIdOrPath); } return item; }
private void checkAndLogAccessibleRootComponents(final HstComponentsConfiguration hstComponentsConfiguration, final HstSiteMap sm) { for(HstSiteMapItem hstSiteMapItem : sm.getSiteMapItems()){ sanitizeSiteMapItem(hstSiteMapItem, hstComponentsConfiguration); } }
private void validateTarget(final Session session, final String target, final HstSiteMap siteMap) throws RepositoryException { String msg = String.format("Unexpected sitemap for site '%s' because not an instanceof CanonicalInfo", siteMap.getSite().getName()); throw new ClientException(msg, ClientError.UNKNOWN); HstSiteMapItem siteMapItem = siteMap.getSiteMapItem(elements[0]); for (int i = 1; i < elements.length ; i++ ) { if (siteMapItem == null) {
private AbstractTreePickerRepresentation represent(final PageComposerContextService pageComposerContextService, final HstSiteMap hstSiteMap, final List<HstSiteMapItem> expansionList) { if (!(hstSiteMap instanceof CanonicalInfo)) { throw new ClientException(String.format("hstSiteMap '%s' expected to be of type '%s'", hstSiteMap, CanonicalInfo.class), ClientError.UNKNOWN); } setPickerType(PickerType.PAGES.getName()); setId(((CanonicalInfo) hstSiteMap).getCanonicalIdentifier()); setType(Type.PAGE.getName()); setNodeName(hstSiteMap.getSite().getName()); setDisplayName(hstSiteMap.getSite().getName()); setNodePath(((CanonicalInfo) hstSiteMap).getCanonicalPath()); setCollapsed(false); setExpandable(true); setSelectable(false); final String pageNotFound = pageComposerContextService.getEditingMount().getPageNotFound(); for (HstSiteMapItem child : hstSiteMap.getSiteMapItems()) { if (isInvisibleItem(child, pageNotFound)) { continue; } setLeaf(false); AbstractTreePickerRepresentation childRepresentation = loadItemRepresentation(pageComposerContextService, expansionList, child); getItems().add(childRepresentation); } Collections.sort(getItems(), comparator); return this; }
public HstLink createByRefId(String siteMapItemRefId, Mount mount) { if(mount.getHstSite() == null) { log.info("Cannot create a link to a siteMapItemRefId '{}' for a mount '{}' that does not have a HstSiteMap. Return null", siteMapItemRefId, mount.getName()); return null; } HstSiteMapItem siteMapItem = mount.getHstSite().getSiteMap().getSiteMapItemByRefId(siteMapItemRefId); if(siteMapItem == null) { log.info("Could not find HstSiteMapItem for siteMapItemRefId '{}' and mount '{}'. Return null", siteMapItemRefId, mount.getName()); return null; } return create(siteMapItem, mount); }
HstSiteMapItem hstSiteMapItem = hstSite.getSiteMap().getSiteMapItem(elements[0]); params.clear(); for(HstSiteMapItem item : hstSite.getSiteMap().getSiteMapItems()) { HstSiteMapItemService service = (HstSiteMapItemService)item; if(service.containsWildCard() && service.patternMatch(elements[0], service.getPrefix(), service.getPostfix())) { params.clear(); hstSiteMapItem = hstSite.getSiteMap().getSiteMapItem(WILDCARD); if(hstSiteMapItem != null) { params.put(String.valueOf(params.size()+1), elements[0]); params.clear(); for(HstSiteMapItem item : hstSite.getSiteMap().getSiteMapItems()) { HstSiteMapItemService service = (HstSiteMapItemService)item; if(service.containsAny() && service.patternMatch(pathInfo, service.getPrefix(), service.getPostfix())) { params.clear(); HstSiteMapItem hstSiteMapItemAny = hstSite.getSiteMap().getSiteMapItem(ANY); if(hstSiteMapItemAny == null) { log.warn("Did not find a matching sitemap item for path '{}', SiteMount '{}' and Host '"+resolvedSiteMount.getResolvedVirtualHost().getResolvedHostName()+"'" +
public HstLink create(HstSite hstSite, String toSiteMapItemId) { HstSiteMapItem siteMapItem = hstSite.getSiteMap().getSiteMapItemById(toSiteMapItemId); if (siteMapItem == null) { if (log.isWarnEnabled()) { log.warn("No sitemap item found for id '{}' within Site '{}'. Cannot create link.", toSiteMapItemId, hstSite.getName()); } return null; } return postProcess(new HstLinkImpl(getPath(siteMapItem), hstSite)); }
final HstSiteMapItem siteMapItemByRefId = resolvedMount.getMount().getHstSite().getSiteMap().getSiteMapItemByRefId(siteMapItemRefIdOrPath); if (siteMapItemByRefId != null) { siteMapPathInfo = HstSiteMapUtils.getPath(siteMapItemByRefId);
HstSiteMapItem hstSiteMapItem = siteMap.getSiteMapItem(elements[0]); params.clear(); for(HstSiteMapItem item : siteMap.getSiteMapItems()) { if (item.isMarkedDeleted()) { continue; params.clear(); hstSiteMapItem = siteMap.getSiteMapItem(WILDCARD); if(hstSiteMapItem != null && !hstSiteMapItem.isMarkedDeleted()) { params.put(String.valueOf(params.size()+1), elements[0]); params.clear(); for(HstSiteMapItem item : siteMap.getSiteMapItems()) { if (item.isMarkedDeleted()) { continue; params.clear(); HstSiteMapItem hstSiteMapItemAny = siteMap.getSiteMapItem(ANY); if(hstSiteMapItemAny == null || hstSiteMapItemAny.isMarkedDeleted()) { log.info("Did not find a matching sitemap item for path '{}', Mount '{}' and Host '"+resolvedMount.getMount().getVirtualHost().getHostName()+"'" +
log.warn("preferItemId attr is added, but also 'preferItemByPath' or 'siteMapItem'. This is double. Skipping preferItemId attr"); } else { siteMapItem = hstRequest.getRequestContext().getResolvedSiteMapItem().getHstSiteMapItem().getHstSiteMap().getSiteMapItemById(preferItemId); if(siteMapItem == null) { log.warn("Cannot find sitemap item with id '{}' for site '{}'", preferItemId, resolvedSiteMount.getSiteMount().getName());
/** * 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(); }
final HstSiteMapItem webFileSiteMapItem = hstSite.getSiteMap().getSiteMapItemByRefId(WEB_FILES_SITEMAP_ITEM_ID);
public static final void view(StringBuffer buf, String indent, HstSiteMap hstSiteMap) { if(hstSiteMap == null) { buf.append("\n").append(indent).append("+HstSiteMap: null"); return; } buf.append("\n").append(indent).append("+HstSiteMap: (").append(hstSiteMap.hashCode()).append(")"); for(HstSiteMapItem siteMapItem : hstSiteMap.getSiteMapItems()) { view(buf, indent+SMALL_INDENT, siteMapItem); } }
/** * Get the HST Site object from request. */ protected HstSite getHstSite(final HstRequest request){ return request.getRequestContext().getResolvedSiteMapItem().getHstSiteMapItem().getHstSiteMap().getSite(); }
log.warn("preferItemId attr is added, but also 'preferItemByPath' or 'siteMapItem'. This is double. Skipping preferItemId attr"); } else { siteMapItem = requestContext.getResolvedSiteMapItem().getHstSiteMapItem().getHstSiteMap().getSiteMapItemByRefId(preferItemId); if(siteMapItem == null) { log.warn("Cannot find sitemap item with id '{}' for site '{}'", preferItemId, resolvedMount.getMount().getName());
/** * @throws ClientException if not found */ public static HstSiteMapItem getSiteMapItem(HstSiteMap siteMap, String siteMapItemId) { for (HstSiteMapItem hstSiteMapItem : siteMap.getSiteMapItems()) { final HstSiteMapItem siteMapItem = getSiteMapItem(hstSiteMapItem, siteMapItemId); if (siteMapItem != null) { return siteMapItem; } } final String message = String.format("SiteMap item with id '%s' is not part of currently edited preview site.", siteMapItemId); throw new ClientException(message, ClientError.ITEM_NOT_IN_PREVIEW); }
public HstSiteMenusImpl(HstRequestContext hstRequestContext) { // find currently selected hstSiteMenuItemConfiguration's HstSiteMapItem selectedSiteMapItem = hstRequestContext.getResolvedSiteMapItem().getHstSiteMapItem(); HstSiteMenusConfiguration siteMenusConfiguration = selectedSiteMapItem.getHstSiteMap().getSite().getSiteMenusConfiguration(); if(siteMenusConfiguration != null) { for(HstSiteMenuConfiguration siteMenuConfiguration : siteMenusConfiguration.getSiteMenuConfigurations().values()) { HstSiteMenuImpl siteMenu = new HstSiteMenuImpl(this, siteMenuConfiguration, hstRequestContext); siteMenus.put(siteMenu.getName(), siteMenu); } } }
final HstSiteMapItem pagenotfound = siteMap.getSiteMapItemByRefId(PAGE_NOT_FOUND); if (pagenotfound != null) { String link = pagenotfound.getValue();
@Override public boolean containsMultipleSchemes() { if (containsMultipleSchemes != null) { return containsMultipleSchemes.booleanValue(); } synchronized (this) { if (containsMultipleSchemes != null) { return containsMultipleSchemes.booleanValue(); } if (hstSite == null) { containsMultipleSchemes = Boolean.FALSE; return false; } containsMultipleSchemes = multipleSchemesUsed(hstSite.getSiteMap().getSiteMapItems()); return containsMultipleSchemes.booleanValue(); } }