Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.QNodeDefinition.allowsSameNameSiblings()


        }
        ChildNodeEntry cne = nodeState.getChildNodeEntry(name, 1);
        if (cne != null) {
            // there's already a child node entry with that name;
            // check same-name sibling setting of new node
            if (!def.allowsSameNameSiblings()) {
                throw new ItemExistsException(getNodeId() + "/" + name);
            }
            NodeState existingChild;
            try {
                // check same-name sibling setting of existing node
View Full Code Here


            } catch (ItemStateException e) {
                throw new RepositoryException(e);
            }
            QNodeDefinition existingChildDef = ent.getApplicableChildNodeDef(
                    cne.getName(), existingChild.getNodeTypeName(), ntReg);
            if (!existingChildDef.allowsSameNameSiblings()) {
                throw new ItemExistsException(existingChild.toString());
            }
        } else {
            // check if 'add' is allowed
            if (getDefinition().isProtected()) {
View Full Code Here

                NodeState conflictingState = parentState.getChildNodeState(nodeName, Path.INDEX_DEFAULT);
                QNodeDefinition conflictDef = conflictingState.getDefinition();
                QNodeDefinition newDef = mgrProvider.getItemDefinitionProvider().getQNodeDefinition(parentState.getAllNodeTypeNames(), nodeName, nodeTypeName);

                // check same-name sibling setting of both target and existing node
                if (!(conflictDef.allowsSameNameSiblings() && newDef.allowsSameNameSiblings())) {
                    throw new ItemExistsException("Cannot add child node '"
                            + nodeName.getLocalName() + "' to "
                            + safeGetJCRPath(parentState)
                            + ": colliding with same-named existing node.");
                }
View Full Code Here

    /** Test for the empty child node definition. */
    public void testEmptyNode() {
        QNodeDefinition def = getChildNode("childNodeType", "emptyNode");
        assertEquals("emptyNode allowsSameNameSiblings",
                false, def.allowsSameNameSiblings());
        assertEquals("emptyNode defaultPrimaryType",
                null, def.getDefaultPrimaryType());
    }

    /** Test for the <code>allowsSameNameSiblings</code> child node attribute. */
 
View Full Code Here

    /** Test for the <code>allowsSameNameSiblings</code> child node attribute. */
    public void testSiblingNode() {
        QNodeDefinition def = getChildNode("childNodeType", "siblingNode");
        assertEquals("siblingNode allowsSameNameSiblings",
                true, def.allowsSameNameSiblings());
    }

    /** Test for the <code>defaultPrimaryType</code> child node attribute. */
    public void testDefaultTypeNode() {
        QNodeDefinition def = getChildNode("childNodeType", "defaultTypeNode");
View Full Code Here

                                                Name name = parent.getChildNodeEntry(id).getName();
                                                EffectiveNodeType ent = ntReg.getEffectiveNodeType(
                                                        parent.getNodeTypeName(),
                                                        parent.getMixinTypeNames());
                                                QNodeDefinition def = ent.getApplicableChildNodeDef(name, ns.getNodeTypeName(), ntReg);
                                                return def != null ? def.allowsSameNameSiblings() : false;
                                            } catch (Exception e) {
                                                log.warn("Unable to get node definition", e);
                                                return false;
                                            }
                                        }
View Full Code Here

                                        Name name = parent.getChildNodeEntry(id).getName();
                                        EffectiveNodeType ent = ntReg.getEffectiveNodeType(
                                                parent.getNodeTypeName(),
                                                parent.getMixinTypeNames());
                                        QNodeDefinition def = ent.getApplicableChildNodeDef(name, ns.getNodeTypeName(), ntReg);
                                        return def != null ? def.allowsSameNameSiblings() : false;
                                    } catch (Exception e) {
                                        log.warn("Unable to get node definition", e);
                                        return false;
                                    }
                                }
View Full Code Here

                    && requiredPrimaryTypes.equals(new HashSet<Name>(
                            Arrays.asList(other.getRequiredPrimaryTypes())))
                    && (defaultPrimaryType == null
                            ? other.getDefaultPrimaryType() == null
                            : defaultPrimaryType.equals(other.getDefaultPrimaryType()))
                    && allowsSameNameSiblings == other.allowsSameNameSiblings();
        }
        return false;
    }

    /**
 
View Full Code Here

    /** Test for the empty child node definition. */
    public void testEmptyNode() {
        QNodeDefinition def = getChildNode("childNodeType", "emptyNode");
        assertEquals("emptyNode allowsSameNameSiblings",
                false, def.allowsSameNameSiblings());
        assertEquals("emptyNode defaultPrimaryType",
                null, def.getDefaultPrimaryType());
    }

    /** Test for the <code>allowsSameNameSiblings</code> child node attribute. */
 
View Full Code Here

    /** Test for the <code>allowsSameNameSiblings</code> child node attribute. */
    public void testSiblingNode() {
        QNodeDefinition def = getChildNode("childNodeType", "siblingNode");
        assertEquals("siblingNode allowsSameNameSiblings",
                true, def.allowsSameNameSiblings());
    }

    /** Test for the <code>defaultPrimaryType</code> child node attribute. */
    public void testDefaultTypeNode() {
        QNodeDefinition def = getChildNode("childNodeType", "defaultTypeNode");
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.