Class CodeGenerator
java.lang.Object
com.broadleafcommerce.promotion.offer.domain.CodeGenerator
- All Implemented Interfaces:
 com.broadleafcommerce.data.tracking.core.ContextStateAware,Serializable
public class CodeGenerator
extends Object
implements Serializable, com.broadleafcommerce.data.tracking.core.ContextStateAware
- Author:
 - Chad Harchar (charchar)
 - See Also:
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InstantSets the Active End Date for codes generated by this generator.protected InstantSets the Active Start Date for codes generated by this generator.protected InstantThe date this generator was created.protected StringProvides a customer email validation when the generated codes are requested for use.protected InstantThe date this generator was created. - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanSets the Active End Date for codes generated by this generator.Sets the Active Start Date for codes generated by this generator.Returns a String with the allowed letters to use when generating codes.Returns a String with the allowed numbers to use when generating codes.Defines the id for the campaign that originated this code generator.The custom formatter for generating codes.Returns a String withgetNumberOfCodesGenerated()/getNumberOfCodesToGenerate()If those values are equal, just returnsgetNumberOfCodesGenerated()Provides an easy way to determine progress.The current statusThe code length the generator should use when generating the codes.Defines a prefix to updateUses when generating campaign codes for this campaign.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextStateA subset ofTrackinginformation to expose the context state for this object.The date this generator was created.Provides a customer email validation when the generated codes are requested for use.getId()intThe maximum number of uses to set for each code generated.intThe current number of codes that have been generatedintThe number of codes that will be generatedThe segment to which this offer can apply.The date this generator was created.inthashCode()booleanDetermines if thisCodeGeneratoris for voucher offers.voidsetActiveEndDate(Instant activeEndDate) Sets the Active End Date for codes generated by this generator.voidsetActiveStartDate(Instant activeStartDate) Sets the Active Start Date for codes generated by this generator.voidsetAllowedLetters(String allowedLetters) Returns a String with the allowed letters to use when generating codes.voidsetAllowedNumbers(String allowedNumbers) Returns a String with the allowed numbers to use when generating codes.voidsetCampaignId(String campaignId) Defines the id for the campaign that originated this code generator.voidsetCodeFormat(String codeFormat) The custom formatter for generating codes.voidsetCodeGenerationMessage(String codeGenerationMessage) Returns a String withgetNumberOfCodesGenerated()/getNumberOfCodesToGenerate()If those values are equal, just returnsgetNumberOfCodesGenerated()Provides an easy way to determine progress.voidsetCodeGenerationStatus(String codeGenerationStatus) The current statusvoidsetCodeLength(Integer codeLength) The code length the generator should use when generating the codes.voidsetCodePrefix(String codePrefix) Defines a prefix to updateUses when generating campaign codes for this campaign.voidsetContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.voidsetCreateDate(Instant createDate) The date this generator was created.voidsetEmailRegEx(String emailRegEx) Provides a customer email validation when the generated codes are requested for use.voidvoidsetMaxUses(int maxUses) The maximum number of uses to set for each code generated.voidsetNumberOfCodesGenerated(int numberOfCodesGenerated) The current number of codes that have been generatedvoidsetNumberOfCodesToGenerate(int numberOfCodesToGenerate) The number of codes that will be generatedvoidsetSegment(String segment) The segment to which this offer can apply.voidsetUpdateDate(Instant updateDate) The date this generator was created.voidsetVoucherCodeGenerator(boolean voucherCodeGenerator) Determines if thisCodeGeneratoris for voucher offers.toString() 
- 
Field Details
- 
createDate
The date this generator was created. - 
updateDate
The date this generator was created. - 
emailRegEx
Provides a customer email validation when the generated codes are requested for use. - 
activeStartDate
Sets the Active Start Date for codes generated by this generator. - 
activeEndDate
Sets the Active End Date for codes generated by this generator. 
 - 
 - 
Constructor Details
- 
CodeGenerator
public CodeGenerator() 
 - 
 - 
Method Details
- 
getId
 - 
getCodePrefix
Defines a prefix to updateUses when generating campaign codes for this campaign. This will default toCampaign.getCodePrefix(), if not set. This is intended to be used as an override, if required. - 
getNumberOfCodesToGenerate
public int getNumberOfCodesToGenerate()The number of codes that will be generated - 
getNumberOfCodesGenerated
public int getNumberOfCodesGenerated()The current number of codes that have been generated - 
getCodeGenerationStatus
The current status - 
getCodeFormat
The custom formatter for generating codes. Customer formatters allow for precise control of the code format. For example, consider "CF-##-@@-**-1" which might generate the following code "CF-99-AB-Z3-1". Each symbol is processed by the CodeGenerator. The default implementation is as follows: # is replaced by a random number (not including 0, 1, or 5) @ is replaced by a random character (not including 0, L, or S) * is replaced by random alphanumeric character (not including those mentioned above).- Returns:
 - See Also:
 
 - 
