Commit d6dac5c4 authored by Ate Douma's avatar Ate Douma

CMS-9876: correct order of logic for ContentType definition merging

The registration of the merged superTypes and aggregatedTypes must be done *after* merging the properties and children otherwise they may incorrectly be flagged as already been merged (inherited).
parent 4642e25a
......@@ -263,15 +263,6 @@ public class ContentTypeImpl extends Sealable implements ContentType {
name = null;
prefix = null;
superTypes.addAll(other.superTypes);
if (superType) {
superTypes.addAll(other.aggregatedTypes);
}
else {
aggregatedTypes.addAll(other.aggregatedTypes);
}
if (!other.isCompoundType()) {
this.compoundType = false;
}
......@@ -318,7 +309,7 @@ public class ContentTypeImpl extends Sealable implements ContentType {
if (cti != null) {
// duplicate property name
if (cti.isMultiple() != entry.getValue().isMultiple() ||
cti.getEffectiveType().equals(entry.getValue().getEffectiveType())) {
!cti.getEffectiveType().equals(entry.getValue().getEffectiveType())) {
log.error("Conflicting ContentType property named {} encountered while merging ContentType {} into {}. Incoming property ignored."
, new String[]{cti.getName(), other.getName(), getName()});
}
......@@ -339,6 +330,15 @@ public class ContentTypeImpl extends Sealable implements ContentType {
}
}
superTypes.addAll(other.superTypes);
if (superType) {
superTypes.addAll(other.aggregatedTypes);
}
else {
aggregatedTypes.addAll(other.aggregatedTypes);
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment