@SuppressWarnings("UnusedDeclaration") public static void activate(ActivationContext activationContext) { final ValidatorFactory factory; try { factory = getValidatorFactory( activationContext ); } catch (IntegrationException e) { if ( activationContext.getValidationModes().contains( ValidationMode.CALLBACK ) ) { throw new IntegrationException( "Bean Validation provider was not available, but 'callback' validation was requested", e ); } if ( activationContext.getValidationModes().contains( ValidationMode.DDL ) ) { throw new IntegrationException( "Bean Validation provider was not available, but 'ddl' validation was requested", e ); } LOG.debug( "Unable to acquire Bean Validation ValidatorFactory, skipping activation" ); return; } applyRelationalConstraints( factory, activationContext ); applyCallbackListeners( factory, activationContext ); }
@SuppressWarnings({"unchecked", "UnusedParameters"}) private static void applyRelationalConstraints(ValidatorFactory factory, ActivationContext activationContext) { final ConfigurationService cfgService = activationContext.getServiceRegistry().getService( ConfigurationService.class ); if ( !cfgService.getSetting( BeanValidationIntegrator.APPLY_CONSTRAINTS, StandardConverters.BOOLEAN, true ) ) { LOG.debug( "Skipping application of relational constraints from legacy Hibernate Validator" ); return; } final Set<ValidationMode> modes = activationContext.getValidationModes(); if ( ! ( modes.contains( ValidationMode.DDL ) || modes.contains( ValidationMode.AUTO ) ) ) { return; } applyRelationalConstraints( factory, activationContext.getMetadata().getEntityBindings(), cfgService.getSettings(), activationContext.getServiceRegistry().getService( JdbcServices.class ).getDialect(), new ClassLoaderAccessImpl( null, activationContext.getServiceRegistry().getService( ClassLoaderService.class ) ) ); }
@SuppressWarnings("UnusedDeclaration") public static void activate(ActivationContext activationContext) { final ValidatorFactory factory; try { factory = getValidatorFactory( activationContext ); } catch (IntegrationException e) { if ( activationContext.getValidationModes().contains( ValidationMode.CALLBACK ) ) { throw new IntegrationException( "Bean Validation provider was not available, but 'callback' validation was requested", e ); } if ( activationContext.getValidationModes().contains( ValidationMode.DDL ) ) { throw new IntegrationException( "Bean Validation provider was not available, but 'ddl' validation was requested", e ); } LOG.debug( "Unable to acquire Bean Validation ValidatorFactory, skipping activation" ); return; } applyRelationalConstraints( factory, activationContext ); applyCallbackListeners( factory, activationContext ); }
@SuppressWarnings({"unchecked", "UnusedParameters"}) private static void applyRelationalConstraints(ValidatorFactory factory, ActivationContext activationContext) { final ConfigurationService cfgService = activationContext.getServiceRegistry().getService( ConfigurationService.class ); if ( !cfgService.getSetting( BeanValidationIntegrator.APPLY_CONSTRAINTS, StandardConverters.BOOLEAN, true ) ) { LOG.debug( "Skipping application of relational constraints from legacy Hibernate Validator" ); return; } final Set<ValidationMode> modes = activationContext.getValidationModes(); if ( ! ( modes.contains( ValidationMode.DDL ) || modes.contains( ValidationMode.AUTO ) ) ) { return; } applyRelationalConstraints( factory, JavaTypeHelper.cast( activationContext.getMetadata().getEntityMappings() ), cfgService.getSettings(), activationContext.getServiceRegistry().getService( JdbcServices.class ).getDialect(), new ClassLoaderAccessImpl( null, activationContext.getServiceRegistry().getService( ClassLoaderService.class ) ) ); }