Class StockThresholdPopulator<SOURCE extends ProductModel,​TARGET extends StockData>

  • All Implemented Interfaces:
    Populator<SOURCE,​TARGET>

    public class StockThresholdPopulator<SOURCE extends ProductModel,​TARGET extends StockData>
    extends StockPopulator<SOURCE,​TARGET>
    Threshold values are set on categories levels, Stock Threshold Populator populate the value to StockData for a product.
    • Constructor Detail

      • StockThresholdPopulator

        public StockThresholdPopulator()
    • Method Detail

      • getThresholdValue

        protected java.lang.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,
                                               java.util.Set<CategoryModel> processedCategories,
                                               java.util.Map<CategoryModel,​java.lang.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
      • setCmsSiteService

        public void setCmsSiteService​(CMSSiteService cmsSiteService)
      • setCategoryService

        public void setCategoryService​(CategoryService categoryService)