Package org.modeshape.jcr.cache

Examples of org.modeshape.jcr.cache.SessionCache.mutable()


                    // specific child node type. This likely means there is either 0 or more than 1 (possibly residual)
                    // child node definitions. We need to find all of the added/renamed child nodes and use their specific
                    // primary types. The first to fail will result in an exception ...
                    final SessionCache session = cache();
                    for (NodeKey appendedOrRenamedKey : appendedOrRenamedChildrenByName.get(childName)) {
                        MutableCachedNode appendedOrRenamedChild = session.mutable(appendedOrRenamedKey);
                        if (appendedOrRenamedChild == null) continue;
                        Name childPrimaryType = appendedOrRenamedChild.getPrimaryType(session);
                        childDefns = nodeTypeCapabilities.findChildNodeDefinitions(primaryType, mixinTypes);
                        childNodeDefinition = childDefns.findBestDefinitionForChild(childName, childPrimaryType, true,
                                                                                    siblingCounter);
View Full Code Here


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

                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);

                // Add each of the predecessors from the version being removed ...
View Full Code Here

                successorSystem.setProperty(system,
                                            session.propertyFactory().create(JcrLexicon.PREDECESSORS, newPredecessorReferences));
            }
        }

        system.mutable(key).removeChild(system, version.key);
        system.destroy(version.key);
        try {
            system.save();
        } catch (org.modeshape.jcr.cache.ReferentialIntegrityException e) {
            // expected by the tck
View Full Code Here

        // Use a separate system session to set the REFERENCE property on the 'nt:versionLabels' child node ...
        SessionCache system = session.createSystemCache(false);
        Reference labelReference = session.referenceFactory().create(version.key(), true);
        Property ref = session.propertyFactory().create(nameFrom(label), labelReference);
        system.mutable(versionLabels.key()).setProperty(system, ref);
        system.save();
    }

    @Override
    public void removeVersionLabel( String label ) throws VersionException, RepositoryException {
View Full Code Here

            throw new VersionException(JcrI18n.invalidVersionLabel.text(label, getPath()));
        }

        // Use a separate system session to remove the REFERENCE property on the 'nt:versionLabels' child node ...
        SessionCache system = session.createSystemCache(false);
        system.mutable(versionLabels.key()).removeProperty(system, propName);
        system.save();
    }

    @Override
    public NodeIterator getAllFrozenNodes() throws RepositoryException {
View Full Code Here

        return node().getParentKey(sessionCache());
    }

    protected final MutableCachedNode mutableParent() throws RepositoryException {
        SessionCache cache = sessionCache();
        return cache.mutable(parentKey());
    }

    @Override
    Path path() throws ItemNotFoundException, InvalidItemStateException {
        return node().getPath(sessionCache());
View Full Code Here

                ChildReferences childReferences = locksNode.getChildReferences(systemSession);
                if (childReferences.isEmpty()) {
                    return;
                }
                for (ChildReference ref : childReferences) {
                    MutableCachedNode lockNode = systemSession.mutable(ref.getKey());

                    // remove properties that belong to the old (invalid) node type
                    lockNode.removeProperty(systemSession, ModeShapeLexicon.LOCKED_KEY);
                    lockNode.removeProperty(systemSession, ModeShapeLexicon.SESSION_SCOPE);
                    lockNode.removeProperty(systemSession, ModeShapeLexicon.IS_DEEP);
View Full Code Here


        SessionCache sessionCache = this.session.spawnSessionCache(false);
        String externalNodeKey = documentStore.createExternalProjection(parentNodeToBecomeFederatedKey.toString(), sourceName,
                                                                        externalPath, projectionAlias);
        MutableCachedNode node = sessionCache.mutable(parentNodeToBecomeFederatedKey);
        node.addFederatedSegment(externalNodeKey, projectionAlias);
        sessionCache.save();
    }

    @Override
View Full Code Here

        NodeKey federatedNodeKey = session.getNode(path.getParent().getString()).key();
        NodeKey externalNodeKey = session.getNode(path.getString()).key();

        SessionCache sessionCache = session.spawnSessionCache(false);
        MutableCachedNode federatedNode = sessionCache.mutable(federatedNodeKey);
        federatedNode.removeFederatedSegment(externalNodeKey.toString());
        sessionCache.save();
    }
}
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.