@Component(value="blOfferCodeGenerationValidator")
public class OfferCodeGenerationValidator
extends org.broadleafcommerce.openadmin.server.service.persistence.validation.ValidationConfigurationBasedPropertyValidator
| Modifier and Type | Field and Description |
|---|---|
protected org.broadleafcommerce.openadmin.server.service.AdminEntityService |
adminEntityService |
protected static char |
ALPHA_NUMERIC_FORMAT_ELEMENT |
protected CodeFormatAvailableCharHelper |
availableCharHelper |
protected static String |
CODE_FORMAT |
protected static String |
CODE_FORMAT_TOO_SHORT_ERROR |
protected static String |
CODE_GENERATION_METHOD |
protected static String |
CODE_LENGTH |
protected static int |
CODE_MULTIPLIER |
protected static String |
LENGTH_TOO_SHORT_ERROR |
protected static String |
MAX_CODE_GENERATE_ERROR |
protected Integer |
maxCodeGenerationAllowed |
protected static String |
NO_LENGTH_PROVIDED_ERROR |
protected static String |
NUM_CODES_TO_GENERATE |
protected static String |
SPECIFY_FORMAT |
protected static String |
SPECIFY_LENGTH |
protected static String |
TOO_EASY_TO_GUESS_ERROR |
| Constructor and Description |
|---|
OfferCodeGenerationValidator() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
calculateRequiredCodeLength(Integer numberOfCodes)
Returns the size of the code that you must create in order to support the
passed in number of Codes.
|
protected String |
generateErrorMessage(Object[] args,
String errorMessage) |
protected int |
getCodeMultiplier()
Deprecated.
Use
CODE_MULTIPLIER |
protected long |
getPossibleCodes(Integer codeLength) |
org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult |
validate(org.broadleafcommerce.openadmin.dto.Entity entity,
Serializable instance,
Map<String,org.broadleafcommerce.openadmin.dto.FieldMetadata> entityFieldMetadata,
Map<String,String> validationConfiguration,
org.broadleafcommerce.openadmin.dto.BasicFieldMetadata propertyMetadata,
String propertyName,
String value) |
protected org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult |
validateCodeFormat(org.broadleafcommerce.openadmin.dto.Entity entity,
String value) |
protected org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult |
validateCodeGenerationMethod(org.broadleafcommerce.openadmin.dto.Entity entity,
String value) |
protected org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult |
validateCodeLength(org.broadleafcommerce.openadmin.dto.Entity entity,
String value) |
protected org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult |
validateNumberOfCodesToGenerate(Integer codesToCreate,
String value) |
protected org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult |
validateNumberOfCodesToGenerate(String value,
CodeGenerationMethodType generationMethod) |
protected static final String CODE_FORMAT_TOO_SHORT_ERROR
protected static final String MAX_CODE_GENERATE_ERROR
protected static final String NO_LENGTH_PROVIDED_ERROR
protected static final String TOO_EASY_TO_GUESS_ERROR
protected static final String LENGTH_TOO_SHORT_ERROR
protected static final String CODE_FORMAT
protected static final String CODE_LENGTH
protected static final String NUM_CODES_TO_GENERATE
protected static final String CODE_GENERATION_METHOD
protected static final String SPECIFY_FORMAT
protected static final String SPECIFY_LENGTH
protected static final int CODE_MULTIPLIER
protected static final char ALPHA_NUMERIC_FORMAT_ELEMENT
@Value(value="${offerCode.maxCodeGeneration:100000}")
protected Integer maxCodeGenerationAllowed
protected org.broadleafcommerce.openadmin.server.service.AdminEntityService adminEntityService
protected CodeFormatAvailableCharHelper availableCharHelper
public org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult validate(org.broadleafcommerce.openadmin.dto.Entity entity,
Serializable instance,
Map<String,org.broadleafcommerce.openadmin.dto.FieldMetadata> entityFieldMetadata,
Map<String,String> validationConfiguration,
org.broadleafcommerce.openadmin.dto.BasicFieldMetadata propertyMetadata,
String propertyName,
String value)
validate in interface org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidatorvalidate in class org.broadleafcommerce.openadmin.server.service.persistence.validation.ValidationConfigurationBasedPropertyValidatorprotected org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult validateCodeFormat(org.broadleafcommerce.openadmin.dto.Entity entity,
String value)
protected org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult validateCodeGenerationMethod(org.broadleafcommerce.openadmin.dto.Entity entity,
String value)
protected org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult validateNumberOfCodesToGenerate(Integer codesToCreate, String value)
protected org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult validateCodeLength(org.broadleafcommerce.openadmin.dto.Entity entity,
String value)
protected long getPossibleCodes(Integer codeLength)
protected int calculateRequiredCodeLength(Integer numberOfCodes)
numberOfCodes - protected org.broadleafcommerce.openadmin.server.service.persistence.validation.PropertyValidationResult validateNumberOfCodesToGenerate(String value, CodeGenerationMethodType generationMethod)
@Deprecated protected int getCodeMultiplier()
CODE_MULTIPLIERCopyright © 2020. All rights reserved.