Interface ProductTypeValidator
- All Known Implementing Classes:
DefaultBundleProductTypeValidator
,DefaultBusinessTypeFieldsValidator
,DefaultSelectorProductTypeValidator
,DefaultStandardProductTypeValidator
,DefaultVariantBasedProductTypeValidator
public interface ProductTypeValidator
The validator is used to validate the products with the specified types.
- Author:
- Dima Myroniuk (dmyroniuk)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canValidateCreate
(Product product) Whether or not this validator supports validation to create this product.default boolean
canValidateReplace
(Product product, Product existingProduct) Whether or not this validator supports validation to replace this product.default boolean
canValidateUpdate
(Product product, Product existingProduct) Whether or not this validator supports validation to update this product.default void
validateDefaultPrice
(Product product, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, org.springframework.validation.Errors errors) Default method to validate against missing default price and currency mismatch.void
validateProductForCreate
(Product product, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validate the product for create.void
validateProductForReplace
(Product product, org.springframework.validation.Errors errors, Product existingProduct, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validate the product for replace.void
validateProductForUpdate
(Product product, org.springframework.validation.Errors errors, Product existingProduct, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validate the product for update.
-
Method Details
-
canValidateCreate
Whether or not this validator supports validation to create this product.- Parameters:
product
- the product to validate- Returns:
- true if this validator can validate the product creation
-
canValidateUpdate
Whether or not this validator supports validation to update this product.- Parameters:
product
- the product to validate- Returns:
- true if this validator can validate the product update
-
canValidateReplace
Whether or not this validator supports validation to replace this product.- Parameters:
product
- the product to validate- Returns:
- true if this validator can validate the product replace
-
validateProductForCreate
void validateProductForCreate(Product product, org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validate the product for create.- Parameters:
product
- the product to validateerrors
- holder for validation context information. When adding field validation errors, the field names should be in the context of the productcontext
- current context this validation is running in
-
validateProductForUpdate
void validateProductForUpdate(Product product, org.springframework.validation.Errors errors, Product existingProduct, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validate the product for update.- Parameters:
product
- the product to validateerrors
- holder for validation context information. When adding field validation errors, the field names should be in the context of the productexistingProduct
- the current product in the databasecontext
- current context this validation is running in
-
validateProductForReplace
void validateProductForReplace(Product product, org.springframework.validation.Errors errors, Product existingProduct, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validate the product for replace.- Parameters:
product
- the product to validateerrors
- holder for validation context information. When adding field validation errors, the field names should be in the context of the productexistingProduct
- the current product in the databasecontext
- current context this validation is running in
-
validateDefaultPrice
default void validateDefaultPrice(Product product, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, org.springframework.validation.Errors errors) Default method to validate against missing default price and currency mismatch.This method is not relevant to all product types.
- Parameters:
product
- the product to validatecontext
- current context this validation is running inerrors
- holder for validation context information. When adding field validation errors, the field names should be in the context of the product
-