Package org.modeshape.jcr.cache

Examples of org.modeshape.jcr.cache.MutableCachedNode.createChild()


    public void shouldAllowTransientlyRenamingChildNode() {
        MutableCachedNode root = session1.mutable(session1.getRootKey());
        MutableCachedNode node = root.createChild(session(), newKey("node"), name("node"), property("p1", "value"));
        NodeKey childAKey = node.createChild(session(), newKey("x-childA"), name("childA"), property("p1", "value A")).getKey();
        NodeKey childBKey = node.createChild(session(), newKey("x-childB"), name("childB"), property("p1", "value B")).getKey();
        NodeKey childCKey = node.createChild(session(), newKey("x-childC"), name("childC"), property("p1", "value C")).getKey();
        session1.save();

        // Check the children ...
        node = check(session1).mutableNode(node.getKey(), "/node");
        check(session1).node(childAKey, "/node/childA");
View Full Code Here


    @Test
    public void shouldAllowAccessingRenamedChildNodeAfterPersisting() {
        MutableCachedNode root = session1.mutable(session1.getRootKey());
        MutableCachedNode node = root.createChild(session(), newKey("node"), name("node"), property("p1", "value"));
        NodeKey childAKey = node.createChild(session(), newKey("x-childA"), name("childA"), property("p1", "value A")).getKey();
        NodeKey childBKey = node.createChild(session(), newKey("x-childB"), name("childB"), property("p1", "value B")).getKey();
        NodeKey childCKey = node.createChild(session(), newKey("x-childC"), name("childC"), property("p1", "value C")).getKey();
        session1.save();

        // Check the children ...
View Full Code Here

    @Test
    public void shouldAllowAccessingRenamedChildNodeAfterPersisting() {
        MutableCachedNode root = session1.mutable(session1.getRootKey());
        MutableCachedNode node = root.createChild(session(), newKey("node"), name("node"), property("p1", "value"));
        NodeKey childAKey = node.createChild(session(), newKey("x-childA"), name("childA"), property("p1", "value A")).getKey();
        NodeKey childBKey = node.createChild(session(), newKey("x-childB"), name("childB"), property("p1", "value B")).getKey();
        NodeKey childCKey = node.createChild(session(), newKey("x-childC"), name("childC"), property("p1", "value C")).getKey();
        session1.save();

        // Check the children ...
        node = check(session1).mutableNode(node.getKey(), "/node");
View Full Code Here

    public void shouldAllowAccessingRenamedChildNodeAfterPersisting() {
        MutableCachedNode root = session1.mutable(session1.getRootKey());
        MutableCachedNode node = root.createChild(session(), newKey("node"), name("node"), property("p1", "value"));
        NodeKey childAKey = node.createChild(session(), newKey("x-childA"), name("childA"), property("p1", "value A")).getKey();
        NodeKey childBKey = node.createChild(session(), newKey("x-childB"), name("childB"), property("p1", "value B")).getKey();
        NodeKey childCKey = node.createChild(session(), newKey("x-childC"), name("childC"), property("p1", "value C")).getKey();
        session1.save();

        // Check the children ...
        node = check(session1).mutableNode(node.getKey(), "/node");
        check(session1).node(childAKey, "/node/childA");
View Full Code Here

    @Test
    public void shouldReturnAllTransientNodeKeys() {
        NodeKey rootKey = session1.getRootKey();
        MutableCachedNode root = session1.mutable(rootKey);
        NodeKey childAKey = root.createChild(session(), newKey("x-childA"), name("childA"), property("p1", "value A")).getKey();
        NodeKey childBKey = root.createChild(session(), newKey("x-childB"), name("childB"), property("p1", "value B")).getKey();

        Set<NodeKey> transientNodeKeys = session1.getChangedNodeKeys();
        assertEquals(new HashSet<NodeKey>(Arrays.asList(rootKey, childAKey, childBKey)), transientNodeKeys);
    }
View Full Code Here

    @Test
    public void shouldReturnAllTransientNodeKeys() {
        NodeKey rootKey = session1.getRootKey();
        MutableCachedNode root = session1.mutable(rootKey);
        NodeKey childAKey = root.createChild(session(), newKey("x-childA"), name("childA"), property("p1", "value A")).getKey();
        NodeKey childBKey = root.createChild(session(), newKey("x-childB"), name("childB"), property("p1", "value B")).getKey();

        Set<NodeKey> transientNodeKeys = session1.getChangedNodeKeys();
        assertEquals(new HashSet<NodeKey>(Arrays.asList(rootKey, childAKey, childBKey)), transientNodeKeys);
    }
View Full Code Here

    public void shouldSplitDocumentThatContainsTooManyChildReferences() throws Exception {
        // Create a bunch of children ...
        MutableCachedNode nodeB = check(session1).mutableNode("/childB");
        for (int i = 0; i != 10; ++i) {
            NodeKey newKey = session1.createNodeKey();
            nodeB.createChild(session(), newKey, name("newChild"), property("p1a", 344), property("p2", false));
        }
        session1.save();

        // Optimize the storage ...
        txnManager().begin();
View Full Code Here

    public void shouldSplitDocumentThatContainsTooManyChildReferencesIntoMultipleSegments() throws Exception {
        // Create a bunch of children ...
        MutableCachedNode nodeB = check(session1).mutableNode("/childB");
        for (int i = 0; i != 10; ++i) {
            NodeKey newKey = session1.createNodeKey();
            nodeB.createChild(session(), newKey, name("newChild"), property("p1a", 344), property("p2", false));
        }
        session1.save();

        // Optimize the storage ...
        txnManager().begin();
View Full Code Here

        for (int j = 0; j != 5; ++j) {
            // Create a bunch of children ...
            for (int i = 0; i != 5; ++i) {
                NodeKey newKey = key.withId("child" + ((j * 5) + i + 1));
                nodeB.createChild(session(), newKey, name("newChild"), property("p1a", 344), property("p2", false));
            }
            session1.save();
            // Find node B again after the save ...
            nodeB = check(session1).mutableNode("/childB");

View Full Code Here

                        JcrLexicon.PRIMARY_TYPE, ModeShapeLexicon.PERMISSION);
                Property principalProp = propertyFactory.create(ModeShapeLexicon.PERMISSION_PRINCIPAL_NAME,
                                                                    principal);
                Property privileges = propertyFactory.create(ModeShapeLexicon.PERMISSION_PRIVILEGES_NAME,
                                                             privilegesByPrincipalName.get(principal));
                aclNode.createChild(cache, null, principalName, primaryType, principalProp, privileges);
            } else {
                //there already is a child node for this principal, so we just need to update its privileges
                MutableCachedNode permissionNode = cache.mutable(permissionRef.getKey());
                Property privileges = propertyFactory.create(ModeShapeLexicon.PERMISSION_PRIVILEGES_NAME,
                                                             privilegesByPrincipalName.get(principal));
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.