Interface CodeGenerationService

All Known Implementing Classes:
DefaultCodeGenerationService

public interface CodeGenerationService
Performs operations on a CodeGenerator, such as validation and code generation.
Author:
Chad Harchar (charchar)
  • Method Details

    • markInProgressAndGenerateCodes

      default void markInProgressAndGenerateCodes(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
      Updates the CodeGenerator to have a status of CodeGenerationStatusType.IN_PROCESS, then performs the code generation.
      Parameters:
      info - The CodeGenerator that holds the information needed in order to generate the expected number of codes with the expected format
      contextRequest - The context of the request with which to generate codes
    • markInProgressAndGenerateAndGetCodes

      CodeGenerationResult markInProgressAndGenerateAndGetCodes(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
      Updates the CodeGenerator to have a status of CodeGenerationStatusType.IN_PROCESS, then performs the code generation.
      Parameters:
      info - The CodeGenerator that holds the information needed in order to generate the expected number of codes with the expected format
      contextRequest - The context of the request with which to generate codes
      Returns:
      the CodeGenerationResult containing the generated OfferCodes and error message based on the given CodeGenerator
    • generateCodesForVouchers

      CodeGenerationResult generateCodesForVouchers(VoucherCodeGenerationRequest voucherCodeGenerationReq, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Returns the CodeGenerationResult containing generated and/or existing OfferCodes for voucher offers based on the given VoucherCodeGenerationRequest.

      This will use the existing CodeGenerator for the voucher campaign if exists, otherwise it will create a new one.

      This method will generate the OfferCodes and waits for its completion in the same request, therefore it's meant for small batch of code generation only.

      Parameters:
      voucherCodeGenerationReq - the VoucherCodeGenerationRequest to generate the voucher OfferCodes with
      contextInfo - The context of the request with which to generate codes
      Returns:
      the CodeGenerationResult containing generated and/or existing OfferCodes for voucher offers based on the given VoucherCodeGenerationRequest.