private static void put(Map<String, Set<String>> map, Iterable<String> keys, String value) { String asRelative = isAbsolute(value) ? value.substring(1) : value; for (String key : keys) { Set<String> values = map.get(key); if (values == null) { values = newHashSet(); } values.add(asRelative); map.put(key, values); } }
private static void put(Map<String, Set<String>> map, Iterable<String> keys, String value) { String asRelative = isAbsolute(value) ? value.substring(1) : value; for (String key : keys) { Set<String> values = map.get(key); if (values == null) { values = newHashSet(); } values.add(asRelative); map.put(key, values); } }
private static void put(Map<String, Set<String>> map, Iterable<String> keys, String value) { String asRelative = isAbsolute(value) ? value.substring(1) : value; for (String key : keys) { Set<String> values = map.get(key); if (values == null) { values = newHashSet(); } values.add(asRelative); map.put(key, values); } }
@Override public IndexRow next() { // TODO support jcr:score and possibly rep:excerpt String path = iterator.next(); return new IndexRowImpl(isAbsolute(path) ? path : "/" + path); }
public static String getPreviousPathFor(String path, Revision r, int height) { if (!PathUtils.isAbsolute(path)) { throw new IllegalArgumentException("path must be absolute: " + path); } StringBuilder sb = new StringBuilder(path.length() + REVISION_LENGTH + 3); sb.append("p").append(path); if (sb.charAt(sb.length() - 1) != '/') { sb.append('/'); } r.toStringBuilder(sb).append("/").append(height); return sb.toString(); }
static boolean isRelativeProperty(String propertyName){ return !isAbsolute(propertyName) && !FulltextIndexConstants.REGEX_ALL_PROPS.equals(propertyName) && PathUtils.getNextSlash(propertyName, 0) > 0; }
@NotNull @Override public ImmutableTree getTree(@NotNull String path) { checkArgument(PathUtils.isAbsolute(path)); ImmutableTree child = rootTree; for (String name : elements(path)) { child = child.getChild(name); } return child; }
@NotNull @Override public ImmutableTree getTree(@NotNull String path) { checkArgument(PathUtils.isAbsolute(path)); ImmutableTree child = rootTree; for (String name : elements(path)) { child = child.getChild(name); } return child; }
@NotNull private String getOakPathOrThrow(@NotNull String absPath) throws RepositoryException { String p = sessionContext.getOakPathOrThrow(absPath); if (!PathUtils.isAbsolute(p)) { throw new RepositoryException("Not an absolute path: " + absPath); } return p; }
@Nullable protected String getOakPath(@Nullable String jcrPath) throws RepositoryException { if (jcrPath == null) { return null; } else { String oakPath = namePathMapper.getOakPath(jcrPath); if (oakPath == null || !PathUtils.isAbsolute(oakPath)) { throw new RepositoryException("Failed to resolve JCR path " + jcrPath); } return oakPath; } }
private String readAbsolutePath() throws ParseException { String path = readPath(); if (!PathUtils.isAbsolute(path)) { throw getSyntaxError("absolute path"); } return path; }
private void markChanged(String path) { if (!PathUtils.denotesRoot(path) && !PathUtils.isAbsolute(path)) { throw new IllegalArgumentException("path: " + path); } while (true) { changedNodes.add(path); if (PathUtils.denotesRoot(path)) { break; } path = PathUtils.getParentPath(path); } }
private Tree getTree(String relPath) throws RepositoryException { if (PathUtils.isAbsolute(relPath)) { throw new RepositoryException("Not a relative path: " + relPath); } return TreeUtil.getTree(tree, relPath); }
private Tree getTree(String relPath) throws RepositoryException { if (PathUtils.isAbsolute(relPath)) { throw new RepositoryException("Not a relative path: " + relPath); } return TreeUtil.getTree(tree, relPath); }
private Tree getTree(String relPath) throws RepositoryException { if (PathUtils.isAbsolute(relPath)) { throw new RepositoryException("Not a relative path: " + relPath); } return TreeUtil.getTree(tree, relPath); }
/** * Create a new {@code TreeLocation} instance for the item * at the given {@code path} in {@code root}. */ public static TreeLocation create(Root root, String path) { checkArgument(isAbsolute(path)); TreeLocation location = create(root.getTree(PathUtils.ROOT_PATH)); for (String name : elements(path)) { location = location.getChild(name); } return location; }
@Override public String getPath() { String sub = pathRow.getPath(); if (isVirtualRow()) { return sub; } else if (!"".equals(pathPrefix) && PathUtils.denotesRoot(sub)) { return pathPrefix; } else if (PathUtils.isAbsolute(sub)) { return pathPrefix + sub; } else { return PathUtils.concat(pathPrefix, sub); } }
@Override public String getPath() { String sub = pathRow.getPath(); if (isVirtualRow()) { return sub; } else if (PathUtils.isAbsolute(sub)) { return plan.getPathPrefix() + sub; } else { return PathUtils.concat(plan.getPathPrefix(), sub); } }
@Override public boolean nodeExists(String path, String revisionId) throws MicroKernelException { if (!PathUtils.isAbsolute(path)) { throw new MicroKernelException("Path is not absolute: " + path); } revisionId = revisionId != null ? revisionId : headRevision.toString(); Revision rev = Revision.fromString(stripBranchRevMarker(revisionId)); Node n = getNode(path, rev); return n != null; }
@Override public String getPath() { String sub = pathRow.getPath(); if (isVirtualRow()) { return sub; } else if (PathUtils.isAbsolute(sub)) { return plan.getPathPrefix() + sub; } else { return PathUtils.concat(plan.getPathPrefix(), sub); } }