Class CodeGenerator
- java.lang.Object
-
- com.broadleafcommerce.promotion.campaign.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Instant
activeEndDate
Sets the Active End Date for codes generated by this generator.protected Instant
activeStartDate
Sets the Active Start Date for codes generated by this generator.protected Instant
createDate
The date this generator was created.protected String
emailRegEx
Provides a customer email validation when the generated codes are requested for use.protected Instant
updateDate
The date this generator was created.
-
Constructor Summary
Constructors Constructor Description CodeGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
Instant
getActiveEndDate()
Sets the Active End Date for codes generated by this generator.Instant
getActiveStartDate()
Sets the Active Start Date for codes generated by this generator.String
getAllowedLetters()
Returns a String with the allowed letters to use when generating codes.String
getAllowedNumbers()
Returns a String with the allowed numbers to use when generating codes.String
getCampaignId()
Defines the id for the campaign that originated this code generator.String
getCodeFormat()
The custom formatter for generating codes.String
getCodeGenerationMessage()
Returns a String withgetNumberOfCodesGenerated()
/getNumberOfCodesToGenerate()
If those values are equal, just returnsgetNumberOfCodesGenerated()
Provides an easy way to determine progress.String
getCodeGenerationStatus()
The current statusInteger
getCodeLength()
The code length the generator should use when generating the codes.String
getCodePrefix()
Defines a prefix to updateUses when generating campaign codes for this campaign.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
getContextState()
A subset ofTracking
information to expose the context state for this object.Instant
getCreateDate()
The date this generator was created.String
getEmailRegEx()
Provides a customer email validation when the generated codes are requested for use.String
getId()
int
getMaxUses()
The maximum number of uses to set for each code generated.int
getNumberOfCodesGenerated()
The current number of codes that have been generatedint
getNumberOfCodesToGenerate()
The number of codes that will be generatedInstant
getUpdateDate()
The date this generator was created.int
hashCode()
boolean
isVoucherCodeGenerator()
Determines if thisCodeGenerator
is for voucher offers.void
setActiveEndDate(Instant activeEndDate)
Sets the Active End Date for codes generated by this generator.void
setActiveStartDate(Instant activeStartDate)
Sets the Active Start Date for codes generated by this generator.void
setAllowedLetters(String allowedLetters)
Returns a String with the allowed letters to use when generating codes.void
setAllowedNumbers(String allowedNumbers)
Returns a String with the allowed numbers to use when generating codes.void
setCampaignId(String campaignId)
Defines the id for the campaign that originated this code generator.void
setCodeFormat(String codeFormat)
The custom formatter for generating codes.void
setCodeGenerationMessage(String codeGenerationMessage)
Returns a String withgetNumberOfCodesGenerated()
/getNumberOfCodesToGenerate()
If those values are equal, just returnsgetNumberOfCodesGenerated()
Provides an easy way to determine progress.void
setCodeGenerationStatus(String codeGenerationStatus)
The current statusvoid
setCodeLength(Integer codeLength)
The code length the generator should use when generating the codes.void
setCodePrefix(String codePrefix)
Defines a prefix to updateUses when generating campaign codes for this campaign.void
setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
A subset ofTracking
information to expose the context state for this object.void
setCreateDate(Instant createDate)
The date this generator was created.void
setEmailRegEx(String emailRegEx)
Provides a customer email validation when the generated codes are requested for use.void
setId(String id)
void
setMaxUses(int maxUses)
The maximum number of uses to set for each code generated.void
setNumberOfCodesGenerated(int numberOfCodesGenerated)
The current number of codes that have been generatedvoid
setNumberOfCodesToGenerate(int numberOfCodesToGenerate)
The number of codes that will be generatedvoid
setUpdateDate(Instant updateDate)
The date this generator was created.void
setVoucherCodeGenerator(boolean voucherCodeGenerator)
Determines if thisCodeGenerator
is for voucher offers.String
toString()
-
-
-
Field Detail
-
createDate
protected Instant createDate
The date this generator was created.
-
updateDate
protected Instant updateDate
The date this generator was created.
-
emailRegEx
protected String emailRegEx
Provides a customer email validation when the generated codes are requested for use.
-
activeStartDate
protected Instant activeStartDate
Sets the Active Start Date for codes generated by this generator.
-
activeEndDate
protected Instant activeEndDate
Sets the Active End Date for codes generated by this generator.
-
-
Method Detail
-
getId
public String getId()
-
getCodePrefix
public String 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
public String getCodeGenerationStatus()
The current status
-
getCodeFormat
public String 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:
DefaultCampaignCodeService
-
getCodeLength
public Integer 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.
-
getCreateDate
public Instant getCreateDate()
The date this generator was created.
-
getUpdateDate
public Instant getUpdateDate()
The date this generator was created.
-
getCodeGenerationMessage
public String 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
public String getEmailRegEx()
Provides a customer email validation when the generated codes are requested for use.
-
getActiveStartDate
public Instant getActiveStartDate()
Sets the Active Start Date for codes generated by this generator.
-
getActiveEndDate
public Instant getActiveEndDate()
Sets the Active End Date for codes generated by this generator.
-
getCampaignId
public String 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 ofTracking
information to expose the context state for this object.- Specified by:
getContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Returns:
- a subset of
Tracking
information to expose the context state for this object
-
isVoucherCodeGenerator
public boolean isVoucherCodeGenerator()
Determines if thisCodeGenerator
is for voucher offers.
-
getAllowedLetters
public String 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
public String 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
public void setId(String id)
-
setCodePrefix
public void setCodePrefix(String codePrefix)
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
public void setCodeGenerationStatus(String codeGenerationStatus)
The current status
-
setCodeFormat
public void setCodeFormat(String codeFormat)
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:
DefaultCampaignCodeService
-
setCodeLength
public void setCodeLength(Integer codeLength)
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.
-
setCreateDate
public void setCreateDate(Instant createDate)
The date this generator was created.
-
setUpdateDate
public void setUpdateDate(Instant updateDate)
The date this generator was created.
-
setCodeGenerationMessage
public void setCodeGenerationMessage(String codeGenerationMessage)
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
public void setEmailRegEx(String emailRegEx)
Provides a customer email validation when the generated codes are requested for use.
-
setActiveStartDate
public void setActiveStartDate(Instant activeStartDate)
Sets the Active Start Date for codes generated by this generator.
-
setActiveEndDate
public void setActiveEndDate(Instant activeEndDate)
Sets the Active End Date for codes generated by this generator.
-
setCampaignId
public void setCampaignId(String campaignId)
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 ofTracking
information to expose the context state for this object.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Parameters:
contextState
- a subset ofTracking
information to expose the context state for this object
-
setVoucherCodeGenerator
public void setVoucherCodeGenerator(boolean voucherCodeGenerator)
Determines if thisCodeGenerator
is for voucher offers.
-
setAllowedLetters
public void setAllowedLetters(String allowedLetters)
Returns a String with the allowed letters to use when generating codes. If not set, code generation uses the character sets configured inCodeFormatAvailableCharHelper
-
setAllowedNumbers
public void setAllowedNumbers(String allowedNumbers)
Returns a String with the allowed numbers to use when generating codes. If not set, code generation uses the character sets configured inCodeFormatAvailableCharHelper
-
canEqual
protected boolean canEqual(Object other)
-
-