Class DefaultCouponCodesGenerator
- java.lang.Object
-
- de.hybris.platform.couponservices.couponcodegeneration.impl.DefaultCouponCodesGenerator
-
- All Implemented Interfaces:
CouponCodesGenerator,org.springframework.beans.factory.InitializingBean
public class DefaultCouponCodesGenerator extends java.lang.Object implements CouponCodesGenerator, org.springframework.beans.factory.InitializingBean
Default implementation ofCouponCodesGeneratorinterface
-
-
Constructor Summary
Constructors Constructor Description DefaultCouponCodesGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()java.lang.StringgenerateNextCouponCode(MultiCodeCouponModel coupon)generate next coupon code in the batchprotected CouponCodeCipherTextGenerationStrategygetCipherTextStrategy()protected CouponCodeClearTextGenerationStrategygetClearTextStrategy()java.util.Map<java.lang.Integer,java.lang.Integer>getCodeLengthMapping()returns the ratio of clear-text to cipher-text based on total length of the coupon code.protected java.lang.StringinsertCodeSeparators(java.lang.String generatedCode, MultiCodeCouponModel coupon)protected java.lang.StringprintCodeLengths()voidsetCipherTextStrategy(CouponCodeCipherTextGenerationStrategy cipherTextStrategy)voidsetClearTextStrategy(CouponCodeClearTextGenerationStrategy clearTextStrategy)voidsetCodeLengthMapping(java.util.Map<java.lang.Integer,java.lang.Integer> codeLengthMapping)
-
-
-
Method Detail
-
generateNextCouponCode
public java.lang.String generateNextCouponCode(MultiCodeCouponModel coupon)
Description copied from interface:CouponCodesGeneratorgenerate next coupon code in the batch- Specified by:
generateNextCouponCodein interfaceCouponCodesGenerator- Parameters:
coupon- instance ofMultiCodeCouponModelto generate coupons for- Returns:
- next coupon code, null otherwise
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
insertCodeSeparators
protected java.lang.String insertCodeSeparators(java.lang.String generatedCode, MultiCodeCouponModel coupon)
-
printCodeLengths
protected java.lang.String printCodeLengths()
-
getClearTextStrategy
protected CouponCodeClearTextGenerationStrategy getClearTextStrategy()
-
setClearTextStrategy
public void setClearTextStrategy(CouponCodeClearTextGenerationStrategy clearTextStrategy)
-
getCipherTextStrategy
protected CouponCodeCipherTextGenerationStrategy getCipherTextStrategy()
-
setCipherTextStrategy
public void setCipherTextStrategy(CouponCodeCipherTextGenerationStrategy cipherTextStrategy)
-
setCodeLengthMapping
public void setCodeLengthMapping(java.util.Map<java.lang.Integer,java.lang.Integer> codeLengthMapping)
-
getCodeLengthMapping
public java.util.Map<java.lang.Integer,java.lang.Integer> getCodeLengthMapping()
Description copied from interface:CouponCodesGeneratorreturns the ratio of clear-text to cipher-text based on total length of the coupon code.key: coupon code length. value: clear-text length. implicit: cipher-text length = (key - value)
- Specified by:
getCodeLengthMappingin interfaceCouponCodesGenerator
-
-