if (isRoot) {
try {
definition = nodeTypes().getRootNodeDefinition();
} catch (RepositoryException e) {
// Shouldn't really happen ...
throw new ValidationException(e.getMessage(), e);
}
} else {
Name childName = node.getName();
Node<JcrNodePayload, JcrPropertyPayload> parent = node.getParent();
JcrNodePayload parentInfo = parent.getPayload();
int numExistingChildrenWithSameName = parent.getChildrenCount(childName);
// The children include this node, so we need to subtract one from the count so that the
// number of existing children is either 0 (if there are no other SNS nodes) or 1+
// (if there are at least 2 SNS nodes)
--numExistingChildrenWithSameName;
definition = nodeTypes().findChildNodeDefinition(parentInfo.getPrimaryTypeName(),
parentInfo.getMixinTypeNames(),
childName,
primaryTypeName,
numExistingChildrenWithSameName,
false);
}
}
if (definition == null) {
String msg = JcrI18n.nodeDefinitionCouldNotBeDeterminedForNode.text(readable(node.getPath()),
workspaceName(),
sourceName());
throw new ValidationException(msg);
}
// ------------------------------------------------------
// Set the node's properties ...
// ------------------------------------------------------
boolean referenceable = false;
// Start with the primary type ...
JcrNodeType primaryType = nodeTypes().getNodeType(primaryTypeName);
if (primaryType == null) {
Path path = location.getPath();
String msg = JcrI18n.missingNodeTypeForExistingNode.text(readable(primaryTypeName),
readable(path),
workspaceName(),
sourceName());
throw new ValidationException(msg);
}
if (primaryType.isNodeType(JcrMixLexicon.REFERENCEABLE)) referenceable = true;
// The process the mixin types ...
Property mixinTypesProperty = graphProperties.get(JcrLexicon.MIXIN_TYPES);