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 Constructor Description PriceDataValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Currency
currencyForValidation()
Uses a currency with 3 digits to not lose precision on the amount.protected PriceDataService<PriceData>
getPriceDataService()
protected PriceListService<PriceList>
getPriceListService()
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
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
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)
protected void
validateTier(PriceDataTier tier, org.springframework.validation.Errors errors)
protected void
validateTiers(PriceData priceData, org.springframework.validation.Errors errors)
-
-
-
Method Detail
-
setPriceDataService
@Autowired @Lazy public void setPriceDataService(PriceDataService<PriceData> priceDataService)
Lazy injection since this validator is itself a service component. This avoids circular dependency exceptions- Parameters:
priceDataService
- the price data service
-
setPriceListService
@Autowired @Lazy public void setPriceListService(PriceListService<PriceList> priceListService)
-
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
protected void validateTargetVendorRefUnchanged(PriceData newPriceData, PriceData oldPriceData, org.springframework.validation.Errors errors)
-
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
protected Currency 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
protected void validatePrice(PriceData priceData, org.springframework.validation.Errors errors)
-
validateActiveStartDate
protected void validateActiveStartDate(org.springframework.validation.Errors errors)
-
validateEndDate
protected void validateEndDate(PriceData priceData, org.springframework.validation.Errors errors)
-
validateTarget
protected void validateTarget(PriceData priceData, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
validateTiers
protected void validateTiers(PriceData priceData, org.springframework.validation.Errors errors)
-
validateTier
protected void validateTier(PriceDataTier tier, org.springframework.validation.Errors errors)
-
getPriceDataService
@NonNull protected PriceDataService<PriceData> getPriceDataService()
-
getPriceListService
@NonNull protected PriceListService<PriceList> getPriceListService()
-
-