Iterator<ExtendedNodeType> iterator = getNodeTypesIterator();
while (iterator.hasNext()) {
ExtendedNodeType type = iterator.next();
final Map<String, ExtendedNodeDefinition> definitionMap = type.getChildNodeDefinitionsAsMap();
if (definitionMap.containsKey(childName)) {
ExtendedNodeDefinition epd = definitionMap.get(childName);
for (String req : epd.getRequiredPrimaryTypeNames()) {
if (requiredType.isNodeType(req)) {
return epd;
}
}
throw new ConstraintViolationException("Definition type for " + childName + " on node " + getName() + " (" + getPrimaryNodeTypeName() + ") does not match " + nodeType);
}
types.add(type);
}
for (ExtendedNodeType type : types) {
for (ExtendedNodeDefinition epd : type.getUnstructuredChildNodeDefinitions().values()) {
for (String req : epd.getRequiredPrimaryTypeNames()) {
if (requiredType.isNodeType(req)) {
return epd;
}
}
}