use of com.evolveum.midpoint.web.util.validation.MidpointFormValidator in project midpoint by Evolveum.
the class PageAdminObjectDetails method performCustomValidation.
protected Collection<SimpleValidationError> performCustomValidation(PrismObject<O> object, Collection<ObjectDelta<? extends ObjectType>> deltas) throws SchemaException {
Collection<SimpleValidationError> errors = null;
if (object == null) {
if (getObjectWrapper() != null && getObjectWrapper().getObject() != null) {
// otherwise original object could get corrupted e.g. by applying the delta below
object = getObjectWrapper().getObject().clone();
for (ObjectDelta delta : deltas) {
// because among deltas there can be also ShadowType deltas
if (UserType.class.isAssignableFrom(delta.getObjectTypeClass())) {
delta.applyTo(object);
}
}
}
} else {
object = object.clone();
}
performAdditionalValidation(object, deltas, errors);
for (MidpointFormValidator validator : getFormValidatorRegistry().getValidators()) {
if (errors == null) {
errors = validator.validateObject(object, deltas);
} else {
errors.addAll(validator.validateObject(object, deltas));
}
}
return errors;
}
Aggregations