// the import has been aborted, get outta here...
return;
}
boolean succeeded = false;
NodeState parent;
try {
// check sanity of workspace/session first
wsp.sanityCheck();
parent = (NodeState) parents.peek();
// process node
NodeState node = null;
NodeId id = nodeInfo.getId();
QName nodeName = nodeInfo.getName();
QName ntName = nodeInfo.getNodeTypeName();
QName[] mixins = nodeInfo.getMixinNames();
if (parent == null) {
// parent node was skipped, skip this child node also
parents.push(null); // push null onto stack for skipped node
succeeded = true;
log.debug("skipping node " + nodeName);
return;
}
if (parent.hasChildNodeEntry(nodeName)) {
// a node with that name already exists...
NodeState.ChildNodeEntry entry =
parent.getChildNodeEntry(nodeName, 1);
NodeId idExisting = entry.getId();
NodeState existing = (NodeState) itemOps.getItemState(idExisting);
NodeDef def = ntReg.getNodeDef(existing.getDefinitionId());
if (!def.allowsSameNameSiblings()) {
// existing doesn't allow same-name siblings,
// check for potential conflicts
EffectiveNodeType entExisting =
itemOps.getEffectiveNodeType(existing);
if (def.isProtected() && entExisting.includesNodeType(ntName)) {
// skip protected node
parents.push(null); // push null onto stack for skipped node
succeeded = true;
log.debug("skipping protected node "
+ itemOps.safeGetJCRPath(existing.getNodeId()));
return;
}
if (def.isAutoCreated() && entExisting.includesNodeType(ntName)) {
// this node has already been auto-created,
// no need to create it
node = existing;
} else {
throw new ItemExistsException(itemOps.safeGetJCRPath(existing.getNodeId()));
}
}
}
if (node == null) {
// there's no node with that name...
if (id == null) {
// no potential uuid conflict, always create new node
NodeDef def = itemOps.findApplicableNodeDefinition(
nodeName, ntName, parent);
if (def.isProtected()) {
// skip protected node
parents.push(null); // push null onto stack for skipped node
succeeded = true;
log.debug("skipping protected node " + nodeName);
return;
}
if (parent.hasPropertyName(nodeName)) {
resolvePropertyNameConflict(parent, nodeName);
}
// check if new node can be added (check access rights &
// node type constraints only, assume locking & versioning status
// has already been checked on ancestor)
itemOps.checkAddNode(parent, nodeName, ntName,
BatchedItemOperations.CHECK_ACCESS
| BatchedItemOperations.CHECK_CONSTRAINTS);
// do create new node
node = itemOps.createNodeState(parent, nodeName, ntName, mixins, null, def);
} else {
// potential uuid conflict
try {
NodeState conflicting = itemOps.getNodeState(id);
// resolve uuid conflict
node = resolveUUIDConflict(parent, conflicting, nodeInfo);
} catch (ItemNotFoundException e) {
// create new with given uuid
NodeDef def = itemOps.findApplicableNodeDefinition(