Interface StockService

All Known Implementing Classes:
DefaultStockService

public interface StockService
Service for 'Stock Level Management'. It offers ...
Spring Bean ID:
stockService
  • Field Details

  • Method Details

    • getProductStatus

      StockLevelStatus getProductStatus(ProductModel product, WarehouseModel warehouse)
      Checks the stock level status of the product in the specified warehouse.
      Parameters:
      product - the product
      warehouse - warehouse of the product
      Returns:
      stock level status
    • getProductStatus

      StockLevelStatus getProductStatus(ProductModel product, Collection<WarehouseModel> warehouses)
      Checks the stock level status of the product in all specified warehouses.
      Parameters:
      product - the product
      warehouses - warehouses of the product
      Returns:
      stock level status
    • getTotalStockLevelAmount

      int getTotalStockLevelAmount(ProductModel product)
      Finds the stock levels of the specified product from all warehouses, and calculates the total actual amount.
      Parameters:
      product - the product
      Returns:
      calculated actual amount of the specified product
      Throws:
      StockLevelNotFoundException - if no such StockLevelModel can be found
    • getTotalStockLevelAmount

      int getTotalStockLevelAmount(ProductModel product, Collection<WarehouseModel> warehouses)
      Finds all stock levels of the specified product in the specified warehouses, and calculates the total actual amount.
      Parameters:
      product - the product
      warehouses - the warehouses
      Returns:
      calculated actual amount of the specified product in the warehouses
      Throws:
      StockLevelNotFoundException - if no such StockLevelModel can be found
    • getStockLevelAmount

      int getStockLevelAmount(ProductModel product, WarehouseModel warehouse)
      Finds the stock level of the specified product in the specified warehouse, and calculates the actual available amount.
      Parameters:
      product - the product
      warehouse - warehouse of the product
      Returns:
      actual available amount for the specific product
      Throws:
      StockLevelNotFoundException - if no such StockLevelModel can be found
    • updateActualStockLevel

      void updateActualStockLevel(ProductModel product, WarehouseModel warehouse, int actualAmount, String comment)
      Updates the actual stock level of the specified product in the specified warehouse.
      Parameters:
      product - the product
      warehouse - the warehouse where product is 'stored'
      actualAmount - the actual amount of the product
      comment - the comment for the update operation
    • reserve

      void reserve(ProductModel product, WarehouseModel warehouse, int amount, String comment) throws InsufficientStockLevelException
      Reserves the product in the specified warehouse.
      Parameters:
      product - the product
      warehouse - the warehouse where product is 'stored'
      amount - the amount of the reservation
      comment - the comment for the reservation
      Throws:
      InsufficientStockLevelException - if not enough products are available in the stock
    • release

      void release(ProductModel product, WarehouseModel warehouse, int amount, String comment)
      Release the product in the specified warehouse.
      Parameters:
      product - the product
      warehouse - the warehouse where product is 'stored'
      amount - the amount of the release
      comment - the comment for the release
    • setInStockStatus

      void setInStockStatus(ProductModel product, Collection<WarehouseModel> warehouses, InStockStatus status)
      Sets the in stock status of all stock levels of the product in the specified warehouses.
      Parameters:
      product - the product
      warehouses - the warehouses
      status - the in stock status
    • getInStockStatus

      InStockStatus getInStockStatus(ProductModel product, WarehouseModel warehouse)
      Checks the stock level status of the product in the specified warehouses.
      Parameters:
      product - the product
      warehouse - the warehouse
      Returns:
      the in stock status
    • getAvailability

      String getAvailability(ProductModel product, WarehouseModel warehouse, Date date, LanguageModel language)
      Gets the available quantity of the product for the specified warehouse.
      Parameters:
      product - the product
      warehouse - the warehouse
      date - the date the specified quantity has to be available at least (could be null).
      language - language for which the text should be localized
      Returns:
      the configured availability text message
    • getAvailability

      String getAvailability(ProductModel product, List<WarehouseModel> warehouses, Date date, LanguageModel language)
      Gets the available quantity of the product for the specified warehouses.
      Parameters:
      product - the product
      warehouses - the warehouses
      date - the date the specified quantity has to be available at least (could be null).
      language - language for which the text should be localized
      Returns:
      the configured availability text message
    • getAvailability

      String getAvailability(ProductModel product, WarehouseModel warehouse, int quantity, LanguageModel language)
      Gets availability date by invoking strategy for calculating product availability, passing product, quantity and warehouse as parameters.
      Parameters:
      product - the product
      warehouse - the warehouse
      quantity - the asked quantity
      language - language for which the text should be localized
      Returns:
      String the configured availability text message
    • getAvailability

      String getAvailability(ProductModel product, List<WarehouseModel> warehouses, int quantity, LanguageModel language)
      Gets availability date by invoking strategy for calculating product availability, passing product, quantity and warehouses as parameters.
      Parameters:
      product - the product
      warehouses - the warehouses
      quantity - the asked quantity
      language - language for which the text should be localized
      Returns:
      the configured availability text message
    • getBestMatchOfQuantity

      WarehouseModel getBestMatchOfQuantity(Map<WarehouseModel,Integer> map)
      Returns the warehouse which offers the "best" product "quantity".
      Parameters:
      map - the mapped quantities of a certain product
      Returns:
      WarehouseModel best match
    • getBestMatchOfAvailability

      WarehouseModel getBestMatchOfAvailability(Map<WarehouseModel,Date> map)
      Returns the warehouse which offers the "best" product "availability" .
      Parameters:
      map - the mapped available dates of a certain product
      Returns:
      WarehouseModel best match
    • getStockLevel

      StockLevelModel getStockLevel(ProductModel product, WarehouseModel warehouse)
      Finds the stock level of the specified product at the specified warehouse.
      Parameters:
      product - the product
      warehouse - warehouse of the product
      Returns:
      found stock level, and null if no such stock level can be found.
    • getAllStockLevels

      Collection<StockLevelModel> getAllStockLevels(ProductModel product)
      Finds the stock levels of the specified product from all warehouses.
      Parameters:
      product - the product
      Returns:
      all found stock levels of product
    • getStockLevels

      Collection<StockLevelModel> getStockLevels(ProductModel product, Collection<WarehouseModel> warehouses)
      Finds all stock levels of the specified product in the specified warehouses.
      Parameters:
      product - the product
      warehouses - the warehouses
      Returns:
      found stock levels of the product
    • getAvailability

      Map<WarehouseModel,Integer> getAvailability(List<WarehouseModel> warehouses, ProductModel product, Date date)
      Gets the product quantity for the specified product, warehouses and date.
      Parameters:
      warehouses - the warehouses
      product - the product
      date - the date the specified quantity has to be available at least.
      Returns:
      the mapped quantity
    • getAvailability

      Map<WarehouseModel,Date> getAvailability(List<WarehouseModel> warehouses, ProductModel product, int preOrderQuantity)
      Returns product availability, passing product, and quantity as parameters.
      Parameters:
      warehouses - the warehouses
      product - the product
      preOrderQuantity - the asked min. preOrderQuantity
      Returns:
      the date, when the questioned quantity will be available