Package javax.jcr

Examples of javax.jcr.Node.addMixin()


        assertTrue(it.hasNext());

        // the same should be true, if the rep:AccessControllable mixin has
        // been manually added
        Node n = (Node) superuser.getItem(childNPath);
        n.addMixin(((SessionImpl) superuser).getJCRName(AccessControlConstants.NT_REP_ACCESS_CONTROLLABLE));
        it = acMgr.getApplicablePolicies(childNPath);
        assertTrue(it.hasNext());
    }

    public void testInheritance2() throws RepositoryException, NotExecutableException {
View Full Code Here


  }

  public Node addNode(Node parentNode, String relPath, NodeDef nodeType) throws RepositoryException {
    Node childNode = parentNode.addNode(relPath, nodeType.getPrimaryNodeTypeName());
    for (String mixinName : nodeType.getMixinNames()) {
      childNode.addMixin(mixinName);
    }
    return childNode;
  }

  public void orderBefore(Node parentNode, Node srcNode, Node dstNode) throws RepositoryException {
View Full Code Here

        Node rootNode = session.getRootNode();
        Node nodeA = rootNode.getNode("a");

        assertThat(nodeA.canAddMixin(MIXIN_TYPE_WITH_AUTO_PROP.getString(registry)), is(true));
        nodeA.addMixin(MIXIN_TYPE_WITH_AUTO_PROP.getString(registry));
        Property prop = nodeA.getProperty(PROPERTY_B.getString(registry));

        assertThat(prop, is(notNullValue()));
        assertThat(prop.getLong(), is(10L));
    }
View Full Code Here

        Node rootNode = session.getRootNode();
        Node nodeA = rootNode.getNode("a");

        assertThat(nodeA.canAddMixin(MIXIN_TYPE_WITH_AUTO_CHILD.getString(registry)), is(true));
        nodeA.addMixin(MIXIN_TYPE_WITH_AUTO_CHILD.getString(registry));
        Node childNode = nodeA.getNode(CHILD_NODE_B.getString(registry));

        assertThat(childNode, is(notNullValue()));
        assertThat(childNode.getPrimaryNodeType().getName(), is(JcrNtLexicon.UNSTRUCTURED.getString(registry)));
    }
View Full Code Here

        Node rootNode = session.getRootNode();
        Node nodeA = rootNode.getNode("a");
        nodeA.setProperty(PROPERTY_B.getString(registry), "Not a boolean");

        assertThat(nodeA.canAddMixin(MIXIN_TYPE_WITH_AUTO_PROP.getString(registry)), is(false));
        nodeA.addMixin(MIXIN_TYPE_WITH_AUTO_PROP.getString(registry));
    }

    @Test
    public void shouldAllowAdditionIfResidualPropertyDoesNotConflict() throws Exception {
        graph.create("/a").and();
View Full Code Here

        Node rootNode = session.getRootNode();
        Node nodeA = rootNode.getNode("a");
        nodeA.setProperty(PROPERTY_B.getString(registry), 10L);

        assertThat(nodeA.canAddMixin(MIXIN_TYPE_WITH_AUTO_PROP.getString(registry)), is(true));
        nodeA.addMixin(MIXIN_TYPE_WITH_AUTO_PROP.getString(registry));
    }

    @Test( expected = ConstraintViolationException.class )
    public void shouldNotAllowAdditionIfResidualChildNodeConflicts() throws Exception {
        graph.create("/a").and().create("/a/" + CHILD_NODE_B).and();
View Full Code Here

        Node rootNode = session.getRootNode();
        Node nodeA = rootNode.getNode("a");

        assertThat(nodeA.canAddMixin(MIXIN_TYPE_WITH_AUTO_CHILD.getString(registry)), is(false));
        nodeA.addMixin(MIXIN_TYPE_WITH_AUTO_CHILD.getString(registry));
    }

    @Test
    public void shouldAllowAdditionIfResidualChildNodeDoesNotConflict() throws Exception {
        graph.create("/a").and().create("/a/" + CHILD_NODE_B).and();
View Full Code Here

        Node rootNode = session.getRootNode();
        Node nodeA = rootNode.getNode("a");

        assertThat(nodeA.canAddMixin(MIXIN_TYPE_WITH_AUTO_CHILD.getString(registry)), is(true));
        nodeA.addMixin(MIXIN_TYPE_WITH_AUTO_CHILD.getString(registry));
        nodeA.save();

        Node newRootNode = session.getRootNode();
        Node newNodeA = newRootNode.getNode("a");
View Full Code Here

        Node rootNode = session.getRootNode();
        Node nodeA = rootNode.getNode("a");

        assertThat(nodeA.canAddMixin(MIXIN_TYPE_B.getString(registry)), is(true));
        nodeA.addMixin(MIXIN_TYPE_B.getString(registry));

        nodeA.setProperty(PROPERTY_B.getString(registry), "some string");
        nodeA.save();

        rootNode = session.getRootNode();
View Full Code Here

        Node rootNode = session.getRootNode();
        Node nodeA = rootNode.getNode("a");

        assertThat(nodeA.canAddMixin(MIXIN_TYPE_B.getString(registry)), is(true));
        nodeA.addMixin(MIXIN_TYPE_B.getString(registry));

        nodeA.addNode(CHILD_NODE_B.getString(registry));
        nodeA.save();

        Node newRootNode = session.getRootNode();
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.