getCodeLength
The code length the generator should use when generating the codes. - 
getMaxUses
public int getMaxUses()The maximum number of uses to set for each code generated. - 
getSegment
The segment to which this offer can apply. - 
getCreateDate
The date this generator was created. - 
getUpdateDate
The date this generator was created. - 
getCodeGenerationMessage
Returns a String withgetNumberOfCodesGenerated()/getNumberOfCodesToGenerate()If those values are equal, just returnsgetNumberOfCodesGenerated()Provides an easy way to determine progress. This field is automatically updated. - 
getEmailRegEx
Provides a customer email validation when the generated codes are requested for use. - 
getActiveStartDate
Sets the Active Start Date for codes generated by this generator. - 
getActiveEndDate
Sets the Active End Date for codes generated by this generator. - 
getCampaignId
Defines the id for the campaign that originated this code generator. - 
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTrackinginformation to expose the context state for this object.- Specified by:
 getContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Returns:
 - a subset of 
Trackinginformation to expose the context state for this object 
 - 
isVoucherCodeGenerator
public boolean isVoucherCodeGenerator()Determines if thisCodeGeneratoris for voucher offers. - 
getAllowedLetters
Returns a String with the allowed letters to use when generating codes. If not set, code generation uses the character sets configured inCodeFormatAvailableCharHelper - 
getAllowedNumbers
Returns a String with the allowed numbers to use when generating codes. If not set, code generation uses the character sets configured inCodeFormatAvailableCharHelper - 
setId
 - 
setCodePrefix
Defines a prefix to updateUses when generating campaign codes for this campaign. This will default toCampaign.getCodePrefix(), if not set. This is intended to be used as an override, if required. - 
setNumberOfCodesToGenerate
public void setNumberOfCodesToGenerate(int numberOfCodesToGenerate) The number of codes that will be generated - 
setNumberOfCodesGenerated
public void setNumberOfCodesGenerated(int numberOfCodesGenerated) The current number of codes that have been generated - 
setCodeGenerationStatus
The current status - 
setCodeFormat
The custom formatter for generating codes. Customer formatters allow for precise control of the code format. For example, consider "CF-##-@@-**-1" which might generate the following code "CF-99-AB-Z3-1". Each symbol is processed by the CodeGenerator. The default implementation is as follows: # is replaced by a random number (not including 0, 1, or 5) @ is replaced by a random character (not including 0, L, or S) * is replaced by random alphanumeric character (not including those mentioned above).- See Also:
 
 - 
setCodeLength
The code length the generator should use when generating the codes. - 
setMaxUses
public void setMaxUses(int maxUses) The maximum number of uses to set for each code generated. - 
setSegment
The segment to which this offer can apply. - 
setCreateDate
The date this generator was created. - 
setUpdateDate
The date this generator was created. - 
setCodeGenerationMessage
Returns a String withgetNumberOfCodesGenerated()/getNumberOfCodesToGenerate()If those values are equal, just returnsgetNumberOfCodesGenerated()Provides an easy way to determine progress. This field is automatically updated. - 
setEmailRegEx
Provides a customer email validation when the generated codes are requested for use. - 
setActiveStartDate
Sets the Active Start Date for codes generated by this generator. - 
setActiveEndDate
Sets the Active End Date for codes generated by this generator. - 
setCampaignId
Defines the id for the campaign that originated this code generator. - 
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTrackinginformation to expose the context state for this object.- Specified by:
 setContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Parameters:
 contextState- a subset ofTrackinginformation to expose the context state for this object
 - 
setVoucherCodeGenerator
public void setVoucherCodeGenerator(boolean voucherCodeGenerator) Determines if thisCodeGeneratoris for voucher offers. - 
setAllowedLetters
Returns a String with the allowed letters to use when generating codes. If not set, code generation uses the character sets configured inCodeFormatAvailableCharHelper - 
setAllowedNumbers
Returns a String with the allowed numbers to use when generating codes. If not set, code generation uses the character sets configured inCodeFormatAvailableCharHelper - 
toString
 - 
equals
 - 
canEqual
 - 
hashCode
public int hashCode() 
 -