Examples of countSiblingsNamed()


Examples of org.modeshape.jcr.cache.SiblingCounter.countSiblingsNamed()

        NodeTypes nodeTypes = session().nodeTypes();
        final SiblingCounter siblingCounter = SiblingCounter.create(node, cache);

        if (childPrimaryNodeTypeName != null) {
            if (INTERNAL_NODE_TYPE_NAMES.contains(childPrimaryNodeTypeName)) {
                int numExistingSns = siblingCounter.countSiblingsNamed(childName);
                String workspaceName = workspaceName();
                String childPath = readable(session.pathFactory().create(path(), childName, numExistingSns + 1));
                String msg = JcrI18n.unableToCreateNodeWithInternalPrimaryType.text(childPrimaryNodeTypeName, childPath,
                                                                                    workspaceName);
                throw new ConstraintViolationException(msg);
View Full Code Here

Examples of org.modeshape.jcr.cache.SiblingCounter.countSiblingsNamed()

                                                                                    workspaceName);
                throw new ConstraintViolationException(msg);
            }
            JcrNodeType primaryType = nodeTypes.getNodeType(childPrimaryNodeTypeName);
            if (primaryType == null) {
                int numExistingSns = siblingCounter.countSiblingsNamed(childName);
                Path pathForChild = session.pathFactory().create(path(), childName, numExistingSns + 1);
                I18n msg = JcrI18n.unableToCreateNodeWithPrimaryTypeThatDoesNotExist;
                throw new NoSuchNodeTypeException(msg.text(childPrimaryNodeTypeName, pathForChild, workspaceName()));
            }
View Full Code Here

Examples of org.modeshape.jcr.cache.SiblingCounter.countSiblingsNamed()

        }
        assert childDefn != null;

        if (childPrimaryNodeTypeName == null && childDefn.getDefaultPrimaryType() == null) {
            // There is no default primary type ...
            int numExistingSns = siblingCounter.countSiblingsNamed(childName);
            String childPath = readable(session.pathFactory().create(path(), childName, numExistingSns + 1));
            I18n msg = JcrI18n.unableToCreateNodeWithNoDefaultPrimaryTypeOnChildNodeDefinition;
            String nodeTypeName = childDefn.getDeclaringNodeType().getName();
            throw new ConstraintViolationException(msg.text(childDefn.getName(), nodeTypeName, childPath, workspaceName()));
        }
View Full Code Here

Examples of org.modeshape.jcr.cache.SiblingCounter.countSiblingsNamed()

            ChildReferences refs = node.getChildReferences(cache());
            // Create a sibling counter that reduces the count by 1, since we're always dealing with existing children
            // but the 'findBestDefinitionForChild' logic is looking to *add* a child ...
            SiblingCounter siblingCounter = SiblingCounter.alter(SiblingCounter.create(refs), -1);
            for (Name nodeName : mixinChildNodeNames) {
                int snsCount = siblingCounter.countSiblingsNamed(nodeName);
                if (snsCount == 0) continue;
                Iterator<ChildReference> iter = refs.iterator(nodeName);
                while (iter.hasNext()) {
                    ChildReference ref = iter.next();
                    CachedNode child = cache.getNode(ref);
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.