@Test( expected = ItemNotFoundException.class ) public void shouldHaveNoParent() throws Exception { rootNode.getParent(); }
AbstractJcrNode parent = nodeInSharedSet.getParent(); parent.checkForLock(); session.checkPermission(nodeInSharedSet, ModeShapePermissions.REMOVE);
AbstractJcrNode parent = nodeInSharedSet.getParent(); parent.checkForLock(); session.checkPermission(nodeInSharedSet, ModeShapePermissions.REMOVE);
final AbstractJcrItem findItem( AbstractJcrNode node, Path relativePath ) throws RepositoryException { assert !relativePath.isAbsolute(); if (relativePath.size() == 1) { Segment last = relativePath.getLastSegment(); if (last.isSelfReference()) return node; if (last.isParentReference()) return node.getParent(); } // Find the path to the referenced node ... Path nodePath = node.path(); Path absolutePath = nodePath.resolve(relativePath); if (absolutePath.isAtOrBelow(nodePath)) { // Find the item starting at 'node' ... } return getItem(absolutePath); }
final AbstractJcrItem findItem( AbstractJcrNode node, Path relativePath ) throws RepositoryException { assert !relativePath.isAbsolute(); if (relativePath.size() == 1) { Segment last = relativePath.getLastSegment(); if (last.isSelfReference()) return node; if (last.isParentReference()) return node.getParent(); } // Find the path to the referenced node ... Path nodePath = node.path(); Path absolutePath = nodePath.resolve(relativePath); if (absolutePath.isAtOrBelow(nodePath)) { // Find the item starting at 'node' ... } return getItem(absolutePath); }
protected final Path correspondingNodePath( String workspaceName ) throws NoSuchWorkspaceException, ItemNotFoundException, RepositoryException { assert workspaceName != null; NamespaceRegistry namespaces = this.context().getNamespaceRegistry(); // Find the closest ancestor (including this node) that is referenceable ... AbstractJcrNode referenceableRoot = this; while (!referenceableRoot.isNodeType(JcrMixLexicon.REFERENCEABLE.getString(namespaces))) { referenceableRoot = referenceableRoot.getParent(); } // Find the relative path from the nearest referenceable node to this node (or null if this node is referenceable) ... Path relativePath = path().equals(referenceableRoot.path()) ? null : path().relativeTo(referenceableRoot.path()); NodeKey key = referenceableRoot.key(); // if the we're looking for a system node, we need to use the system ws name, which is repository-wide String systemWsKey = session.getRepository().systemWorkspaceKey(); String workspaceKey = systemWsKey.equals(key.getWorkspaceKey()) ? systemWsKey : NodeKey.keyForWorkspaceName(workspaceName); NodeKey nodeKey = new NodeKey(key.getSourceKey(), workspaceKey, key.getIdentifier()); return session.getPathForCorrespondingNode(workspaceName, nodeKey, relativePath); }
protected final Path correspondingNodePath( String workspaceName ) throws NoSuchWorkspaceException, ItemNotFoundException, RepositoryException { assert workspaceName != null; NamespaceRegistry namespaces = this.context().getNamespaceRegistry(); // Find the closest ancestor (including this node) that is referenceable ... AbstractJcrNode referenceableRoot = this; while (!referenceableRoot.isNodeType(JcrMixLexicon.REFERENCEABLE.getString(namespaces))) { referenceableRoot = referenceableRoot.getParent(); } // Find the relative path from the nearest referenceable node to this node (or null if this node is referenceable) ... Path relativePath = path().equals(referenceableRoot.path()) ? null : path().relativeTo(referenceableRoot.path()); NodeKey key = referenceableRoot.key(); // if the we're looking for a system node, we need to use the system ws name, which is repository-wide String systemWsKey = session.getRepository().systemWorkspaceKey(); String workspaceKey = systemWsKey.equals(key.getWorkspaceKey()) ? systemWsKey : NodeKey.keyForWorkspaceName(workspaceName); NodeKey nodeKey = new NodeKey(key.getSourceKey(), workspaceKey, key.getIdentifier()); return session.getPathForCorrespondingNode(workspaceName, nodeKey, relativePath); }
if (relativePath.equals(".")) return true; if (relativePath.equals("..")) { return !isRoot() && session.hasPermission(this.getParent().getPath(), ModeShapePermissions.READ); if (path.getLastSegment().isSelfReference()) return true; if (path.getLastSegment().isParentReference()) { return !isRoot() && session.hasPermission(this.getParent().getPath(), ModeShapePermissions.READ);
if (relativePath.equals(".")) return true; if (relativePath.equals("..")) { return !isRoot() && session.hasPermission(this.getParent().getPath(), ModeShapePermissions.READ); if (path.getLastSegment().isSelfReference()) return true; if (path.getLastSegment().isParentReference()) { return !isRoot() && session.hasPermission(this.getParent().getPath(), ModeShapePermissions.READ);
@Override public boolean isCheckedOut() throws RepositoryException { AbstractJcrNode node = this; SessionCache cache = sessionCache(); ValueFactory<Boolean> booleanFactory = session.context().getValueFactories().getBooleanFactory(); while (node != null) { // If the node has an OPV of 'ignore' ... NodeDefinition defn = node.getDefinition(); if (defn.getOnParentVersion() == OnParentVersionAction.IGNORE) { // This node is not or cannot be checked in ... return true; } if (node.isNodeType(JcrMixLexicon.VERSIONABLE)) { Property prop = node.node().getProperty(JcrLexicon.IS_CHECKED_OUT, cache); // This prop can only be null if the node has not been saved since it was made versionable. return prop == null || booleanFactory.create(prop.getFirstValue()); } if (node.isRoot()) break; node = node.getParent(); } return true; }
@Override public boolean isCheckedOut() throws RepositoryException { AbstractJcrNode node = this; SessionCache cache = sessionCache(); ValueFactory<Boolean> booleanFactory = session.context().getValueFactories().getBooleanFactory(); while (node != null) { // If the node has an OPV of 'ignore' ... NodeDefinition defn = node.getDefinition(); if (defn.getOnParentVersion() == OnParentVersionAction.IGNORE) { // This node is not or cannot be checked in ... return true; } if (node.isNodeType(JcrMixLexicon.VERSIONABLE)) { Property prop = node.node().getProperty(JcrLexicon.IS_CHECKED_OUT, cache); // This prop can only be null if the node has not been saved since it was made versionable. return prop == null || booleanFactory.create(prop.getFirstValue()); } if (node.isRoot()) break; node = node.getParent(); } return true; }
assert !this.isRoot(); CachedNode parent = getParent().node(); SessionCache cache = sessionCache(); Name nodeName = name(); siblingCounter); if (childDefn == null) { throw new ConstraintViolationException(JcrI18n.noChildNodeDefinition.text(nodeName, getParent().location(), readable(parentPrimaryType), readable(parentMixins)));
assert !this.isRoot(); CachedNode parent = getParent().node(); SessionCache cache = sessionCache(); Name nodeName = name(); siblingCounter); if (childDefn == null) { throw new ConstraintViolationException(JcrI18n.noChildNodeDefinition.text(nodeName, getParent().location(), readable(parentPrimaryType), readable(parentMixins)));
assert !this.isRoot(); CachedNode parent = getParent().node(); SessionCache cache = sessionCache(); Name nodeName = name(); siblingCounter); if (childDefn == null) { throw new ConstraintViolationException(JcrI18n.noChildNodeDefinition.text(nodeName, getParent().location(), readable(parentPrimaryType), readable(parentMixins)));
assert !this.isRoot(); CachedNode parent = getParent().node(); SessionCache cache = sessionCache(); Name nodeName = name(); siblingCounter); if (childDefn == null) { throw new ConstraintViolationException(JcrI18n.noChildNodeDefinition.text(nodeName, getParent().location(), readable(parentPrimaryType), readable(parentMixins)));
parent = getParent(); } catch (ItemNotFoundException e) {
parent = getParent(); } catch (ItemNotFoundException e) {
CachedNode parent = getParent().node(); Name primaryType = parent.getPrimaryType(cache); Set<Name> mixins = parent.getMixinTypes(cache);