Class DefaultFulfillmentGroupSubmitValidator

java.lang.Object
com.broadleafcommerce.cartoperation.service.fulfillment.validation.DefaultFulfillmentGroupSubmitValidator
All Implemented Interfaces:
FulfillmentGroupSubmitValidator, FulfillmentValidator, org.springframework.validation.SmartValidator, org.springframework.validation.Validator

public class DefaultFulfillmentGroupSubmitValidator extends Object implements FulfillmentGroupSubmitValidator
Performs validation for a fulfillment group. This mainly delegates to other validators that are able to validate with more specific conditions.
Author:
Jacob Mitash
  • Constructor Details

  • Method Details

    • getSupportedClass

      public Class<?> getSupportedClass()
      Description copied from interface: FulfillmentValidator
      Gets the class that this validator supports.
      Specified by:
      getSupportedClass in interface FulfillmentValidator
      Returns:
      the class that this validator support
    • validate

      public void validate(@NonNull @NonNull Object target, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)
      Description copied from interface: FulfillmentValidator
      Validates the target.
      Specified by:
      validate in interface FulfillmentValidator
      Parameters:
      target - the target of the validation
      errors - an errors container to place rejections and pull values from
      hints - any hints that should be used during validation
    • validateWithDataHolder

      public void validateWithDataHolder(@NonNull @NonNull Object target, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints, @NonNull @NonNull FulfillmentValidationDataHolder dataHolder)
      Description copied from interface: FulfillmentValidator
      Validates the target and uses FulfillmentValidationDataHolder parameter that can be used to hold some additional data needed for the validation.
      Specified by:
      validateWithDataHolder in interface FulfillmentValidator
      Parameters:
      target - the target of the validation
      errors - an errors container to place rejections and pull values from
      hints - any hints that should be used during validation
      dataHolder - the state holder that can be used to store some additional data required for validation
    • validateBase

      protected void validateBase(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)
      Validates a fulfillment group at the top level, not considering nested or pricing fields. By default, this will also delegate to typeValidators to validate things that would be specific to the fulfillment type being used.
      Parameters:
      group - the fulfillment group to validate
      errors - an error container to place validation errors in
      hints - any hints to use when validating the group
    • validatePricing

      protected void validatePricing(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)
      Validates the price fields on the fulfillment group (top-level only- does not consider individual item prices).
      Parameters:
      group - the fulfillment group to validate
      errors - an error container to place validation errors in
      hints - any hints to use when validating the group
    • validateItems

      protected void validateItems(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)
      Validates the fulfillment items of the group. Delegates to itemValidators for the actual validation.
      Parameters:
      group - the fulfillment group to validate
      errors - an error container to place validation errors in
      hints - any hints to use when validating the group
    • validateOptions

      protected void validateOptions(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints)
      Validates the fulfillment option on this group. Delegates to optionValidators.
      Parameters:
      group - the fulfillment group to validate
      errors - an error container to place validation errors in
      hints - any hints to use when validating the group
    • validateOptions

      protected void validateOptions(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull Set<Object> hints, @Nullable FulfillmentValidationDataHolder dataHolder)
    • pricingFields

      protected Set<String> pricingFields()
      Produces a set of field names of pricing fields that should be validated. These are the simple field names (i.e. no nested paths).
      Returns:
      the price field names
    • getTypeValidators

      protected Set<TypeFulfillmentGroupSubmitValidator> getTypeValidators()
    • getItemValidators

      protected Set<FulfillmentItemSubmitValidator> getItemValidators()
    • getOptionValidators

      protected Set<FulfillmentOptionSubmitValidator> getOptionValidators()
    • getPricedFulfillmentOptionSubmitValidators

      protected Set<PricedFulfillmentOptionSubmitValidator> getPricedFulfillmentOptionSubmitValidators()
    • setPricedFulfillmentOptionSubmitValidators

      @Autowired(required=false) public void setPricedFulfillmentOptionSubmitValidators(Set<PricedFulfillmentOptionSubmitValidator> pricedFulfillmentOptionSubmitValidators)
    • getPricingFields

      protected Set<String> getPricingFields()