Package javax.jcr.nodetype

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


    private void registerNodeType( String typeName ) throws RepositoryException {
        NodeTypeManager nodeTypeManager = session.getWorkspace().getNodeTypeManager();

        // Create a template for the node type ...
        NodeTypeTemplate type = nodeTypeManager.createNodeTypeTemplate();
        type.setName(typeName);
        type.setDeclaredSuperTypeNames(new String[] {"nt:unstructured"});
        type.setAbstract(false);
        type.setOrderableChildNodes(true);
        type.setMixin(false);
View Full Code Here


    protected void registerNodeType( String typeName ) throws RepositoryException {
        NodeTypeManager mgr = session.getWorkspace().getNodeTypeManager();

        // Create a template for the node type ...
        NodeTypeTemplate type = mgr.createNodeTypeTemplate();
        type.setName(typeName);
        type.setDeclaredSuperTypeNames(new String[] {"nt:unstructured"});
        type.setAbstract(false);
        type.setOrderableChildNodes(true);
        type.setMixin(false);
View Full Code Here

        final String mixinName = mappedPrefix + ':' + parts[1];
        NodeTypeTemplate mixin = this.mixinMap.get(mixinName);

        if (mixin == null) {
            final NodeTypeManager ntMgr = session.getWorkspace().getNodeTypeManager();
            mixin = ntMgr.createNodeTypeTemplate();
            mixin.setMixin(true);
            mixin.setName(mixinName);

            // create mixin property definitions
            @SuppressWarnings( "unchecked" )
View Full Code Here

        // First create a namespace for the nodeType which is going to be added
        registry.registerNamespace(prefix, uri);
        assertThatNamespaceIsRegistered(prefix, uri);

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

        try {
View Full Code Here

        // First create a namespace for the nodeType which is going to be added
        registry.registerNamespace(prefix, uri);
        assertThatNamespaceIsRegistered(prefix, uri);

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

        try {
View Full Code Here

        NamespaceRegistry namespaceRegistry = workspace.getNamespaceRegistry();
        NodeTypeManager nodeTypeManager = workspace.getNodeTypeManager();

        namespaceRegistry.registerNamespace(namespaceName, namespaceUri);

        NodeTypeTemplate nodeTypeTemplate = nodeTypeManager.createNodeTypeTemplate();
        nodeTypeTemplate.setName(namespaceName.concat(":").concat(nodeTypeName));
        nodeTypeTemplate.setMixin(true);
        NodeType nodeType = nodeTypeManager.registerNodeType(nodeTypeTemplate, false);

        // Now create a node with the newly created nodeType
View Full Code Here

        Session session = getHelper().getSuperuserSession();

        session.getWorkspace().getNamespaceRegistry().registerNamespace("mx", "urn:test");
        final NodeTypeManager nodeTypeMgr = session.getWorkspace().getNodeTypeManager();

        final NodeTypeTemplate nodeType = nodeTypeMgr.createNodeTypeTemplate();
        nodeType.setName("mx:type");
        nodeType.setDeclaredSuperTypeNames(new String[] {"nt:folder"});

        final NodeDefinitionTemplate subTypes = nodeTypeMgr.createNodeDefinitionTemplate();
        subTypes.setRequiredPrimaryTypeNames(new String[] {"mx:type"});
View Full Code Here

        // Now define a namespace we'll use in the tests ...
        session.getWorkspace().getNamespaceRegistry().registerNamespace("acme", "http://example.com");

        NodeTypeManager mgr = session.getWorkspace().getNodeTypeManager();
        // Define the node definition that will have all the different kinds of properties ...
        NodeTypeTemplate nodeType = mgr.createNodeTypeTemplate();
        nodeType.setMixin(true);
        nodeType.setName("mixinWithAllPropTypes");
        @SuppressWarnings( "unchecked" )
        List<PropertyDefinitionTemplate> propDefns = nodeType.getPropertyDefinitionTemplates();
View Full Code Here

        NodeTypeManager ntMgr = session.getWorkspace().getNodeTypeManager();
        NodeDefinitionTemplate childDefn = ntMgr.createNodeDefinitionTemplate();
        childDefn.setSameNameSiblings(false);
        childDefn.setRequiredPrimaryTypeNames(new String[] {"nt:unstructured"});
        childDefn.setDefaultPrimaryTypeName("nt:unstructured");
        NodeTypeTemplate nodeType = ntMgr.createNodeTypeTemplate();
        nodeType.setName("noSnsChildren");
        nodeType.getNodeDefinitionTemplates().add(childDefn);
        NodeType newNodeType = ntMgr.registerNodeType(nodeType, false);
        assertThat(newNodeType, is(notNullValue()));
View Full Code Here

        ClassLoader cl = getClass().getClassLoader();
        startRepositoryWithConfiguration(cl.getResourceAsStream("config/simple-repo-config.json"));

        // Register a new node type that is a subtype of 'nt:resource'
        NodeTypeManager ntMgr = session.getWorkspace().getNodeTypeManager();
        NodeTypeTemplate template = ntMgr.createNodeTypeTemplate();
        template.setDeclaredSuperTypeNames(new String[] {"nt:resource"});
        template.setName("customResourceType");
        NodeType ntResourceSubtype = ntMgr.registerNodeType(template, false);
        assertThat(ntResourceSubtype.getDeclaredSupertypes()[0].getName(), is("nt:resource"));
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.