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 the 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_PRICING_NOT_REQUIRED, HINT_SKIP_ITEM_VALIDATION, HINT_SKIP_OPTION_VALIDATION, HINT_SKIP_TYPE_SPECIFIC_VALIDATION
-
-
Constructor Summary
Constructors Constructor Description DefaultFulfillmentGroupSubmitValidator(Set<TypeFulfillmentGroupSubmitValidator> typeValidators, Set<FulfillmentItemSubmitValidator> itemValidators, Set<FulfillmentOptionSubmitValidator> optionValidators)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Set<FulfillmentItemSubmitValidator>
getItemValidators()
protected Set<FulfillmentOptionSubmitValidator>
getOptionValidators()
protected Set<String>
getPricingFields()
Class<?>
getSupportedClass()
Gets the class that this validator supports.protected Set<TypeFulfillmentGroupSubmitValidator>
getTypeValidators()
protected Set<String>
pricingFields()
Produces a set of field names of pricing fields that should be validated.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
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).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
DefaultFulfillmentGroupSubmitValidator
public DefaultFulfillmentGroupSubmitValidator(Set<TypeFulfillmentGroupSubmitValidator> typeValidators, Set<FulfillmentItemSubmitValidator> itemValidators, Set<FulfillmentOptionSubmitValidator> optionValidators)
-
-
Method Detail
-
getSupportedClass
public Class<?> 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
-
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
-
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()
-
-