java.lang.Object
org.broadleafcommerce.openadmin.server.service.persistence.validation.BroadleafEntityValidator<T>
Type Parameters:
T - Persistence Entity implementation to validate

public abstract class BroadleafEntityValidator<T> extends Object
A Spring bean extending this class will automatically be called when validation is done on the entity specified by the generic type.

The persistent entity class that Hibernate is aware of should be used as the generic type. For example, SomeEntityImpl instead of SomeEntity interface.

In the implementation of validate Entity.addValidationError(String, String) and Entity.addValidationError(String, String) can be used to create an error that is displayed to the user before an add or update occurs. Entity.isValidationFailure() can be used to see if the core validation found any issues like required fields being blank to decide if any additional validation should be executed.

  • Constructor Details

    • BroadleafEntityValidator

      public BroadleafEntityValidator()
  • Method Details

    • validate

      public abstract void validate(Entity submittedEntity, @Nonnull T instance, Map<String,FieldMetadata> propertiesMetadata, RecordHelper recordHelper, boolean validateUnsubmittedProperties)
      Validation that should be done on the specified entity after core validation is completed.