}
// check ambiguous definitions
if (qDef.definesNode() == qItemDef.definesNode()) {
if (!qDef.definesNode()) {
// property definition
QPropertyDefinition pd = (QPropertyDefinition) qDef;
QPropertyDefinition epd = (QPropertyDefinition) qItemDef;
// compare type & multiValued flag
if (pd.getRequiredType() == epd.getRequiredType()
&& pd.isMultiple() == epd.isMultiple()) {
// conflict
String msg = "The property definition for '"
+ name + "' in node type '"
+ qDef.getDeclaringNodeType()
+ "' conflicts with the one of node type '"
+ qItemDef.getDeclaringNodeType()
+ "': ambiguous property definition. "
+ "they must differ in required type "
+ "or cardinality.";
log.debug(msg);
throw new ConstraintViolationException(msg);
}
} else {
// child node definition
// conflict
String msg = "The child node definition for '"
+ name + "' in node type '"
+ qDef.getDeclaringNodeType()
+ "' conflicts with the one of node type '"
+ qItemDef.getDeclaringNodeType()
+ "': ambiguous child node definition. name must differ.";
log.debug(msg);
throw new ConstraintViolationException(msg);
}
}
}
}
} else {
existingDefs = new ArrayList<QItemDefinition>();
namedItemDefs.put(name, existingDefs);
}
existingDefs.add(qDef);
}
// residual item definitions
defs = other.getUnnamedItemDefs();
for (int i = 0; i < defs.length; i++) {
QItemDefinition qDef = defs[i];
if (includesNodeType(qDef.getDeclaringNodeType())) {
// ignore redundant definitions
continue;
}
for (QItemDefinition existing : unnamedItemDefs) {
// compare with existing definition
if (qDef.definesNode() == existing.definesNode()) {
if (!qDef.definesNode()) {
// property definition
QPropertyDefinition pd = (QPropertyDefinition) qDef;
QPropertyDefinition epd = (QPropertyDefinition) existing;
// compare type & multiValued flag
if (pd.getRequiredType() == epd.getRequiredType()
&& pd.isMultiple() == epd.isMultiple()
&& pd.getOnParentVersion() == epd.getOnParentVersion()) {
// conflict
// TODO: need to take more aspects into account
// TODO: getMatchingPropDef needs to check this as well
String msg = "A property definition in node type '"
+ qDef.getDeclaringNodeType()