Interface StockLevelDao

All Superinterfaces:
Dao
All Known Implementing Classes:
DefaultStockLevelDao

public interface StockLevelDao extends Dao
  • Method Details

    • findStockLevel

      StockLevelModel findStockLevel(String productCode, WarehouseModel warehouse)
      Finds the stock level of the specified product at the specified warehouse.
      Parameters:
      productCode - the product code
      warehouse - warehouse of the product
      Returns:
      found stock level, and null if no such stock level can be found.
      Throws:
      IllegalArgumentException - if either productCode or warehouse is null
    • findAllStockLevels

      Collection<StockLevelModel> findAllStockLevels(String productCode)
      Finds the stock levels of the specified product from all warehouses.
      Parameters:
      productCode - the product code
      Returns:
      all found stock levels of product
      Throws:
      IllegalArgumentException - if productCode is null
    • findStockLevels

      Collection<StockLevelModel> findStockLevels(String productCode, Collection<WarehouseModel> warehouses)
      Finds all stock levels of the specified product in the specified warehouses.
      Parameters:
      productCode - the product code
      warehouses - the warehouses
      Returns:
      found stock levels of the product
      Throws:
      IllegalArgumentException - if either productCode or warehouses is null
    • findStockLevels

      Collection<StockLevelModel> findStockLevels(String productCode, Collection<WarehouseModel> warehouses, int preOrderQuantity)
    • getAvailableQuantity

      Integer getAvailableQuantity(WarehouseModel warehouse, String productCode)
    • reserve

      Integer reserve(StockLevelModel stockLevel, int amount)
      Reserves the stock level with the amount. NOTE: direct database reservation with jdbc query must be used.
      Parameters:
      stockLevel - the stock level to be reserved
      amount - the amount of the reservation
      Returns:
      the actual stock level reserved amount after successful reservation, or NULL if reservation fails
    • release

      Integer release(StockLevelModel stockLevel, int amount)
      Releases the stock level with the amount. NOTE: direct database reservation with jdbc query must be used.
      Parameters:
      stockLevel - the stock level to be released
      amount - the amount of the release
      Returns:
      the actual stock level reserved amount after successful release, or NULL if release fails
    • updateActualAmount

      void updateActualAmount(StockLevelModel stockLevel, int actualAmount)
      Updates the actual stock level with the actual amount. NOTE: direct database reservation with jdbc query must be used.
      Parameters:
      stockLevel - the stock level to be updated
      actualAmount - the actual amount of the stock level