Class StockPopulator<SOURCE extends ProductModel,TARGET extends StockData>

java.lang.Object
de.hybris.platform.commercefacades.product.converters.populator.StockPopulator<SOURCE,TARGET>
All Implemented Interfaces:
Populator<SOURCE,TARGET>

public class StockPopulator<SOURCE extends ProductModel,TARGET extends StockData> extends Object implements Populator<SOURCE,TARGET>
Populate the product data with stock information
  • Constructor Details

    • StockPopulator

      public StockPopulator()
  • Method Details

    • populate

      public void populate(SOURCE productModel, TARGET stockData) throws ConversionException
      Description copied from interface: Populator
      Populate the target instance with values from the source instance.
      Specified by:
      populate in interface Populator<SOURCE extends ProductModel,TARGET extends StockData>
      Parameters:
      productModel - the source object
      stockData - the target to fill
      Throws:
      ConversionException - if an error occurs
    • isStockSystemEnabled

      protected boolean isStockSystemEnabled()
    • isStockSystemEnabled

      protected boolean isStockSystemEnabled(BaseStoreModel baseStore)
    • getThresholdValue

      protected Integer getThresholdValue(ProductModel productModel)
      Loop in all the super categories of a product belongs to, if it is a variant product, get all super categories from its base product also, then get the lowest level value from each of the categories tree, then the minimum values from all the categories trees is the threshold will be applied on a product. If no threshold is set on any categories, then apply the default threshold value set at site level.
      Parameters:
      productModel -
      Returns:
      the threshold value to apply on the given product
    • getThresholdfromOneTree

      protected void getThresholdfromOneTree(CategoryModel currentCategory, Set<CategoryModel> processedCategories, Map<CategoryModel,Integer> thresholdOnCategory)
      The recursive method get the threshold value from a category tree one level up each time, it will exit the recursion when get an value from one level of category and flag all its super categories as processed
      Parameters:
      currentCategory -
      processedCategories -
      thresholdOnCategory - a map contains the threshold value and the category where it set from
    • getBaseStoreService

      protected BaseStoreService getBaseStoreService()
    • setBaseStoreService

      public void setBaseStoreService(BaseStoreService baseStoreService)
    • getCommerceStockService

      protected CommerceStockService getCommerceStockService()
    • setCommerceStockService

      public void setCommerceStockService(CommerceStockService commerceStockService)
    • getCategoryService

      protected CategoryService getCategoryService()
    • setCategoryService

      public void setCategoryService(CategoryService categoryService)
    • getBaseSiteService

      protected BaseSiteService getBaseSiteService()
    • setBaseSiteService

      public void setBaseSiteService(BaseSiteService baseSiteService)