public String getTitle() { if (StringUtils.isNotEmpty(title)) { return title; } else { return resource.getName(); } }
@Override public Object transform(Object input) { Resource item = (Resource)input; return getResourceInheritanceChainInternal(bucketNames, configName + "/" + item.getName(), paths.iterator(), resourceResolver); } });
@Override public boolean evaluate(Object object) { Resource resource = (Resource)object; return names.add(resource.getName()); } });
private Resource seek() { Resource result = null; while ( iter.hasNext() && result == null ) { final Resource c = iter.next(); if ( c.getName().startsWith(prefix) ) { result = c; } } return result; }
@Override public Iterable<Resource> filterChildResources(Iterable<Resource> childResources) { return StreamSupport .stream(childResources.spliterator(), false) .filter(r -> !IGNORED_NODE_NAMES.contains(r.getName())) .collect(Collectors.toList()); } }
/** * Returns the value of calling <code>getName</code> on the * {@link #getResource() wrapped resource}. * * @since 2.1.0 (Sling API Bundle 2.1.0) */ @Override public String getName() { return getResource().getName(); }
/** * Update all the static bindings related to a given resource * @param name name under which static bindings should be recorded * @param resource resource from which static bindings will be built */ public void updateStaticBindings(String name, Resource resource){ if (resource != null) { pathBindings.put(name, resource.getPath()); nameBindings.put(name, resource.getName()); } }
PageCompareDataLineImpl(Resource resource, String basePath, int depth) { this.path = resource.getPath().replace(basePath, ""); this.name = resource.getName(); this.value = null; this.depth = depth; }
@PostConstruct protected void setValues() { id = resource.getName(); path = resource.getPath(); }
public Resource getChildNamed(String name) { for (Resource child : getChildren()) { if (child.getName().equals(name)) { return child; } } return null; }
protected Map<String, ComponentExporter> getItemModels(@Nonnull SlingHttpServletRequest request, @Nonnull Class<ComponentExporter> modelClass) { Map<String, ComponentExporter> models = new LinkedHashMap<>(); getFilteredChildren().forEach(child -> { ComponentExporter model = modelFactory.getModelFromWrappedRequest(request, child, modelClass); if (model != null) { models.put(child.getName(), model); } }); return models; } }
public CurrentEvolutionEntryImpl(Resource resource, EvolutionConfig config) { this.config = config; this.type = EvolutionEntryType.RESOURCE; this.name = resource.getName(); this.depth = EvolutionPathUtil.getLastDepthForPath(resource.getPath()); this.path = resource.getParent().getName(); this.value = null; }
private int getResourceIndex(final Resource resource) { final String resourceName = resource.getName(); if (!StringUtils.startsWith(resourceName, LONG_FORM_TEXT_PAR)) { return -1; } final String indexStr = StringUtils.removeStart(resourceName, LONG_FORM_TEXT_PAR); try { return Integer.parseInt(indexStr); } catch (NumberFormatException ex) { return -1; } }
private int getResourceIndex(final Resource resource) { final String resourceName = resource.getName(); if (!StringUtils.startsWith(resourceName, LONG_FORM_TEXT_PAR)) { return -1; } final String indexStr = StringUtils.removeStart(resourceName, LONG_FORM_TEXT_PAR); try { return Integer.parseInt(indexStr); } catch (NumberFormatException ex) { return -1; } }
private <T> Map<String, T> getChildrenModels(@Nonnull SlingHttpServletRequest request, @Nonnull Class<T> modelClass) { Map<String, T> models = new LinkedHashMap<>(); for (Resource child : slingModelFilter.filterChildResources(resource.getChildren())) { T model = modelFactory.getModelFromWrappedRequest(request, child, modelClass); if (model != null) { models.put(child.getName(), model); } } return models; } }
public List<Rendition> getRenditions(Asset asset) { Resource renditions = frozenResource.getChild(RENDITIONS_PATH); if (renditions == null) { return Lists.newArrayList(); } List<Rendition> rv = Lists.newArrayList(); for (Resource r : renditions.getChildren()) { rv.add(getRendition(asset, r.getName())); } return rv; }
public EvolutionEntryImpl(Resource resource, Version version, EvolutionConfig config) { this.config = config; this.type = EvolutionEntryType.RESOURCE; this.name = resource.getName(); this.depth = EvolutionPathUtil.getDepthForPath(resource.getPath()); this.path = resource.getParent().getName(); this.version = version; this.value = null; this.relativePath = EvolutionPathUtil.getRelativeResourceName(resource.getPath()); }
public EvolutionEntryImpl(Resource resource, Version version, EvolutionConfig config) { this.config = config; this.type = EvolutionEntryType.RESOURCE; this.name = resource.getName(); this.depth = config.getDepthForPath(resource.getPath()); this.path = resource.getParent().getName(); this.version = version; this.value = null; this.relativePath = config.getRelativeResourceName(resource.getPath()); }
private void copy(final ResourceResolverContext context, final Resource src, final String dstPath, final List<Resource> newNodes) throws PersistenceException { final ValueMap vm = src.getValueMap(); final String createPath = new PathBuilder(dstPath).append(src.getName()).toString(); newNodes.add(this.create(context, createPath, vm)); for(final Resource c : src.getChildren()) { copy(context, c, createPath, newNodes); } }