Package javax.jcr.nodetype

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


        child.setName("*");
        child.setDefaultPrimaryTypeName("nt:base");
        child.setRequiredPrimaryTypeNames(new String[] {"nt:base"});
        List<NodeDefinition> children = ntt.getNodeDefinitionTemplates();
        children.add(child);
        ntm.registerNodeType(ntt, true);

        // try to create a node with the default nt:base
        Node node = session.getRootNode().addNode("defaultNtBase", ntName);
        node.addNode("nothrow")// See OAK-1013
        try {
View Full Code Here


        List<PropertyDefinition> properties = ntt.getPropertyDefinitionTemplates();
        properties.add(propertyWithType);
        properties.add(unnamed);

        ntm.registerNodeType(ntt, false);

        Node node = session.getRootNode().addNode("testNodeForBinary", ntName);
        ByteArrayOutputStream bos = serializeObject("testValue");
        node.setProperty("javaObject",session.getValueFactory().createBinary(new ByteArrayInputStream(bos.toByteArray())));
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

            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

        type.setDeclaredSuperTypeNames(new String[] {"nt:unstructured"});
        type.setAbstract(false);
        type.setOrderableChildNodes(true);
        type.setMixin(false);
        type.setQueryable(true);
        nodeTypeManager.registerNodeType(type, true);
    }

    private String idList( Node... nodes ) throws RepositoryException {
        StringBuilder builder = new StringBuilder("(");
        for (int i = 0; i < nodes.length - 1; i++) {
View Full Code Here

        type.setDeclaredSuperTypeNames(new String[] {"nt:unstructured"});
        type.setAbstract(false);
        type.setOrderableChildNodes(true);
        type.setMixin(false);
        type.setQueryable(true);
        mgr.registerNodeType(type, true);
    }

    protected abstract void registerValueIndex( String indexName,
                                                String indexedNodeType,
                                                String desc,
View Full Code Here

                        }
                    }
                }
            }

            ntMgr.registerNodeType(mixin, true);
            this.mixinMap.put(mixinName, mixin);
            LOGGER.debug("added mixin '{0}' to registry", mixinName);
        }

        node.addMixin(mixinName);
View Full Code Here

        // Start creating a nodeTypeTemplate, keep it basic.
        NodeTypeTemplate nodeTypeTemplate = nodeTypeManager.createNodeTypeTemplate();
        String nodeTypeName = prefix + ":test";
        nodeTypeTemplate.setName(nodeTypeName);
        nodeTypeManager.registerNodeType(nodeTypeTemplate, false);

        try {
            registry.unregisterNamespace(prefix);
            fail("Should not allow the unregistration of a namespace used by a node type");
        } catch (NamespaceException e) {
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.