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 Details

    • DefaultTravelOrderCodeGenerationStrategy

      public DefaultTravelOrderCodeGenerationStrategy()
  • Method Details

    • generateTravelOrderCode

      public void generateTravelOrderCode(AbstractOrderModel orderModel)
      Description copied from interface: TravelOrderCodeGenerationStrategy
      Generates a suitable unique code and sets it against the order
      Specified by:
      generateTravelOrderCode in interface TravelOrderCodeGenerationStrategy
    • updateOrderCode

      protected boolean updateOrderCode(String orderCode, AbstractOrderModel orderModel)
    • getCodeFromOrderNumber

      protected String getCodeFromOrderNumber(String convertedOrderCode)
      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

      protected String normalizeCode(String codeToNormalize)
      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