ChildNodeEntry cne = thisState.getChildNodeEntry(nodeName, 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(
"This node already exists: "
+ itemMgr.safeGetJCRPath(nodePath));
}
// check same-name sibling setting of existing node
NodeImpl existing = itemMgr.getNode(cne.getId(), getNodeId());
if (!existing.getDefinition().allowsSameNameSiblings()) {
throw new ItemExistsException(
"Same-name siblings not allowed for " + existing);
}
}
// check protected flag of parent (i.e. this) node and retention/hold