Package javax.jcr.nodetype

Examples of javax.jcr.nodetype.NodeTypeManager.registerNodeType()


        undefinedDefn.setRequiredType(PropertyType.UNDEFINED);
        undefinedDefn.setMultiple(true);
        propDefns.add(undefinedDefn);

        // Add the node type ...
        mgr.registerNodeType(nodeType, true);

        // Import the node types and the data ...
        registerNodeTypes("cars.cnd");
        importContent("/", "io/cars-system-view-with-uuids.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
    }
View Full Code Here


            pDef2.setRequiredType(PropertyType.PATH);
            Value pathValue = session.getValueFactory().createValue("/jcr:path/nt:value", PropertyType.PATH);
            pDef2.setDefaultValues(new Value[] {pathValue});
            template.getPropertyDefinitionTemplates().add(pDef2);

            nodeTypeManager.registerNodeType(template, false);

            template = nodeTypeManager.createNodeTypeTemplate();
            template.setName("test:referenceable");
            template.setDeclaredSuperTypeNames(
                    new String[] {"nt:unstructured", "mix:referenceable"});
View Full Code Here

            template = nodeTypeManager.createNodeTypeTemplate();
            template.setName("test:referenceable");
            template.setDeclaredSuperTypeNames(
                    new String[] {"nt:unstructured", "mix:referenceable"});
            nodeTypeManager.registerNodeType(template, false);

            Node root = session.getRootNode();

            Node referenceable =
                root.addNode("referenceable", "test:unstructured");
View Full Code Here

                    createNodeDefTemplate(ntm, childrenTypes));
        }

        ntt.setMixin(isMixin);

        ntm.registerNodeType(ntt, true);
        return ntt.getName();
    }

    /**
     * Creates the property definition template.
View Full Code Here

        NodeTypeManager ntMgr = session.getWorkspace().getNodeTypeManager();
        NodeTypeTemplate mixTest = ntMgr.createNodeTypeTemplate();
        mixTest.setName(TEST_TYPE);
        mixTest.setMixin(true);
        ntMgr.registerNodeType(mixTest, false);

        Node n = session.getRootNode().addNode(TEST_NODE);
        n.addMixin(TEST_TYPE);
        Node refNode = n.addNode(REFERENCEABLE_NODE);
        refNode.addMixin(JcrConstants.MIX_REFERENCEABLE);
View Full Code Here

        NodeTypeManager ntMgr = getAdminSession().getWorkspace().getNodeTypeManager();
        assertFalse(ntMgr.hasNodeType("foo"));

        NodeTypeTemplate ntd = ntMgr.createNodeTypeTemplate();
        ntd.setName("foo");
        ntMgr.registerNodeType(ntd, false);
        assertTrue(ntMgr.hasNodeType("foo"));

        ntMgr.unregisterNodeType("foo");
        assertFalse(ntMgr.hasNodeType("foo"));
    }
View Full Code Here

    public void mixin() throws RepositoryException {
        NodeTypeManager ntMgr = getAdminSession().getWorkspace().getNodeTypeManager();
        NodeTypeTemplate mixTest = ntMgr.createNodeTypeTemplate();
        mixTest.setName("mix:test");
        mixTest.setMixin(true);
        ntMgr.registerNodeType(mixTest, false);

        Node testNode = getNode(TEST_PATH);
        NodeType[] mix = testNode.getMixinNodeTypes();
        assertEquals(0, mix.length);
View Full Code Here

        ntd.setName("fooType");
        PropertyDefinitionTemplate propDefTemplate = ntMgr.createPropertyDefinitionTemplate();
        propDefTemplate.setName("fooProp");
        propDefTemplate.setRequiredType(PropertyType.STRING);
        ntd.getPropertyDefinitionTemplates().add(propDefTemplate);
        ntMgr.registerNodeType(ntd, false);

        Node node = session.getRootNode().addNode("node", "fooType");
        node.setProperty("fooProp", "fooValue");
        session.save();
       
View Full Code Here

        NodeTypeManager ntMgr = session.getWorkspace().getNodeTypeManager();
        NodeTypeTemplate mixTest = ntMgr.createNodeTypeTemplate();
        mixTest.setName(TEST_TYPE);
        mixTest.setMixin(true);
        ntMgr.registerNodeType(mixTest, false);

        Node n = session.getRootNode().addNode(TEST_NODE, TEST_NODE_TYPE);
        n.addMixin(TEST_TYPE);
        Node refNode = n.addNode(REFERENCEABLE_NODE);
        refNode.addMixin(JcrConstants.MIX_REFERENCEABLE);
View Full Code Here

        NodeTypeDefinition ntd = manager.getNodeType("nt:query");
        NodeTypeTemplate ntt = manager.createNodeTypeTemplate(ntd);

        try {
            manager.registerNodeType(ntt, true);
            // no changes to the type, so the registration should be a no-op
        } catch (ConstraintViolationException unexpected) {
            fail();
        }
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.