@Override public String apply(String path) { return getParentPath(path); } });
@Override public String apply(String path) { return getParentPath(path); } });
public PropertyInclude(PropertyDefinition pd) { super(getParentPath(pd.name)); this.propertyDefinition = pd; this.propertyName = PathUtils.getName(pd.name); this.parentPath = getParentPath(pd.name); if (pd.isRegexp) { pattern = Pattern.compile(propertyName); } else { pattern = null; } }
private Set<String> unprecisePaths(Set<String> paths, int level) { Set<String> result = new HashSet<String>(); for (String path : paths) { String unprecise = path; while(PathUtils.getDepth(unprecise) > level) { unprecise = PathUtils.getParentPath(unprecise); } result.add(unprecise); } return result; }
@Override public boolean isDirectlyUnder(String path) { path = SANITIZE_PATH.apply(path); String nextPath = includedPaths.higher(path); return nextPath != null && path.equals(getParentPath(nextPath)); }
@Override public void checkPreconditions() throws RepositoryException { super.checkPreconditions(); sd.checkProtectedNode(getParentPath(srcOakPath)); sd.checkProtectedNode(getParentPath(destOakPath)); }
@Override public void checkPreconditions() throws RepositoryException { super.checkPreconditions(); sd.checkProtectedNode(getParentPath(srcOakPath)); sd.checkProtectedNode(getParentPath(destOakPath)); }
@Override public boolean evaluate() { String p = parentSelector.currentPath(); String c = childSelector.currentPath(); // the parent of the root is the root, // so we need to special case this return !PathUtils.denotesRoot(c) && PathUtils.getParentPath(c).equals(p); }
@Override public boolean evaluate() { String p = parentSelector.currentPath(); String c = childSelector.currentPath(); // the parent of the root is the root, // so we need to special case this return !PathUtils.denotesRoot(c) && PathUtils.getParentPath(c).equals(p); }
@Override public void performVoid() throws RepositoryException { sessionDelegate.checkProtectedNode(getParentPath(destOakPath)); checkIndexOnName(destAbsPath); workspaceDelegate.copy(srcOakPath, destOakPath); } });
private static void rename(Node node, String name) throws RepositoryException { String destPath = PathUtils.getParentPath(node.getPath()) + "/" + name; node.getSession().move(node.getPath(), destPath); } }
@Override public void move(String srcAbsPath, final String destAbsPath) throws RepositoryException { final String srcOakPath = getOakPathOrThrowNotFound(srcAbsPath); final String destOakPath = getOakPathOrThrowNotFound(destAbsPath); ensureIsAlive(); sessionDelegate.checkProtectedNode(getParentPath(srcOakPath)); sessionDelegate.checkProtectedNode(getParentPath(destOakPath)); checkIndexOnName(destAbsPath); sessionDelegate.move(srcOakPath, destOakPath, false); }
@Override public void move(String srcAbsPath, final String destAbsPath) throws RepositoryException { final String srcOakPath = getOakPathOrThrowNotFound(srcAbsPath); final String destOakPath = getOakPathOrThrowNotFound(destAbsPath); ensureIsAlive(); sessionDelegate.checkProtectedNode(getParentPath(srcOakPath)); sessionDelegate.checkProtectedNode(getParentPath(destOakPath)); checkIndexOnName(destAbsPath); sessionDelegate.move(srcOakPath, destOakPath, false); }
private static PropertyState getValue(NodeState node, String propertyRelativePath) { int depth = PathUtils.getDepth(propertyRelativePath); NodeState propNode = node; String propName = propertyRelativePath; if (depth > 1) { propName = PathUtils.getName(propertyRelativePath); String parentPath = PathUtils.getParentPath(propertyRelativePath); propNode = NodeStateUtils.getNode(node, parentPath); } return propNode.getProperty(propName); } }
private Operation createSetProperty() { String path = choosePropertyPath(); if (path == null) { return null; } String value = createValue(); return new SetProperty(PathUtils.getParentPath(path), PathUtils.getName(path), value); }
@Test(expected = IllegalStateException.class) public void testMountAboveCugSupportedPath() { MountInfoProvider mip = Mounts.newBuilder().mount("mnt", PathUtils.getParentPath(AbstractCugTest.SUPPORTED_PATH3)).build(); createConfiguration(mip); }
private static NodeBuilder move(NodeBuilder builder, String source, String dest) { NodeBuilder sourceBuilder = getBuilder(builder, source); NodeBuilder destParentBuilder = getBuilder(builder, PathUtils.getParentPath(dest)); assertTrue(sourceBuilder.moveTo(destParentBuilder, PathUtils.getName(dest))); return builder; }
private void updateBefore(IndexDefinitionBuilder defnb) { NodeBuilder builder = before.builder(); NodeBuilder cb = TestUtil.child(builder, PathUtils.getParentPath(indexPath)); cb.setChildNode(PathUtils.getName(indexPath), defnb.build()); before = builder.getNodeState(); }
private void createTestNode(String path, NodeState state) throws CommitFailedException { String parentPath = PathUtils.getParentPath(path); NodeBuilder builder = store.getRoot().builder(); NodeBuilder parent = childBuilder(builder, parentPath); parent.setChildNode(PathUtils.getName(path), state); merge(builder); }
private static void checkNotPath(NodeBuilder node, String key, String path) { path = PathUtils.concat(key, path); String parentPath = PathUtils.getParentPath(path); String name = PathUtils.getName(path); NodeBuilder check = node; for (String p : PathUtils.elements(parentPath)) { Assert.assertTrue("Missing child node " + p + " on path " + path, check.hasChildNode(p)); check = check.child(p); } Assert.assertFalse(check.hasChildNode(name)); }