use of com.haulmont.cuba.core.sys.validation.CubaValidationMessagesInterpolator in project cuba by cuba-platform.
the class BeanValidationImpl method getValidatorFactoryConfiguration.
protected HibernateValidatorConfiguration getValidatorFactoryConfiguration(Supplier<Locale> localeSupplier) {
HibernateValidatorConfiguration configuration = Validation.byProvider(HibernateValidator.class).configure().clockProvider(new CubaValidationTimeProvider(timeSource)).traversableResolver(new CubaValidationTraversableResolver(metadata, entityStates)).messageInterpolator(new CubaValidationMessagesInterpolator(messages, localeSupplier));
ConstraintMapping constraintMapping = configuration.createConstraintMapping();
// Hibernate validators doesn't support java.sql.Date.
// Replace standard validators for java.util.Date with support java.sql.Date
registerPastValidators(constraintMapping.constraintDefinition(Past.class));
registerPastOrPresentValidators(constraintMapping.constraintDefinition(PastOrPresent.class));
registerFutureValidators(constraintMapping.constraintDefinition(Future.class));
registerFutureOrPresentValidators(constraintMapping.constraintDefinition(FutureOrPresent.class));
configuration.addMapping(constraintMapping);
return configuration;
}
Aggregations