private final void addDefinitions( JcrNodeType nodeType ) {
Set<Name> namesFromThisType = new HashSet<Name>();
for (JcrNodeDefinition definition : nodeType.childNodeDefinitions()) {
Name name = definition.getInternalName();
/*
* If the child node was already defined in the type hierarchy at some other level, ignore the definition
* - it was overridden by the previous definition. This relies on the fact that TypeA.getTypeAndSupertypes()
* always returns TypeX before TypeY if TypeX is closer to TypeA on the inheritance graph than TypeY is...
*
* ...UNLESS this is a residual definition, in which case side-by-side definitions must be allowed per 6.7.8
* of the 1.0.1 specification.
*/
if (allChildNodeDefinitions.containsKey(name) && !namesFromThisType.contains(name)
&& !JcrNodeType.RESIDUAL_NAME.equals(name)) {
continue;
}
if (definition.allowsSameNameSiblings()) {
childNodeDefinitionsThatAllowSns.put(name, definition);
} else {
childNodeDefinitionsThatAllowNoSns.put(name, definition);
}
allChildNodeDefinitions.put(name, definition);
namesFromThisType.add(name);
}
namesFromThisType.clear();
for (JcrPropertyDefinition definition : nodeType.propertyDefinitions()) {
Name name = definition.getInternalName();
/*
* If the property was already defined in the type hierarchy at some other level, ignore the definition
* - it was overridden by the previous definition. This relies on the fact that TypeA.getTypeAndSupertypes()
* always returns TypeX before TypeY if TypeX is closer to TypeA on the inheritance graph than TypeY is...