Class DefaultTravelCommerceStockService

java.lang.Object
de.hybris.platform.commerceservices.stock.impl.DefaultCommerceStockService
de.hybris.platform.travelservices.stock.impl.DefaultTravelCommerceStockService
All Implemented Interfaces:
de.hybris.platform.commerceservices.stock.CommerceStockService, TravelCommerceStockService
Direct Known Subclasses:
DefaultShoppingTravelCommerceStockService

public class DefaultTravelCommerceStockService extends de.hybris.platform.commerceservices.stock.impl.DefaultCommerceStockService implements TravelCommerceStockService
Service implementation for retrieving stock levels related to transport offering (warehouse)
  • Constructor Details

    • DefaultTravelCommerceStockService

      public DefaultTravelCommerceStockService()
  • Method Details

    • getStockLevel

      @Deprecated public Long getStockLevel(ProductModel product, Collection<TransportOfferingModel> transportOfferings)
      Deprecated.
      Deprecated since version 2.0. Use getStockLevelQuantity(ProductModel, Collection) instead
      Description copied from interface: TravelCommerceStockService
      Gets stock level.
      Specified by:
      getStockLevel in interface TravelCommerceStockService
      Parameters:
      product - the product for which the stock level is checked
      transportOfferings - the collection of transport offering model for the given product.
      Returns:
      Long stock level
    • reserve

      public void reserve(AbstractOrderModel abstractOrder) throws de.hybris.platform.stock.exception.InsufficientStockLevelException
      Description copied from interface: TravelCommerceStockService
      Reserves products in the specified warehouse for a given Order. This method is wrapped in a transaction and so will only commit once the transaction completes without errors.
      Specified by:
      reserve in interface TravelCommerceStockService
      Parameters:
      abstractOrder - the current order
      Throws:
      de.hybris.platform.stock.exception.InsufficientStockLevelException - the insufficient stock level exception
    • release

      public void release(AbstractOrderModel abstractOrder)
      Description copied from interface: TravelCommerceStockService
      Release products in the specified warehouse for a given Order.
      Specified by:
      release in interface TravelCommerceStockService
      Parameters:
      abstractOrder - the current order
    • getStrategyForEntryType

      protected TravelManageStockByEntryTypeStrategy getStrategyForEntryType(AbstractOrderEntryModel entry)
      Gets strategy for entry type.
      Parameters:
      entry - the entry
      Returns:
      the strategy associated to the type the given entry belongs to
    • adjustStockReservationForAmmendment

      public void adjustStockReservationForAmmendment(AbstractOrderModel newOrder, AbstractOrderModel originalOrder) throws de.hybris.platform.stock.exception.InsufficientStockLevelException
      Description copied from interface: TravelCommerceStockService
      Method compares the newOrder with the originalOrder and reserves stock accordingly.
      Specified by:
      adjustStockReservationForAmmendment in interface TravelCommerceStockService
      Parameters:
      newOrder - the new order
      originalOrder - the original order
      Throws:
      de.hybris.platform.stock.exception.InsufficientStockLevelException - the insufficient stock level exception
    • getProductsPerWarehouse

      protected List<StockReservationData> getProductsPerWarehouse(AbstractOrderModel abstractOrder)
      Method to build stock data objects according with entry type, using warehouses for extensibility
      Parameters:
      abstractOrder - the abstract order
      Returns:
      the list of reservation data object to release/reserve stocks
    • adjustStockReservation

      protected void adjustStockReservation(List<StockReservationData> stockToReserve, List<StockReservationData> stockToRelease) throws de.hybris.platform.stock.exception.InsufficientStockLevelException
      Method responsible for adjusting stock reservation. Method is wrapped in a transaction and will only commit if the transaction completes without errors.
      Parameters:
      stockToReserve - the stock to reserve
      stockToRelease - the stock to release
      Throws:
      de.hybris.platform.stock.exception.InsufficientStockLevelException - the insufficient stock level exception
    • findMatchingProduct

      protected void findMatchingProduct(List<StockReservationData> stockToReserve, List<StockReservationData> stockToRelease, Iterator<StockReservationData> newStockReservationData, StockReservationData item1, Iterator<StockReservationData> oldStockReservationData)
      Find matching product.
      Parameters:
      stockToReserve - the stock to reserve
      stockToRelease - the stock to release
      newStockReservationData - the new stock reservation data
      item1 - the item 1
      oldStockReservationData - the old stock reservation data
    • isSameDate

      protected boolean isSameDate(Date date1, Date date2)
      Is same date boolean.
      Parameters:
      date1 - the date 1
      date2 - the date 2
      Returns:
      true if dates are equal or both null
    • getProductsPerTransportOffering

      @Deprecated protected List<StockReservationData> getProductsPerTransportOffering(AbstractOrderModel abstractOrder)
      Deprecated.
      Deprecated since version 2.0. Use getProductsPerWarehouse(AbstractOrderModel) instead.
      Gets products per transport offering.
      Parameters:
      abstractOrder - the abstract order
      Returns:
      products per transport offering
    • enableStockReservation

      protected boolean enableStockReservation()
      Enable stock reservation boolean.
      Returns:
      the boolean
    • getStockForDate

      public Integer getStockForDate(ProductModel product, Date date, Collection<WarehouseModel> warehouses)
      Description copied from interface: TravelCommerceStockService
      This method returns the product availability for a given date
      Specified by:
      getStockForDate in interface TravelCommerceStockService
      Parameters:
      product - the product
      date - the date
      warehouses - the warehouses
      Returns:
      the availability
    • getStockLevelQuantity

      public Long getStockLevelQuantity(ProductModel product, Collection<WarehouseModel> warehouses)
      Description copied from interface: TravelCommerceStockService
      This method calculates availability for a given product
      Specified by:
      getStockLevelQuantity in interface TravelCommerceStockService
      Parameters:
      product - the product
      warehouses - the warehouses
      Returns:
      a long value representing the stock level
    • isStockSystemEnabled

      public boolean isStockSystemEnabled(BaseStoreModel baseStore)
      Specified by:
      isStockSystemEnabled in interface de.hybris.platform.commerceservices.stock.CommerceStockService
      Overrides:
      isStockSystemEnabled in class de.hybris.platform.commerceservices.stock.impl.DefaultCommerceStockService
    • reservePerDateProduct

      public void reservePerDateProduct(ProductModel product, Date date, int quantity, Collection<WarehouseModel> warehouses) throws de.hybris.platform.stock.exception.InsufficientStockLevelException
      Description copied from interface: TravelCommerceStockService
      This method performs reservation for an accommodation for a given date
      Specified by:
      reservePerDateProduct in interface TravelCommerceStockService
      Parameters:
      product - the product
      date - the date
      quantity - the quantity
      warehouses - the warehouses
      Throws:
      de.hybris.platform.stock.exception.InsufficientStockLevelException - the insufficient stock level exception
    • releasePerDateProduct

      public void releasePerDateProduct(ProductModel product, Date date, int quantity, Collection<WarehouseModel> warehouses)
      Description copied from interface: TravelCommerceStockService
      This method performs stock releasing for an accommodation for a given date
      Specified by:
      releasePerDateProduct in interface TravelCommerceStockService
      Parameters:
      product - the product
      date - the date
      quantity - the quantity
      warehouses - the warehouses
    • getStockLevelModelForDate

      protected StockLevelModel getStockLevelModelForDate(ProductModel product, Date date, Collection<WarehouseModel> warehouses)
      Gets stock level model for date.
      Parameters:
      product - the product
      date - the date
      warehouses - the warehouses
      Returns:
      the stock level model for date
    • getConfigurationService

      protected de.hybris.platform.servicelayer.config.ConfigurationService getConfigurationService()
      Gets configuration service.
      Returns:
      the configurationService
    • setConfigurationService

      public void setConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService)
      Sets configuration service.
      Parameters:
      configurationService - the configurationService to set
    • getWarehouseService

      protected de.hybris.platform.ordersplitting.WarehouseService getWarehouseService()
      Gets warehouse service.
      Returns:
      the warehouseService
    • setWarehouseService

      public void setWarehouseService(de.hybris.platform.ordersplitting.WarehouseService warehouseService)
      Sets warehouse service.
      Parameters:
      warehouseService - the warehouseService to set
    • getStockReservationCreationStrategyMap

      protected Map<AddToCartCriteriaType,StockReservationCreationStrategy> getStockReservationCreationStrategyMap()
      Gets stock reservation creation strategy map.
      Returns:
      the stockReservationCreationStrategyMap
    • setStockReservationCreationStrategyMap

      public void setStockReservationCreationStrategyMap(Map<AddToCartCriteriaType,StockReservationCreationStrategy> stockReservationCreationStrategyMap)
      Sets stock reservation creation strategy map.
      Parameters:
      stockReservationCreationStrategyMap - the stockReservationCreationStrategyMap to set
    • getManageStockByEntryTypeStrategyMap

      protected Map<OrderEntryType,TravelManageStockByEntryTypeStrategy> getManageStockByEntryTypeStrategyMap()
      Gets manage stock by entry type strategy map.
      Returns:
      manageStockByEntryTypeStreategyMap manage stock by entry type strategy map
    • setManageStockByEntryTypeStrategyMap

      public void setManageStockByEntryTypeStrategyMap(Map<OrderEntryType,TravelManageStockByEntryTypeStrategy> manageStockByEntryTypeStrategyMap)
      Sets manage stock by entry type strategy map.
      Parameters:
      manageStockByEntryTypeStrategyMap - the manage stock by entry type strategy map
    • getTravelRestrictionService

      protected TravelRestrictionService getTravelRestrictionService()
      Gets travel restriction service.
      Returns:
      the travel restriction service
    • setTravelRestrictionService

      public void setTravelRestrictionService(TravelRestrictionService travelRestrictionService)
      Sets travel restriction service.
      Parameters:
      travelRestrictionService - the travel restriction service
    • getStockReservationReleaseByEntryTypeStrategyMap

      protected Map<OrderEntryType,StockReservationReleaseByEntryTypeStrategy> getStockReservationReleaseByEntryTypeStrategyMap()
      Gets stock reservation release by entry type strategy map.
      Returns:
      the stock reservation release by entry type strategy map
    • setStockReservationReleaseByEntryTypeStrategyMap

      public void setStockReservationReleaseByEntryTypeStrategyMap(Map<OrderEntryType,StockReservationReleaseByEntryTypeStrategy> stockReservationReleaseByEntryTypeStrategyMap)
      Sets stock reservation release by entry type strategy map.
      Parameters:
      stockReservationReleaseByEntryTypeStrategyMap - the stock reservation release by entry type strategy map
    • getModelService

      protected de.hybris.platform.servicelayer.model.ModelService getModelService()
      Gets model service.
      Returns:
      the model service
    • setModelService

      public void setModelService(de.hybris.platform.servicelayer.model.ModelService modelService)
      Sets model service.
      Parameters:
      modelService - the model service
    • getTravelStockService

      protected TravelStockService getTravelStockService()
    • setTravelStockService

      public void setTravelStockService(TravelStockService travelStockService)