if (objectsToValidate != null) {
ValidationResult result = new ValidationResult();
Iterator validationIt = objectsToValidate.iterator();
while (validationIt.hasNext()) {
Validating object = (Validating) validationIt.next();
switch (((Persistent) object).getPersistenceState()) {
case PersistenceState.NEW:
object.validateForInsert(result);
break;
case PersistenceState.MODIFIED:
object.validateForUpdate(result);
break;
case PersistenceState.DELETED:
object.validateForDelete(result);
break;
}
}
if (result.hasFailures()) {