Class CodeGenerator
- java.lang.Object
-
- com.broadleafcommerce.orderoperation.domain.CodeGenerator
-
- All Implemented Interfaces:
Serializable
public class CodeGenerator extends Object implements Serializable
- Author:
- Chad Harchar (charchar)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected InstantactiveEndDateSets the Active End Date for codes generated by this generator.protected InstantactiveStartDateSets the Active Start Date for codes generated by this generator.protected StringemailRegExProvides a customer email validation when the generated codes are requested for use.
-
Constructor Summary
Constructors Constructor Description CodeGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)booleanequals(Object o)InstantgetActiveEndDate()Sets the Active End Date for codes generated by this generator.InstantgetActiveStartDate()Sets the Active Start Date for codes generated by this generator.StringgetCampaignId()Defines the id for the campaign that originated this code generator.StringgetCodeFormat()The custom formatter for generating codes.IntegergetCodeLength()The code length the generator should use when generating the codes.StringgetCodePrefix()Defines a prefix to updateUses when generating campaign codes for this campaign.StringgetEmailRegEx()Provides a customer email validation when the generated codes are requested for use.StringgetId()intgetMaxUses()The maximum number of uses to set for each code generated.intgetNumberOfCodesToGenerate()The number of codes that will be generatedinthashCode()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.voidsetCampaignId(String campaignId)Defines the id for the campaign that originated this code generator.voidsetCodeFormat(String codeFormat)The custom formatter for generating codes.voidsetCodeLength(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.voidsetEmailRegEx(String emailRegEx)Provides a customer email validation when the generated codes are requested for use.voidsetId(String id)voidsetMaxUses(int maxUses)The maximum number of uses to set for each code generated.voidsetNumberOfCodesToGenerate(int numberOfCodesToGenerate)The number of codes that will be generatedStringtoString()
-
-
-
Field Detail
-
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#codePrefix, 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
-
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:
com.broadleafcommerce.promotion.campaign.service.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.
-
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.
-
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#codePrefix, 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
-
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:
com.broadleafcommerce.promotion.campaign.service.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.
-
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.
-
canEqual
protected boolean canEqual(Object other)
-
-