Class DefaultTravelOrderCodeGenerationStrategy
java.lang.Object
de.hybris.platform.travelservices.strategies.impl.DefaultTravelOrderCodeGenerationStrategy
- All Implemented Interfaces:
TravelOrderCodeGenerationStrategy
public class DefaultTravelOrderCodeGenerationStrategy
extends Object
implements TravelOrderCodeGenerationStrategy
The type Default travel order code generation strategy.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerateTravelOrderCode(AbstractOrderModel orderModel) Generates a suitable unique code and sets it against the orderprotected StringgetCodeFromOrderNumber(String convertedOrderCode) Algorithm to calculate the order code starting from the one generated by the persistent key generator.protected de.hybris.platform.servicelayer.model.ModelServiceprotected StringnormalizeCode(String codeToNormalize) Normalize the code, removing sign if present and padding with a zero if the leading zero had been truncated because not significant.voidsetModelService(de.hybris.platform.servicelayer.model.ModelService modelService) protected booleanupdateOrderCode(String orderCode, AbstractOrderModel orderModel)
-
Constructor Details
-
DefaultTravelOrderCodeGenerationStrategy
public DefaultTravelOrderCodeGenerationStrategy()
-
-
Method Details
-
generateTravelOrderCode
Description copied from interface:TravelOrderCodeGenerationStrategyGenerates a suitable unique code and sets it against the order- Specified by:
generateTravelOrderCodein interfaceTravelOrderCodeGenerationStrategy
-
updateOrderCode
-
getCodeFromOrderNumber
Algorithm to calculate the order code starting from the one generated by the persistent key generator. Steps: - Code is initially converted into a base36 number (6 alphanumeric chars) - From the string built in the previous step, a SHA512 digest (128 chars) is calculated - The digest is shuffled - 8 alphanumeric chars are extracted from the digest and shuffled - The 8 chars (HEX) are converted into an integer - The integer coming from the previous step, is converted into a base36 number and it will always be a 6 alphanumeric chars string- Parameters:
convertedOrderCode-- Returns:
-
normalizeCode
Normalize the code, removing sign if present and padding with a zero if the leading zero had been truncated because not significant.- Parameters:
codeToNormalize-- Returns:
-
getModelService
protected de.hybris.platform.servicelayer.model.ModelService getModelService()- Returns:
- modelService
-
setModelService
public void setModelService(de.hybris.platform.servicelayer.model.ModelService modelService) - Parameters:
modelService- the modelService to set
-