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
-
Field Summary
Fields inherited from interface com.broadleafcommerce.cartoperation.service.fulfillment.validation.FulfillmentGroupSubmitValidator
HINT_ALLOW_NO_ITEMS, HINT_ALLOW_NO_OPTION, HINT_PRICED_FULFILLMENT_OPTION, HINT_PRICING_NOT_REQUIRED, HINT_SKIP_ITEM_VALIDATION, HINT_SKIP_OPTION_VALIDATION, HINT_SKIP_TYPE_SPECIFIC_VALIDATION
-
Constructor Summary
ConstructorDescriptionDefaultFulfillmentGroupSubmitValidator
(Set<TypeFulfillmentGroupSubmitValidator> typeValidators, Set<FulfillmentItemSubmitValidator> itemValidators, Set<FulfillmentOptionSubmitValidator> optionValidators) -
Method Summary
Modifier and TypeMethodDescriptionprotected Set<FulfillmentItemSubmitValidator>
protected Set<FulfillmentOptionSubmitValidator>
protected Set<PricedFulfillmentOptionSubmitValidator>
Class<?>
Gets the class that this validator supports.protected Set<TypeFulfillmentGroupSubmitValidator>
Produces a set of field names of pricing fields that should be validated.void
setPricedFulfillmentOptionSubmitValidators
(Set<PricedFulfillmentOptionSubmitValidator> pricedFulfillmentOptionSubmitValidators) void
validate
(@NonNull Object target, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates the target.protected void
validateBase
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates a fulfillment group at the top level, not considering nested or pricing fields.protected void
validateItems
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates the fulfillment items of the group.protected void
validateOptions
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates the fulfillment option on this group.protected void
validateOptions
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints, FulfillmentValidationDataHolder dataHolder) protected void
validatePricing
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints) Validates the price fields on the fulfillment group (top-level only- does not consider individual item prices).void
validateWithDataHolder
(@NonNull Object target, @NonNull org.springframework.validation.Errors errors, @NonNull Set<Object> hints, @NonNull FulfillmentValidationDataHolder dataHolder) Validates the target and usesFulfillmentValidationDataHolder
parameter that can be used to hold some additional data needed for the validation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.cartoperation.service.fulfillment.validation.FulfillmentValidator
supports, validate, validate, validate, validate
Methods inherited from interface org.springframework.validation.SmartValidator
validateValue
-
Constructor Details
-
DefaultFulfillmentGroupSubmitValidator
public DefaultFulfillmentGroupSubmitValidator(Set<TypeFulfillmentGroupSubmitValidator> typeValidators, Set<FulfillmentItemSubmitValidator> itemValidators, Set<FulfillmentOptionSubmitValidator> optionValidators)
-
-
Method Details
-
getSupportedClass
Description copied from interface:FulfillmentValidator
Gets the class that this validator supports.- Specified by:
getSupportedClass
in interfaceFulfillmentValidator
- 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 interfaceFulfillmentValidator
- Parameters:
target
- the target of the validationerrors
- an errors container to place rejections and pull values fromhints
- 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 usesFulfillmentValidationDataHolder
parameter that can be used to hold some additional data needed for the validation.- Specified by:
validateWithDataHolder
in interfaceFulfillmentValidator
- Parameters:
target
- the target of the validationerrors
- an errors container to place rejections and pull values fromhints
- any hints that should be used during validationdataHolder
- 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 totypeValidators
to validate things that would be specific to the fulfillment type being used.- Parameters:
group
- the fulfillment group to validateerrors
- an error container to place validation errors inhints
- 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 validateerrors
- an error container to place validation errors inhints
- 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 toitemValidators
for the actual validation.- Parameters:
group
- the fulfillment group to validateerrors
- an error container to place validation errors inhints
- 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 tooptionValidators
.- Parameters:
group
- the fulfillment group to validateerrors
- an error container to place validation errors inhints
- 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
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
-
getItemValidators
-
getOptionValidators
-
getPricedFulfillmentOptionSubmitValidators
-
setPricedFulfillmentOptionSubmitValidators
@Autowired(required=false) public void setPricedFulfillmentOptionSubmitValidators(Set<PricedFulfillmentOptionSubmitValidator> pricedFulfillmentOptionSubmitValidators) -
getPricingFields
-