use of com.haulmont.cuba.gui.components.validators.BeanValidator in project cuba by cuba-platform.
the class WebAbstractField method initBeanValidator.
protected void initBeanValidator() {
MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME);
MetaClass propertyEnclosingMetaClass = metadataTools.getPropertyEnclosingMetaClass(metaPropertyPath);
Class enclosingJavaClass = propertyEnclosingMetaClass.getJavaClass();
if (enclosingJavaClass != KeyValueEntity.class && !DynamicAttributesUtils.isDynamicAttribute(metaProperty)) {
BeanValidation beanValidation = AppBeans.get(BeanValidation.NAME);
javax.validation.Validator validator = beanValidation.getValidator();
BeanDescriptor beanDescriptor = validator.getConstraintsForClass(enclosingJavaClass);
if (beanDescriptor.isBeanConstrained()) {
addValidator(new BeanValidator(enclosingJavaClass, metaProperty.getName()));
}
}
}
use of com.haulmont.cuba.gui.components.validators.BeanValidator in project cuba by cuba-platform.
the class DesktopAbstractField method initBeanValidator.
protected void initBeanValidator() {
MetadataTools metadataTools = AppBeans.get(MetadataTools.NAME);
MetaClass propertyEnclosingMetaClass = metadataTools.getPropertyEnclosingMetaClass(metaPropertyPath);
Class enclosingJavaClass = propertyEnclosingMetaClass.getJavaClass();
if (enclosingJavaClass != KeyValueEntity.class && !DynamicAttributesUtils.isDynamicAttribute(metaProperty)) {
BeanValidation beanValidation = AppBeans.get(BeanValidation.NAME);
javax.validation.Validator validator = beanValidation.getValidator();
BeanDescriptor beanDescriptor = validator.getConstraintsForClass(enclosingJavaClass);
if (beanDescriptor.isBeanConstrained()) {
addValidator(new BeanValidator(enclosingJavaClass, metaProperty.getName()));
}
}
}
Aggregations