@Override
public Validator childNodeAdded(String name, NodeState after) throws CommitFailedException {
try {
getParentType().checkAddChildNode(name, getNodeType(after));
ReadOnlyTree addedTree = new ReadOnlyTree(parent, name, after);
EffectiveNodeType addedType = ntm.getEffectiveNodeType(addedTree);
addedType.checkMandatoryItems(addedTree);
return new TypeValidator(ntm, new ReadOnlyTree(parent, name, after), mapper);
} catch (RepositoryException e) {
throw new CommitFailedException("Cannot add node '" + name + "' at " + parent.getPath(), e);
} catch (IllegalStateException e) {
throw new CommitFailedException("Cannot add node '" + name + "' at " + parent.getPath(), e);
}