@Service(value="blCodeGeneratorService") public class CodeGeneratorServiceImpl extends com.broadleafcommerce.jobsevents.service.AbstractSystemEventConsumer implements CodeGeneratorService
| Modifier and Type | Field and Description |
|---|---|
protected org.broadleafcommerce.openadmin.server.security.service.AdminSecurityService |
adminSecurityService |
protected AdvOfferCodeDao |
advOfferCodeDao |
protected CodeFormatAvailableCharHelper |
availableCharHelper |
protected OfferCodePersister |
offerCodePersister |
protected org.broadleafcommerce.core.offer.dao.OfferDao |
offerDao |
protected org.broadleafcommerce.common.config.service.SystemPropertiesService |
systemPropertiesService |
entityManagerFactory| Constructor and Description |
|---|
CodeGeneratorServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
calculateRequiredCodeLength(int numberOfCodes,
int charSetSize)
Returns the size of the code that you must create in order to support the
passed in number of Codes.
|
void |
clear() |
void |
consumeEvent(com.broadleafcommerce.jobsevents.domain.SystemEvent event) |
protected int |
createBatchOfCodes(String originalCodeFormat,
CodeGeneratorBucket bucket,
int numberToCreate,
Set<String> currentCodeSet) |
protected String |
createCode(String codeFormat,
Random r)
Uses the code format (e.g.
|
OfferCodeGenerationInfo |
createOfferCodeGenerationInfo() |
OfferCodeOfferCodeRuleXref |
createOfferCodeOfferCodeRuleXref() |
OfferCodeRule |
createOfferCodeRule() |
protected String |
determineCodeFormat(OfferCodeGenerationInfo info)
If a code format was not specified, then create one using the prefix and alphanumeric
characters for the specified length.
|
List<org.broadleafcommerce.core.offer.domain.OfferCode> |
findBatchOfferCodeByCodeGenerationId(Long firstId,
int count,
Long ocgiId) |
Long |
findNumberOfOfferCodesForCodeGroup(Long codeGroupId) |
OfferCodeGenerationInfo |
findOfferCodeGenerationInfoById(Long ocgiId) |
void |
generateCodes(OfferCodeGenerationInfo info)
Generates codes for an offer based on the passed in codeGenerationInfo.
|
List<org.broadleafcommerce.core.offer.domain.OfferCode> |
generateSmallAmountOfCodes(OfferCodeGenerationInfo info)
This method is used to generate <= 100 codes.
|
protected int |
getBatchSize()
Returns the batch size for generating new offer codes.
|
int |
getCodeGenerationBatchSize() |
protected int |
getCodeMultiplier()
Affects the "guessability" of codes when a code format has not been provided.
|
String |
getEventType() |
protected int |
getMaxSmallBatchRetry() |
OfferCodeGenerationInfo |
saveOfferCodeGenerationInfo(OfferCodeGenerationInfo info) |
protected void |
setBatchSize(int batchSize)
Returns the batch size for generating new offer codes.
|
void |
startCodeGeneration(OfferCodeGenerationInfo codeGenerationInfo)
Generates codes for an offer based on the passed in codeGenerationInfo.
|
protected OfferCodeGenerationInfo |
updateCodesGenerated(OfferCodeGenerationInfo info,
int codesCreated) |
void |
validateCodeGenerationInfo(OfferCodeGenerationInfo info)
Validates that the codeFormat for the codeGenerationInfo is large enough
to hold the number of codes desired ensuring that the codes are not easily
guessable.
|
protected OfferCodePersister offerCodePersister
protected org.broadleafcommerce.core.offer.dao.OfferDao offerDao
protected AdvOfferCodeDao advOfferCodeDao
protected org.broadleafcommerce.common.config.service.SystemPropertiesService systemPropertiesService
protected CodeFormatAvailableCharHelper availableCharHelper
@Qualifier(value="blAdminSecurityService") @Autowired(required=false) protected org.broadleafcommerce.openadmin.server.security.service.AdminSecurityService adminSecurityService
public void validateCodeGenerationInfo(OfferCodeGenerationInfo info)
CodeGeneratorServicevalidateCodeGenerationInfo in interface CodeGeneratorServiceOfferCodeGenerationInfopublic List<org.broadleafcommerce.core.offer.domain.OfferCode> generateSmallAmountOfCodes(OfferCodeGenerationInfo info)
generateSmallAmountOfCodes in interface CodeGeneratorServiceinfo - public void generateCodes(OfferCodeGenerationInfo info)
CodeGeneratorServicegenerateCodes in interface CodeGeneratorServiceOfferCodeGenerationInfopublic void startCodeGeneration(OfferCodeGenerationInfo codeGenerationInfo)
CodeGeneratorServicestartCodeGeneration in interface CodeGeneratorServiceOfferCodeGenerationInfoprotected OfferCodeGenerationInfo updateCodesGenerated(OfferCodeGenerationInfo info, int codesCreated)
protected int createBatchOfCodes(String originalCodeFormat, CodeGeneratorBucket bucket, int numberToCreate, Set<String> currentCodeSet)
codeFormat - bucketPopulation - bucketNumber - numberToCreate - currentCodeSet - protected int calculateRequiredCodeLength(int numberOfCodes,
int charSetSize)
numberOfCodes - protected String determineCodeFormat(OfferCodeGenerationInfo info)
dto - protected String createCode(String codeFormat, Random r)
size - codeFormat - fixedChars - public OfferCodeGenerationInfo createOfferCodeGenerationInfo()
createOfferCodeGenerationInfo in interface CodeGeneratorServicepublic OfferCodeGenerationInfo saveOfferCodeGenerationInfo(OfferCodeGenerationInfo info)
saveOfferCodeGenerationInfo in interface CodeGeneratorServicepublic OfferCodeOfferCodeRuleXref createOfferCodeOfferCodeRuleXref()
createOfferCodeOfferCodeRuleXref in interface CodeGeneratorServicepublic OfferCodeRule createOfferCodeRule()
createOfferCodeRule in interface CodeGeneratorServicepublic int getCodeGenerationBatchSize()
protected int getMaxSmallBatchRetry()
protected int getBatchSize()
protected void setBatchSize(int batchSize)
protected int getCodeMultiplier()
public void consumeEvent(com.broadleafcommerce.jobsevents.domain.SystemEvent event)
consumeEvent in interface com.broadleafcommerce.jobsevents.service.SystemEventConsumerpublic String getEventType()
getEventType in interface com.broadleafcommerce.jobsevents.service.SystemEventConsumerpublic OfferCodeGenerationInfo findOfferCodeGenerationInfoById(Long ocgiId)
findOfferCodeGenerationInfoById in interface CodeGeneratorServicepublic List<org.broadleafcommerce.core.offer.domain.OfferCode> findBatchOfferCodeByCodeGenerationId(Long firstId, int count, Long ocgiId)
findBatchOfferCodeByCodeGenerationId in interface CodeGeneratorServicepublic void clear()
clear in interface CodeGeneratorServicepublic Long findNumberOfOfferCodesForCodeGroup(Long codeGroupId)
findNumberOfOfferCodesForCodeGroup in interface CodeGeneratorServiceCopyright © 2020. All rights reserved.