Examples of NodeKey


Examples of org.modeshape.jcr.cache.NodeKey

                                                       NodeKey rootKey ) {
        // If this node is a random identifier, then we need to use it as a node key identifier ...
        if (NodeKey.isValidRandomIdentifier(identifier)) {
            return rootKey.withId(identifier);
        }
        return new NodeKey(identifier);
    }
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

        CachedNode node = cache.getNode(nodeKey);
        if (!node.isQueryable(cache)) return 0;
        int result = 1;
        ChildReferences childReferences = node.getChildReferences(cache);
        for (Iterator<NodeKey> nodeKeyIterator = childReferences.getAllKeys(); nodeKeyIterator.hasNext();) {
            NodeKey childKey = nodeKeyIterator.next();
            result += countAllNodesBelow(childKey, cache);
        }
        return result;
    }
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

        for (Value predecessorValue : predecessors.getValues()) {
            addedValues.clear();
            List<JcrValue> newNodeSuccessors = new ArrayList<>();

            // Add each of the successors from the version's predecessor ...
            NodeKey predecessorKey = ((NodeKeyReference)((JcrValue)predecessorValue).value()).getNodeKey();
            AbstractJcrNode predecessor = session().node(predecessorKey, null);
            MutableCachedNode predecessorSystem = system.mutable(predecessor.key());

            JcrValue[] nodeSuccessors = predecessor.getProperty(JcrLexicon.SUCCESSORS).getValues();
            addValuesNotInSet(nodeSuccessors, newNodeSuccessors, versionId, addedValues);

            if (successors != null) {
                // Add each of the successors from the version being removed ...
                addValuesNotInSet(successors.getValues(), newNodeSuccessors, versionId, addedValues);
            }

            // Set the property ...
            Object[] newSuccessorReferences = extractValues(newNodeSuccessors);
            predecessorSystem.setProperty(system, session.propertyFactory().create(JcrLexicon.SUCCESSORS,
                                                                           newSuccessorReferences));
            addedValues.clear();
        }

        if (successors != null) {
            // Remove the reference to the dead version from the predecessors property of all the successors
            for (Value successorValue : successors.getValues()) {
                addedValues.clear();
                List<JcrValue> newNodePredecessors = new ArrayList<>();

                // Add each of the predecessors from the version's successor ...
                NodeKey successorKey = ((NodeKeyReference)((JcrValue)successorValue).value()).getNodeKey();
                AbstractJcrNode successor = session().node(successorKey, null);
                MutableCachedNode successorSystem = system.mutable(successor.key());

                JcrValue[] nodePredecessors = successor.getProperty(JcrLexicon.PREDECESSORS).getValues();
                addValuesNotInSet(nodePredecessors, newNodePredecessors, versionId, addedValues);
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

    }

    protected JcrSharedNode asSharedNode( Node node ) {
        if (node instanceof JcrSharedNode) {
            JcrSharedNode sharedNode = (JcrSharedNode)node;
            NodeKey shareableKey = sharedNode.key();
            // See if the node is already exported ...
            if (!shareableNodes.add(shareableKey)) {
                // Already saw it, so return the shared node ...
                return sharedNode;
            }
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

        }
        AbstractJcrNode node = (AbstractJcrNode)value;
        if (!this.isInTheSameProcessAs(node.session().context().getProcessId())) {
            throw new RepositoryException(JcrI18n.nodeNotInTheSameSession.text(node.path()));
        }
        NodeKey key = ((AbstractJcrNode)value).key();
        Reference ref = session.context().getValueFactories().getReferenceFactory()
                               .create(key, ((AbstractJcrNode)value).isForeign());
        return valueFrom(PropertyType.REFERENCE, ref);
    }
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

                                            .newDocumentKey(key().toString(), childName, childPrimaryNodeTypeName);
            } catch (Exception e) {
                throw new RepositoryException(e);
            }
            if (documentStoreKey != null) {
                desiredKey = new NodeKey(documentStoreKey);
            }
        }

        // We can create the child, so start by building the required properties ...
        PropertyFactory propFactory = session.propertyFactory();
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

        if (srcRef == null) {
            String workspaceName = workspaceName();
            throw new ItemNotFoundException(JcrI18n.pathNotFound.text(srcChildRelPath, workspaceName));
        }

        NodeKey destKey = null;
        if (destChildRelPath != null) {
            Path destPath = session.pathFactory().create(destChildRelPath);
            if (destPath.isAbsolute() || destPath.size() != 1) {
                throw new ItemNotFoundException(JcrI18n.invalidPathParameter.text(destChildRelPath, "destChildRelPath"));
            }
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

            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);
    }
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

            I18n msg = JcrI18n.cannotCreateChildOnCheckedInNodeSinceOpvOfChildDefinitionIsNotIgnore;
            throw new VersionException(msg.text(segment, readable(parentPathStr), childDefn.getName(), opv));
        }

        // We can create the shared node ...
        NodeKey childKey = shareableNode.key();
        node.linkChild(cache, childKey, newNodeName);
    }
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

    public JcrVersionNode getBaseVersion() throws UnsupportedRepositoryOperationException, RepositoryException {
        checkSession();
        if (!hasProperty(JcrLexicon.BASE_VERSION)) {
            throw new UnsupportedRepositoryOperationException(JcrI18n.requiresVersionable.text());
        }
        NodeKey baseVersionKey = ((NodeKeyReference)getProperty(JcrLexicon.BASE_VERSION).getValue().value()).getNodeKey();
        return (JcrVersionNode)session().node(baseVersionKey, null);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.