Package javax.jcr.nodetype

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


    @FixFor( "MODE-883" )
    @Test
    public void shouldAllowCreatingShareableNodeUnderParentThatDoesNotAllowSameNameSiblings() throws RepositoryException {
        // Now create a node type that allows only one car ...
        NodeTypeManager ntManager = session.getWorkspace().getNodeTypeManager();
        NodeTypeTemplate template = ntManager.createNodeTypeTemplate();
        template.setName("car:Owner");
        NodeDefinitionTemplate childDefn = ntManager.createNodeDefinitionTemplate();
        childDefn.setSameNameSiblings(false);
        childDefn.setName("*");
        childDefn.setRequiredPrimaryTypeNames(new String[] {"car:Car"});
View Full Code Here


    protected void registerCarCarrierNodeType( Session session ) throws RepositoryException {
        NodeTypeManager ntManager = session.getWorkspace().getNodeTypeManager();
        try {
            ntManager.getNodeType(CAR_CARRIER_TYPENAME);
        } catch (NoSuchNodeTypeException e) {
            NodeTypeTemplate nt = ntManager.createNodeTypeTemplate();
            nt.setName(CAR_CARRIER_TYPENAME);
            // Children ...
            NodeDefinitionTemplate carChildType = ntManager.createNodeDefinitionTemplate();
            carChildType.setRequiredPrimaryTypeNames(new String[] {CAR_TYPENAME});
            nt.getNodeDefinitionTemplates().add(carChildType);
View Full Code Here

    }

    @SuppressWarnings( "unchecked" )
    protected static List<NodeTypeDefinition> getTestTypes() throws RepositoryException, ConstraintViolationException {
        NodeTypeManager mgr = session.getWorkspace().getNodeTypeManager();
        NodeTypeTemplate constrainedType = mgr.createNodeTypeTemplate();
        constrainedType.setName("modetest:constrainedType");

        PropertyDefinitionTemplate propBinary = mgr.createPropertyDefinitionTemplate();
        propBinary.setName("modetest:constrainedBinary");
        propBinary.setRequiredType(PropertyType.BINARY);
View Full Code Here

                // First create a namespace for the nodeType which is going to be added
                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();
View Full Code Here

        MultiUseAbstractTest.beforeAll();

        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

            privilegeManager.registerPrivilege("test:privilege", false, null);
            privilegeManager.registerPrivilege(
                    "test:aggregate", false, new String[] { "jcr:read", "test:privilege" });

            NodeTypeManager nodeTypeManager = workspace.getNodeTypeManager();
            NodeTypeTemplate template = nodeTypeManager.createNodeTypeTemplate();
            template.setName("test:unstructured");
            template.setDeclaredSuperTypeNames(
                    new String[] {"nt:unstructured"});
            PropertyDefinitionTemplate pDef1 = nodeTypeManager.createPropertyDefinitionTemplate();
            pDef1.setName("defaultString");
View Full Code Here

            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"});
            nodeTypeManager.registerNodeType(template, false);
View Full Code Here

    public static String createNodeType(Session session, String name,
            String[] properties, int propTypes[], String[] superTypes, String[] childrenTypes,
            String baseType, boolean isMixin)
            throws RepositoryException {
        NodeTypeManager ntm = session.getWorkspace().getNodeTypeManager();
        NodeTypeTemplate ntt = ntm.createNodeTypeTemplate();
        if (baseType != null) {
            NodeTypeDefinition ntd = ntm.getNodeType(baseType);
            ntt = ntm.createNodeTypeTemplate(ntd);
        }
View Full Code Here

            throws RepositoryException {
        NodeTypeManager ntm = session.getWorkspace().getNodeTypeManager();
        NodeTypeTemplate ntt = ntm.createNodeTypeTemplate();
        if (baseType != null) {
            NodeTypeDefinition ntd = ntm.getNodeType(baseType);
            ntt = ntm.createNodeTypeTemplate(ntd);
        }

        if ((superTypes != null) && (superTypes.length != 0)) {
            ntt.setDeclaredSuperTypeNames(superTypes);
        }
View Full Code Here

    @Before
    public void setup() throws RepositoryException {
        Session session = getAdminSession();

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