Package javax.jcr.nodetype

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


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

        try {
            registry.registerNamespace("newPrefix", uri);
            fail("Should not allow changing the prefix of a namespace used by a node type");
        } catch (NamespaceException e) {
View Full Code Here


        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
        Node rootNode = session.getRootNode();
        Node newNode = rootNode.addNode("testNode");
        newNode.addMixin(nodeType.getName());
View Full Code Here

        session.save();

        //change the item definitions to protected and run the validations
        NodeTypeManager mgr = session.getWorkspace().getNodeTypeManager();
        NodeTypeTemplate mixinProtected = createMixinProtected(mgr, true);
        mgr.registerNodeType(mixinProtected, true);

        String childPath = "/protected/" + CHILD_PROTECTED;
        String propertyPath = "/protected/" + PROPERTY_PROTECTED;

        protectedNode = session.getNode("/protected");
View Full Code Here

        final NodeDefinitionTemplate subTypes = nodeTypeMgr.createNodeDefinitionTemplate();
        subTypes.setRequiredPrimaryTypeNames(new String[] {"mx:type"});
        nodeType.getNodeDefinitionTemplates().add(subTypes);

        nodeTypeMgr.registerNodeType(nodeType, false);
    }

    /**
     * Restore a shareable node that automatically removes an existing shareable node (6.13.19). In this case the particular
     * shared node is removed but its descendants continue to exist below the remaining members of the shared set.
View Full Code Here

        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()));

        Node parent = null;
        try {
View Full Code Here

        // 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"));

        // Add a node under which we'll do our work ...
        Node node1 = session.getRootNode().addNode("node1");
        session.save();
View Full Code Here

        undefinedDefn.setName("undefinedProperty");
        undefinedDefn.setRequiredType(PropertyType.UNDEFINED);
        propDefns.add(undefinedDefn);

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

    @Override
    @Before
    public void beforeEach() throws Exception {
View Full Code Here

        childDefn.setName("*");
        childDefn.setRequiredPrimaryTypeNames(new String[] {"car:Car"});
        template.getNodeDefinitionTemplates().add(childDefn);

        // Register the node type ...
        ntManager.registerNodeType(template, false);

        // Create two nodes with this node type ...
        Node joe = session.getNode("/NewSecondArea").addNode("Joe", "car:Owner");
        Node sally = session.getNode("/NewSecondArea").addNode("Sally", "car:Owner");
        session.save();
View Full Code Here

            nt.setName(CAR_CARRIER_TYPENAME);
            // Children ...
            NodeDefinitionTemplate carChildType = ntManager.createNodeDefinitionTemplate();
            carChildType.setRequiredPrimaryTypeNames(new String[] {CAR_TYPENAME});
            nt.getNodeDefinitionTemplates().add(carChildType);
            ntManager.registerNodeType(nt, true);
        }
        // Verify it was registered ...
        ntManager.getNodeType(CAR_CARRIER_TYPENAME);
    }
View Full Code Here

                session.getWorkspace().getNamespaceRegistry().registerNamespace(prefix, uri);

                // Start creating a nodeTypeTemplate, keep it basic.
                NodeTypeTemplate nodeTypeTemplate = nodeTypeManager.createNodeTypeTemplate();
                nodeTypeTemplate.setName(nodeTypeName);
                nodeTypeManager.registerNodeType(nodeTypeTemplate, false);

                session.getRootNode().addNode("testNode", nodeTypeName);
                session.save();

                Node node = session.getNode("/testNode");
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.