Package javax.jcr.nodetype

Examples of javax.jcr.nodetype.NodeDefinition


            if (residuals > 1) {
                // more than one residual, not suitable for tests
                continue;
            }

            NodeDefinition nodeDefs[] = type.getDeclaredChildNodeDefinitions();

            for (int i = 0; i < nodeDefs.length; i++) {
                NodeDefinition nodeDef = nodeDefs[i];

                if (nodeDef.getRequiredPrimaryTypes().length > 1) {
                    // behaviour of implementations that support multiple multiple inheritance
                    // of primary node types is not specified
                    continue;
                }

                if (regardDefaultPrimaryType) {

                    if (defaultPrimaryType && nodeDef.getDefaultPrimaryType() == null) {
                        continue;
                    }

                    if (!defaultPrimaryType && nodeDef.getDefaultPrimaryType() != null) {
                        continue;
                    }
                }

                if (residual && !nodeDef.getName().equals("*")) {
                    continue;
                }

                if (!residual) {
                    // if another child node def is a residual definition
                    // overjump the current node type
                    NodeDefinition nodeDefsAll[] = type.getChildNodeDefinitions();
                    for (int j = 0; j < nodeDefsAll.length; j++) {
                        if (nodeDefsAll[j].getName().equals("*")) {
                            overjump = true;
                            break;
                        }
View Full Code Here


        NodeTypeManager manager = session.getWorkspace().getNodeTypeManager();
        NodeTypeIterator types = manager.getAllNodeTypes();

        while (types.hasNext()) {
            NodeType type = types.nextNodeType();
            NodeDefinition nodeDefs[] = type.getDeclaredChildNodeDefinitions();

            for (int i = 0; i < nodeDefs.length; i++) {
                NodeDefinition nodeDef = nodeDefs[i];

                if (nodeDef.getName().equals("*")) {
                    continue;
                }

                if (isProtected && !nodeDef.isProtected()) {
                    continue;
                }
                if (!isProtected && nodeDef.isProtected()) {
                    continue;
                }

                if (mandatory && !nodeDef.isMandatory()) {
                    continue;
                }
                if (!mandatory && nodeDef.isMandatory()) {
                    continue;
                }

                return nodeDef;
            }
View Full Code Here

    /**
     * Returns a name that is not defined by the nodeType's child node def
     */
    public static String getUndefinedChildNodeName(NodeType nodeType) {

        NodeDefinition nodeDefs[] = nodeType.getChildNodeDefinitions();
        StringBuffer s = new StringBuffer("X");

        for (int i = 0; i < nodeDefs.length; i++) {
            s.append(nodeDefs[i].getName());
        }
View Full Code Here

        NodeTypeIterator types = manager.getAllNodeTypes();
        // loop all node types
        while (types.hasNext()) {
            NodeType currentType = types.nextNodeType();
            NodeDefinition defsOfCurrentType[] =
                    currentType.getChildNodeDefinitions();

            // loop all child node defs of each node type
            for (int i = 0; i < defsOfCurrentType.length; i++) {
                NodeDefinition def = defsOfCurrentType[i];
                NodeType type = def.getDeclaringNodeType();

                // check if def is part of the child node defs of the
                // declaring node type
                NodeDefinition defs[] = type.getChildNodeDefinitions();
                boolean hasType = false;
                for (int j = 0; j < defs.length; j++) {
                    if (defs[j].getName().equals(def.getName())) {
                        hasType = true;
                        break;
View Full Code Here

        NodeTypeIterator types = manager.getAllNodeTypes();
        // loop all node types
        while (types.hasNext()) {
            NodeType type = types.nextNodeType();
            NodeDefinition defs[] = type.getChildNodeDefinitions();
            for (int i = 0; i < defs.length; i++) {
                if (defs[i].isAutoCreated()) {
                    assertFalse("An auto create node must not be a " +
                            "residual set definition.",
                            defs[i].getName().equals("*"));
 
View Full Code Here

        NodeTypeIterator types = manager.getAllNodeTypes();
        // loop all node types
        while (types.hasNext()) {
            NodeType type = types.nextNodeType();
            NodeDefinition defs[] = type.getChildNodeDefinitions();

            for (int i = 0; i < defs.length; i++) {
                assertTrue("getRequiredPrimaryTypes() must never return an " +
                        "empty array.",
                        defs[i].getRequiredPrimaryTypes().length > 0);
View Full Code Here

        NodeTypeIterator types = manager.getAllNodeTypes();
        // loop all node types
        while (types.hasNext()) {
            NodeType type = types.nextNodeType();
            NodeDefinition defs[] = type.getChildNodeDefinitions();

            for (int i = 0; i < defs.length; i++) {

                NodeDefinition def = defs[i];
                NodeType defaultType = def.getDefaultPrimaryType();
                if (defaultType != null) {

                    NodeType requiredTypes[] =
                            def.getRequiredPrimaryTypes();

                    for (int j = 0; j < requiredTypes.length; j++) {
                        NodeType requiredType = requiredTypes[j];

                        boolean isSubType = compareWithRequiredType(requiredType,
View Full Code Here

     */
    public void testRestoreWithUUIDConflict() throws RepositoryException, NotExecutableException {
        try {
            Node naa = createVersionableNode(versionableNode, nodeName4, versionableNodeType);
            // Verify that nodes used for the test have proper opv behaviour
            NodeDefinition nd = naa.getDefinition();
            if (nd.getOnParentVersion() != OnParentVersionAction.COPY && nd.getOnParentVersion() != OnParentVersionAction.VERSION) {
                throw new NotExecutableException("Child nodes must have OPV COPY or VERSION in order to be able to test Node.restore with uuid conflict.");
            }

            Version v = versionableNode.checkin();
            versionableNode.checkout();
View Full Code Here

     * <code>ItemExistsException</code> if removeExisting is set to FALSE.
     */
    public void testWorkspaceRestoreWithUUIDConflict() throws RepositoryException, NotExecutableException {
        try {
            // Verify that nodes used for the test are indeed versionable
            NodeDefinition nd = wVersionableNode.getDefinition();
            if (nd.getOnParentVersion() != OnParentVersionAction.COPY && nd.getOnParentVersion() != OnParentVersionAction.VERSION) {
                throw new NotExecutableException("Nodes must be versionable in order to run this test.");
            }

            Version v = wVersionableNode.checkin();
            wVersionableNode.checkout();
View Full Code Here

     */
    private void checkMandatoryConstraint(Node node, NodeType type)
            throws RepositoryException {

        // test if node contains all mandatory nodes of current type
        NodeDefinition nodeDefs[] = type.getChildNodeDefinitions();
        for (int i = 0; i < nodeDefs.length; i++) {
            NodeDefinition nodeDef = nodeDefs[i];
            if (nodeDef.isMandatory()) {
                foundMandatoryNode = true;
                try {
                    node.getNode(nodeDef.getName());
                } catch (PathNotFoundException e) {
                    fail("Mandatory child " + nodeDef.getName() + " for " +
                            node.getPath() + " does not exist.");
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.jcr.nodetype.NodeDefinition

Copyright © 2018 www.massapicom. 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.