private HippoBean getBeanForResolvedSiteMapItem(ResolvedSiteMapItem resolvedSiteMapItem) { String base = getSiteContentBasePath(); String relPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); if (relPath == null) { log.debug("Cannot return a content bean for relative path null for resolvedSitemapItem belonging to '{}'. Return null", resolvedSiteMapItem.getHstSiteMapItem().getId()); return null; } return getHippoBean(base, relPath); }
protected HippoFacetNavigationBean getFacetNavigationBean(final HstRequestContext context, String path, String query) { if (Strings.isNullOrEmpty(path)) { log.warn("Facetpath was empty {}", path); return null; } ResolvedSiteMapItem resolvedSiteMapItem = context.getResolvedSiteMapItem(); String resolvedContentPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); String parsedQuery = cleanupSearchQuery(query); HippoFacetNavigationBean facNavBean; if (!StringUtils.isBlank(resolvedContentPath) && !resolvedContentPath.startsWith("/") && context.getSiteContentBaseBean().getBean(resolvedContentPath, HippoFacetNavigationBean.class) != null) { facNavBean = ContentBeanUtils.getFacetNavigationBean(resolvedContentPath, parsedQuery); } else { facNavBean = ContentBeanUtils.getFacetNavigationBean(path, parsedQuery); } return facNavBean; } }
/** * @see {@link #getFacetNavigationBean(String, String, String)} with <code>absBasePath</code> as "/"+ requestContext.getSiteContentBasePath() and * <code>relPath </code> as requestContext.getResolvedSiteMapItem().getRelativeContentPath() */ public static HippoFacetNavigationBean getFacetNavigationBean(String query) throws HstComponentException { final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext == null) { throw new HstComponentException("Cannot call #getFacetNavigationBean without HstRequestContext"); } ResolvedSiteMapItem resolvedSiteMapItem = requestContext.getResolvedSiteMapItem(); String relPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); return getFacetNavigationBean(relPath, query); }
/** * Return a <code>HippoBean</code> when it can be found for the relativeContentPath for the <code>{@link ResolvedSiteMapItem}</code>. If there is no * relativeContentPath available in the <code>{@link ResolvedSiteMapItem}</code>, or when the relativeContentPath does not point to an existing jcr node, * <code>null</code> will be returned * @param request * @param resolvedSiteMapItem * @return A <code>HippoBean</code> or <code>null</code> when there cannot be created a content bean for this resolvedSiteMapItem */ public HippoBean getBeanForResolvedSiteMapItem(HstRequest request, ResolvedSiteMapItem resolvedSiteMapItem) { String base = getSiteContentBasePath(request); String relPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); if(relPath == null) { log.debug("Cannot return a content bean for relative path null for resolvedSitemapItem belonging to '{}'. Return null", resolvedSiteMapItem.getHstSiteMapItem().getId()); return null; } try { if("".equals(relPath)) { return (HippoBean) getObjectBeanManager(request).getObject("/"+base); } else { return (HippoBean) getObjectBeanManager(request).getObject("/"+base+ "/" + relPath); } } catch (ObjectBeanManagerException e) { log.error("ObjectBeanManagerException. Return null : {}", e); } return null; }
/** * Return a <code>HippoBean</code> when it can be found for the relativeContentPath for the <code>{@link ResolvedSiteMapItem}</code>. If there is no * relativeContentPath available in the <code>{@link ResolvedSiteMapItem}</code>, or when the relativeContentPath does not point to an existing jcr node, * <code>null</code> will be returned * @param request * @param resolvedSiteMapItem * @return A <code>HippoBean</code> or <code>null</code> when there cannot be created a content bean for this resolvedSiteMapItem */ public HippoBean getBeanForResolvedSiteMapItem(HstRequest request, ResolvedSiteMapItem resolvedSiteMapItem) { final HstRequestContext requestContext = request.getRequestContext(); String base = requestContext.getSiteContentBasePath(); String relPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); if(relPath == null) { log.debug("Cannot return a content bean for relative path null for resolvedSitemapItem belonging to '{}'. Return null", resolvedSiteMapItem.getHstSiteMapItem().getId()); return null; } try { if("".equals(relPath)) { return (HippoBean) requestContext.getObjectBeanManager().getObject("/"+base); } else { return (HippoBean) requestContext.getObjectBeanManager().getObject("/"+base+ "/" + relPath); } } catch (ObjectBeanManagerException e) { log.error("ObjectBeanManagerException. Return null : {}", e); } return null; }
/** * Tries to return a bean that is located in a faceted navigation tree below a result set. When it cannot be found, * or the bean is not of type <code>beanMappingClass</code>, <code>null</code> will be returned. * * @param <T> * @param query the free text search as String that is used for this faceted navigation * @param beanMappingClass the class T must be of * @return The faceted navigation result document of type T and <code>null</code> if it cannot be found or is not of type <code>T</code> */ public static <T extends HippoBean> T getFacetedNavigationResultDocument(String query, Class<T> beanMappingClass) { final HstRequestContext requestContext = RequestContextProvider.get(); if (requestContext == null) { throw new HstComponentException("Cannot call #getFacetNavigationBean without HstRequestContext"); } ResolvedSiteMapItem resolvedSiteMapItem = requestContext.getResolvedSiteMapItem(); String relPath = PathUtils.normalizePath(resolvedSiteMapItem.getRelativeContentPath()); return getFacetedNavigationResultDocument(query, relPath, beanMappingClass); }
final WebFileBundle webFileBundle = service.getJcrWebFileBundle(session, bundleName); final String relativeContentPath = requestContext.getResolvedSiteMapItem().getRelativeContentPath();
if (StringUtils.isEmpty(resolvedSiteMapItem.getRelativeContentPath())) { final String selectedPath = contentRootPath + "/" + resolvedSiteMapItem.getRelativeContentPath(); final ExpandedNodeHierarchy expandedNodeHierarchy = createExpandedNodeHierarchy(jcrSession, contentRootPath, Collections.singletonList(selectedPath));