Skip to content

Commit

Permalink
HHH-7503 removing applyDDL(EntityBinding entityBinding, Class<?> claz…
Browse files Browse the repository at this point in the history
…z, ValidatorFactory factory, Set<Class<?>> groups, Dialect dialect) and inlining the code
  • Loading branch information
hferentschik committed Aug 23, 2012
1 parent 914eaeb commit 88d75b5
Showing 1 changed file with 13 additions and 16 deletions.
Expand Up @@ -262,28 +262,20 @@ public static void applyDDL(Iterable<EntityBinding> bindings,
throw new AssertionFailure( "Entity class not found", error );
}
try {
applyDDL( binding, clazz, factory, groups, dialect );
final BeanDescriptor descriptor = factory.getValidator().getConstraintsForClass( clazz );
for ( PropertyDescriptor propertyDescriptor : descriptor.getConstrainedProperties() ) {
AttributeBinding attributeBinding = binding.locateAttributeBinding( propertyDescriptor.getPropertyName() );
if ( attributeBinding != null ) {
applyConstraints( propertyDescriptor, groups, attributeBinding, dialect );
}
}
}
catch ( Exception error ) {
LOG.unableToApplyConstraints( className, error );
}
}
}

private static void applyDDL(EntityBinding entityBinding,
Class<?> clazz,
ValidatorFactory factory,
Set<Class<?>> groups,
Dialect dialect) {
final BeanDescriptor descriptor = factory.getValidator().getConstraintsForClass( clazz );
for ( PropertyDescriptor propertyDescriptor : descriptor.getConstrainedProperties() ) {
AttributeBinding attributeBinding = entityBinding.locateAttributeBinding( propertyDescriptor.getPropertyName() );
if ( attributeBinding != null ) {
applyConstraints( propertyDescriptor, groups, attributeBinding, dialect );
}
}
}

private static void applyConstraints(PropertyDescriptor propertyDescriptor,
Set<Class<?>> groups,
AttributeBinding attributeBinding,
Expand All @@ -298,7 +290,12 @@ private static void applyConstraints(PropertyDescriptor propertyDescriptor,
schemaConstraint.applyConstraint( attributeBinding, constraintDescriptor, propertyDescriptor, dialect );
}

notNullSchemaConstraint.applyConstraint( attributeBinding, constraintDescriptor, propertyDescriptor, dialect );
notNullSchemaConstraint.applyConstraint(
attributeBinding,
constraintDescriptor,
propertyDescriptor,
dialect
);
}
}

Expand Down

0 comments on commit 88d75b5

Please sign in to comment.