Interface CodeGenerationService
-
- All Known Implementing Classes:
DefaultCodeGenerationService
public interface CodeGenerationServicePerforms operations on aCodeGenerator, such as validation and code generation.- Author:
- Chad Harchar (charchar)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description CodeGenerationResultgenerateCodesForVouchers(VoucherCodeGenerationRequest voucherCodeGenerationReq, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Returns theCodeGenerationResultcontaining generated and/or existingCampaignCodesfor voucher offers based on the givenVoucherCodeGenerationRequest.voidinitializeCodePrefixAndGenerateCodes(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)Deprecated.since 1.4, initialization has moved toBaseCrudEntityService.create(Object, ContextInfo), and usemarkInProgressAndGenerateCodes(CodeGenerator, ContextRequest)for generating codesvoidinitializeCodePrefixAndValidateGenerator(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)Deprecated.since 1.4 initialization has moved toBaseCrudEntityService.create(Object, ContextInfo), and validation has moved toCodeGeneratorValidatorandCodeGeneratorPreValidatorCodeGenerationResultmarkInProgressAndGenerateAndGetCodes(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)Updates theCodeGeneratorto have a status ofCodeGenerationStatusType.IN_PROCESS, then performs the code generation.default voidmarkInProgressAndGenerateCodes(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)Updates theCodeGeneratorto have a status ofCodeGenerationStatusType.IN_PROCESS, then performs the code generation.voidstartCodeGeneration(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)Deprecated.
-
-
-
Method Detail
-
initializeCodePrefixAndValidateGenerator
@Deprecated void initializeCodePrefixAndValidateGenerator(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
Deprecated.since 1.4 initialization has moved toBaseCrudEntityService.create(Object, ContextInfo), and validation has moved toCodeGeneratorValidatorandCodeGeneratorPreValidatorSets theCodeGenerator'sCodeGenerator.codePrefixto be itscampaign'scode prefix if not present. After this, validates that the codeFormat for theCodeGeneratoris large enough to hold the number of codes desired, ensuring that the codes are not easily guessable.- Parameters:
info- The CodeGenerator that contains the number of codes to generate and the potential code format.contextRequest- The context of the request with which to generate codes.- Throws:
com.broadleafcommerce.common.error.validation.ValidationException- if the code generator is invalid
-
initializeCodePrefixAndGenerateCodes
@Deprecated void initializeCodePrefixAndGenerateCodes(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
Deprecated.since 1.4, initialization has moved toBaseCrudEntityService.create(Object, ContextInfo), and usemarkInProgressAndGenerateCodes(CodeGenerator, ContextRequest)for generating codesSets theCodeGenerator'sCodeGenerator.codePrefixto be itscampaign'scode prefix if not present. After this, generates the codes for the providedCodeGenerator.- Parameters:
info- The CodeGenerator that holds the information needed in order to generate the expected number of codes with the expected format, if desired.contextRequest- The context of the request with which to generate codes.
-
startCodeGeneration
@Deprecated void startCodeGeneration(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
Deprecated.Prepares theCodeGeneratorfor processing, then triggers 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, if desired.contextRequest- The context of the request with which to generate codes.
-
markInProgressAndGenerateCodes
default void markInProgressAndGenerateCodes(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
Updates theCodeGeneratorto have a status ofCodeGenerationStatusType.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 formatcontextRequest- The context of the request with which to generate codes
-
markInProgressAndGenerateAndGetCodes
CodeGenerationResult markInProgressAndGenerateAndGetCodes(CodeGenerator info, com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
Updates theCodeGeneratorto have a status ofCodeGenerationStatusType.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 formatcontextRequest- The context of the request with which to generate codes- Returns:
- the
CodeGenerationResultcontaining the generatedCampaignCodesand error message based on the givenCodeGenerator
-
generateCodesForVouchers
CodeGenerationResult generateCodesForVouchers(VoucherCodeGenerationRequest voucherCodeGenerationReq, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Returns theCodeGenerationResultcontaining generated and/or existingCampaignCodesfor voucher offers based on the givenVoucherCodeGenerationRequest.This will use the existing
CodeGeneratorfor the voucher campaign if exists, otherwise it will create a new one.This method will generate the
CampaignCodesand waits for its completion in the same request, therefore it's meant for small batch of code generation only.- Parameters:
voucherCodeGenerationReq- theVoucherCodeGenerationRequestto generate the voucherCampaignCodeswithcontextInfo- The context of the request with which to generate codes- Returns:
- the
CodeGenerationResultcontaining generated and/or existingCampaignCodesfor voucher offers based on the givenVoucherCodeGenerationRequest.
-
-