Class PriceDataValidator
java.lang.Object
com.broadleafcommerce.pricing.service.validation.PriceDataValidator
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
public class PriceDataValidator
extends Object
implements com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
- Author:
- Chad Harchar (charchar)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Currency
Uses a currency with 3 digits to not lose precision on the amount.protected PriceDataService<PriceData>
protected PriceListService<PriceList>
void
setPriceDataService
(PriceDataService<PriceData> priceDataService) Lazy injection since this validator is itself a service component.void
setPriceListService
(PriceListService<PriceList> priceListService) boolean
supports
(Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) void
validate
(Object businessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected void
validateActiveStartDate
(org.springframework.validation.Errors errors) protected void
validateEndDate
(PriceData priceData, org.springframework.validation.Errors errors) protected void
validateForModification
(Object businessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) void
validateForReplace
(Object businessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) void
validateForUpdate
(Object updatedBusinessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected void
validateLimitedQuantityGroup
(PriceData priceData, org.springframework.validation.Errors errors) Validate the limitedQuantityGroup containing the startingQuantity and the availableQuantity fields for correct valuesprotected void
validatePrice
(PriceData priceData, org.springframework.validation.Errors errors) protected void
validatePriceList
(PriceData priceData, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
validateRecurringPrice
(PriceData priceData, org.springframework.validation.Errors errors) Validate fields whenPriceData.getRecurringPrice()
is present.protected void
validateTarget
(PriceData priceData, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
validateTargetVendorRefUnchanged
(PriceData newPriceData, PriceData oldPriceData, org.springframework.validation.Errors errors) void
validateTerms
(PriceData priceData, org.springframework.validation.Errors errors) protected void
validateTier
(PriceDataTier tier, org.springframework.validation.Errors errors) protected void
validateTiers
(PriceData priceData, org.springframework.validation.Errors errors) protected void
validateUsagePrice
(PriceData priceData, org.springframework.validation.Errors errors) Validate fields whenPriceData.getUsagePrice()
is present.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
validateForCreate
-
Constructor Details
-
PriceDataValidator
public PriceDataValidator()
-
-
Method Details
-
setPriceDataService
Lazy injection since this validator is itself a service component. This avoids circular dependency exceptions- Parameters:
priceDataService
- the price data service
-
setPriceListService
-
supports
public boolean supports(Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
supports
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validateForUpdate
public void validateForUpdate(@NonNull Object updatedBusinessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
validateForUpdate
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validateForReplace
public void validateForReplace(@NonNull Object businessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
validateForReplace
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validateForModification
protected void validateForModification(@NonNull Object businessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
validateTargetVendorRefUnchanged
-
validate
public void validate(@NonNull Object businessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
validate
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
currencyForValidation
Uses a currency with 3 digits to not lose precision on the amount.- Returns:
-
validatePriceList
protected void validatePriceList(PriceData priceData, org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
validatePrice
-
validateLimitedQuantityGroup
protected void validateLimitedQuantityGroup(PriceData priceData, org.springframework.validation.Errors errors) Validate the limitedQuantityGroup containing the startingQuantity and the availableQuantity fields for correct values- Parameters:
priceData
- the priceData instanceerrors
- the errors instance
-
validateRecurringPrice
protected void validateRecurringPrice(PriceData priceData, org.springframework.validation.Errors errors) Validate fields whenPriceData.getRecurringPrice()
is present.- Parameters:
priceData
- ThePriceData
to validate.errors
- The object tracking errors found.- Since:
- Pricing Service 2.1.0, Release Train 2.2.0
-
validateTerms
-
validateUsagePrice
protected void validateUsagePrice(PriceData priceData, org.springframework.validation.Errors errors) Validate fields whenPriceData.getUsagePrice()
is present.- Parameters:
priceData
- ThePriceData
to validate.errors
- The object tracking errors found.- Since:
- Pricing Service 2.1.0, Release Train 2.2.0
-
validateActiveStartDate
protected void validateActiveStartDate(org.springframework.validation.Errors errors) -
validateEndDate
-
validateTarget
protected void validateTarget(PriceData priceData, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
validateTiers
-
validateTier
-
getPriceDataService
-
getPriceListService
-