synchronized (graphManager) {
if (graphManager.hasChanges()) {
if (isValidatingObjectsOnCommit()) {
ValidationResult result = new ValidationResult();
Iterator<?> it = graphManager.dirtyNodes().iterator();
while (it.hasNext()) {
Persistent p = (Persistent) it.next();
if (p instanceof Validating) {
switch (p.getPersistenceState()) {
case PersistenceState.NEW:
((Validating) p).validateForInsert(result);
break;
case PersistenceState.MODIFIED:
((Validating) p).validateForUpdate(result);
break;
case PersistenceState.DELETED:
((Validating) p).validateForDelete(result);
break;
}
}
}
if (result.hasFailures()) {
throw new ValidationException(result);
}
}
graphManager.graphCommitStarted();