Class CodeGeneratorValidator

java.lang.Object
com.broadleafcommerce.promotion.offer.service.validation.CodeGeneratorValidator
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator

public class CodeGeneratorValidator extends Object implements com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
Validations for CodeGenerator.
Author:
Samarth Dhruva (samarthd)
See Also:
  • Constructor Details

    • CodeGeneratorValidator

      public CodeGeneratorValidator()
  • Method Details

    • supports

      public boolean supports(@NonNull @NonNull @NonNull Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Specified by:
      supports in interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
    • validate

      public void validate(@NonNull @NonNull @NonNull Object businessInstance, @NonNull @NonNull @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Specified by:
      validate in interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
    • validateActiveEndDate

      protected void validateActiveEndDate(@NonNull @NonNull @NonNull CodeGenerator codeGenerator, @NonNull @NonNull @NonNull org.springframework.validation.Errors errors)
    • validateCodeFormat

      protected boolean validateCodeFormat(@NonNull @NonNull @NonNull CodeGenerator codeGenerator, @NonNull @NonNull @NonNull org.springframework.validation.Errors errors)
    • validateNumberOfCodesToGenerate

      protected void validateNumberOfCodesToGenerate(@NonNull @NonNull @NonNull CodeGenerator businessInstance, @NonNull @NonNull @NonNull org.springframework.validation.Errors errors)
    • getCodeMultiplier

      protected int getCodeMultiplier()
      Affects the "guessability" of codes when a code format has not been provided. For example, if 100 codes are being generated, the default will insure that the codes are generated at least from a pool of 100000 possible codes.
      Returns:
    • setAvailableCharHelper

      @Autowired public void setAvailableCharHelper(CodeFormatAvailableCharHelper availableCharHelper)
    • getAvailableCharHelper

      @NonNull protected CodeFormatAvailableCharHelper getAvailableCharHelper()