if (refs.hasReferences() && !local.has(targetId)) {
String msg =
node.getNodeId() + " cannot be removed"
+ " because it is still being referenced";
log.debug("{} from {}", msg, refs.getReferences());
throw new ReferentialIntegrityException(msg);
}
}
}
}
// check whether targets of modified node references exist
for (NodeReferences refs : local.modifiedRefs()) {
// no need to check existence of target if there are no references
if (refs.hasReferences()) {
// please note:
// virtual providers are indirectly checked via 'hasItemState()'
NodeId id = refs.getTargetId();
if (!local.has(id) && !hasItemState(id)) {
String msg = "Target node " + id
+ " of REFERENCE property does not exist";
log.debug(msg);
throw new ReferentialIntegrityException(msg);
}
}
}
}