/**
* there already exists at least one definition with that
* name; make sure none of them is auto-create
*/
for (int j = 0; j < defs.size(); j++) {
QItemDefinition qDef = (QItemDefinition) defs.get(j);
if (cnda[i].isAutoCreated() || qDef.isAutoCreated()) {
// conflict
String msg = "There are more than one 'auto-create' item definitions for '"
+ name + "' in node type '" + ntName + "'";
log.debug(msg);
throw new ConstraintViolationException(msg);
}
}
}
defs.add(cnda[i]);
}
}
QPropertyDefinition[] pda = ntd.getPropertyDefs();
for (int i = 0; i < pda.length; i++) {
// check if property definition would be ambiguous within
// this node type definition
if (itemDefIds.contains(pda[i])) {
// conflict
String msg;
if (pda[i].definesResidual()) {
msg = ntName + " contains ambiguous residual property definitions";
} else {
msg = ntName + " contains ambiguous definitions for property named "
+ pda[i].getName();
}
log.debug(msg);
throw new ConstraintViolationException(msg);
} else {
itemDefIds.add(pda[i]);
}
if (pda[i].definesResidual()) {
// residual property definition
unnamedItemDefs.add(pda[i]);
} else {
// named property definition
Name name = pda[i].getName();
List defs = (List) namedItemDefs.get(name);
if (defs == null) {
defs = new ArrayList();
namedItemDefs.put(name, defs);
}
if (defs.size() > 0) {
/**
* there already exists at least one definition with that
* name; make sure none of them is auto-create
*/
for (int j = 0; j < defs.size(); j++) {
QItemDefinition qDef = (QItemDefinition) defs.get(j);
if (pda[i].isAutoCreated() || qDef.isAutoCreated()) {
// conflict
String msg = "There are more than one 'auto-create' item definitions for '"
+ name + "' in node type '" + ntName + "'";
log.debug(msg);
throw new ConstraintViolationException(msg);