public class DefaultStockService extends java.lang.Object implements StockService
StockService.BEAN_NAME| Constructor and Description |
|---|
DefaultStockService() |
| Modifier and Type | Method and Description |
|---|---|
protected StockLevelModel |
createStockLevel(ProductModel product,
WarehouseModel warehouse,
int available)
Creates a new stock level.
|
protected StockLevelModel |
createStockLevel(ProductModel product,
WarehouseModel warehouse,
int available,
int overSelling,
int reserved,
InStockStatus status,
int maxStockLevelHistoryCount,
boolean treatNegativeAsZero)
Creates a new stock level.
|
protected StockLevelHistoryEntryModel |
createStockLevelHistoryEntry(StockLevelModel stockLevel,
int actual,
int reserved,
StockLevelUpdateType updateType,
java.lang.String comment)
Creates a new stock level history entry.
|
java.util.Collection<StockLevelModel> |
getAllStockLevels(ProductModel product)
Finds the stock levels of the specified product from all warehouses.
|
java.util.Map<WarehouseModel,java.lang.Integer> |
getAvailability(java.util.List<WarehouseModel> warehouses,
ProductModel product,
java.util.Date date)
Gets the product quantity for the specified product, warehouses and date.
|
java.util.Map<WarehouseModel,java.util.Date> |
getAvailability(java.util.List<WarehouseModel> warehouses,
ProductModel product,
int quantity)
Returns product availability, passing product, and quantity as parameters
|
java.lang.String |
getAvailability(ProductModel product,
java.util.List<WarehouseModel> warehouses,
java.util.Date date,
LanguageModel language)
Gets the available quantity of the product for the specified warehouses by invoking injected strategy.
|
java.lang.String |
getAvailability(ProductModel product,
java.util.List<WarehouseModel> warehouses,
int quantity,
LanguageModel language)
Gets availability date by invoking strategy for calculating product availability, passing product, quantity and
warehouses as parameters by invoking injected strategy.
|
java.lang.String |
getAvailability(ProductModel product,
WarehouseModel warehouse,
java.util.Date date,
LanguageModel language)
Gets the available quantity of the product for the specified warehouse.
|
java.lang.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.
|
WarehouseModel |
getBestMatchOfAvailability(java.util.Map<WarehouseModel,java.util.Date> map)
Returns the warehouse which offers the "best" product "availability" by invoking injected strategy.
Configuration: |
WarehouseModel |
getBestMatchOfQuantity(java.util.Map<WarehouseModel,java.lang.Integer> map)
Returns the warehouse which offers the "best" product "quantity" by invoking injected strategy.
Configuration: |
InStockStatus |
getInStockStatus(ProductModel product,
WarehouseModel warehouse)
Checks the stock level status of the product in the specified warehouses.
|
protected ModelService |
getModelService() |
protected ProductAvailabilityStrategy |
getProductAvailabilityStrategy() |
StockLevelStatus |
getProductStatus(ProductModel product,
java.util.Collection<WarehouseModel> warehouses)
Checks the stock level status of the product in all specified warehouses.
|
StockLevelStatus |
getProductStatus(ProductModel product,
WarehouseModel warehouse)
Checks the stock level status of the product in the specified warehouse.
|
StockLevelModel |
getStockLevel(ProductModel product,
WarehouseModel warehouse)
Finds the stock level of the specified product at the specified warehouse.
|
int |
getStockLevelAmount(ProductModel product,
WarehouseModel warehouse)
Finds the stock level of the specified product in the specified warehouse, and calculates the actual available
amount.
|
protected StockLevelDao |
getStockLevelDao() |
protected StockLevelProductStrategy |
getStockLevelProductStrategy() |
java.util.Collection<StockLevelModel> |
getStockLevels(ProductModel product,
java.util.Collection<WarehouseModel> warehouses)
Finds all stock levels of the specified product in the specified warehouses.
|
protected StockLevelStatusStrategy |
getStockLevelStatusStrategy() |
int |
getTotalStockLevelAmount(ProductModel product)
Finds the stock levels of the specified product from all warehouses, and calculates the total actual amount.
|
int |
getTotalStockLevelAmount(ProductModel product,
java.util.Collection<WarehouseModel> warehouses)
Finds all stock levels of the specified product in the specified warehouses, and calculates the total actual
amount.
|
void |
release(ProductModel product,
WarehouseModel warehouse,
int amount,
java.lang.String comment)
Release the product in the specified warehouse.
|
void |
reserve(ProductModel product,
WarehouseModel warehouse,
int amount,
java.lang.String comment)
Reserves the product in the specified warehouse.
|
void |
setInStockStatus(ProductModel product,
java.util.Collection<WarehouseModel> warehouses,
InStockStatus status)
Sets the in stock status of all stock levels of the product in the specified warehouses.
|
void |
setModelService(ModelService modelService) |
void |
setProductAvailabilityStrategy(ProductAvailabilityStrategy productAvailabilityStrategy)
The injected strategy will be used for calculating the availability of the specified product.
|
void |
setStockLevelDao(StockLevelDao stockLevelDao) |
void |
setStockLevelProductStrategy(StockLevelProductStrategy stockLevelProductStrategy) |
void |
setStockLevelStatusStrategy(StockLevelStatusStrategy stockLevelStatusStrategy) |
void |
updateActualStockLevel(ProductModel product,
WarehouseModel warehouse,
int actualAmount,
java.lang.String comment)
Updates the actual stock level of the specified product in the specified warehouse.
|
public StockLevelStatus getProductStatus(ProductModel product, WarehouseModel warehouse)
StockServicegetProductStatus in interface StockServiceproduct - the productwarehouse - warehouse of the productpublic StockLevelStatus getProductStatus(ProductModel product, java.util.Collection<WarehouseModel> warehouses)
StockServicegetProductStatus in interface StockServiceproduct - the productwarehouses - warehouses of the productprotected StockLevelModel createStockLevel(ProductModel product, WarehouseModel warehouse, int available)
StockLevelModel is saved.product - the productwarehouse - warehouse of the productavailable - amount of available productsStockLevelModelprotected StockLevelModel createStockLevel(ProductModel product, WarehouseModel warehouse, int available, int overSelling, int reserved, InStockStatus status, int maxStockLevelHistoryCount, boolean treatNegativeAsZero)
StockLevelModel is saved.product - the productwarehouse - warehouse of the productavailable - amount of available productsoverSelling - amount of over-selling productsreserved - amount of reserved productsstatus - tag of in stock, out of stock, or not specifiedmaxStockLevelHistoryCount - max count of StockLevelHistoryEntryModel, negative value for unlimitedtreatNegativeAsZero - true if negative stock level is treated as zeroStockLevelModelprotected StockLevelHistoryEntryModel createStockLevelHistoryEntry(StockLevelModel stockLevel, int actual, int reserved, StockLevelUpdateType updateType, java.lang.String comment)
StockLevelHistoryEntryModel is saved.stockLevel - the stock level whose history entry should be createdactual - the actual amountreserved - the reserved amountupdateType - the update typecomment - the commentStockLevelHistoryEntryModelpublic int getStockLevelAmount(ProductModel product, WarehouseModel warehouse)
StockServicegetStockLevelAmount in interface StockServiceproduct - the productwarehouse - warehouse of the productpublic int getTotalStockLevelAmount(ProductModel product)
StockServicegetTotalStockLevelAmount in interface StockServiceproduct - the productpublic int getTotalStockLevelAmount(ProductModel product, java.util.Collection<WarehouseModel> warehouses)
StockServicegetTotalStockLevelAmount in interface StockServiceproduct - the productwarehouses - the warehousespublic void setInStockStatus(ProductModel product, java.util.Collection<WarehouseModel> warehouses, InStockStatus status)
StockServicesetInStockStatus in interface StockServiceproduct - the productwarehouses - the warehousesstatus - the in stock statuspublic InStockStatus getInStockStatus(ProductModel product, WarehouseModel warehouse)
StockServicegetInStockStatus in interface StockServiceproduct - the productwarehouse - the warehousepublic void reserve(ProductModel product, WarehouseModel warehouse, int amount, java.lang.String comment) throws InsufficientStockLevelException
StockServicereserve in interface StockServiceproduct - the productwarehouse - the warehouse where product is 'stored'amount - the amount of the reservationcomment - the comment for the reservationInsufficientStockLevelException - if not enough products are available in the stockpublic void release(ProductModel product, WarehouseModel warehouse, int amount, java.lang.String comment)
StockServicerelease in interface StockServiceproduct - the productwarehouse - the warehouse where product is 'stored'amount - the amount of the releasecomment - the comment for the releasepublic void updateActualStockLevel(ProductModel product, WarehouseModel warehouse, int actualAmount, java.lang.String comment)
StockServiceupdateActualStockLevel in interface StockServiceproduct - the productwarehouse - the warehouse where product is 'stored'actualAmount - the actual amount of the productcomment - the comment for the update operationpublic java.util.Map<WarehouseModel,java.lang.Integer> getAvailability(java.util.List<WarehouseModel> warehouses, ProductModel product, java.util.Date date)
getAvailability in interface StockServicewarehouses - the warehousesproduct - the productdate - the date the specified quantity has to be available at least.public java.util.Map<WarehouseModel,java.util.Date> getAvailability(java.util.List<WarehouseModel> warehouses, ProductModel product, int quantity)
getAvailability in interface StockServiceproduct - the productwarehouses - the warehousesquantity - the asked quantitypublic java.lang.String getAvailability(ProductModel product, WarehouseModel warehouse, java.util.Date date, LanguageModel language)
StockServicegetAvailability in interface StockServiceproduct - the productwarehouse - the warehousedate - the date the specified quantity has to be available at least (could be null).language - language for which the text should be localizedpublic java.lang.String getAvailability(ProductModel product, java.util.List<WarehouseModel> warehouses, java.util.Date date, LanguageModel language)
getAvailability in interface StockServiceproduct - the productwarehouses - the warehousesdate - the date the specified quantity has to be available at least (could be null).language - language for which the text should be localizedpublic java.lang.String getAvailability(ProductModel product, WarehouseModel warehouse, int quantity, LanguageModel language)
StockServicegetAvailability in interface StockServiceproduct - the productwarehouse - the warehousequantity - the asked quantitylanguage - language for which the text should be localizedpublic java.lang.String getAvailability(ProductModel product, java.util.List<WarehouseModel> warehouses, int quantity, LanguageModel language)
getAvailability in interface StockServiceproduct - the productwarehouses - the warehousesquantity - the asked quantitylanguage - language for which the text should be localizedpublic WarehouseModel getBestMatchOfQuantity(java.util.Map<WarehouseModel,java.lang.Integer> map)
getBestMatchOfQuantity in interface StockServicemap - the mapped quantities of a certain productpublic WarehouseModel getBestMatchOfAvailability(java.util.Map<WarehouseModel,java.util.Date> map)
getBestMatchOfAvailability in interface StockServicemap - the mapped available dates of a certain productpublic StockLevelModel getStockLevel(ProductModel product, WarehouseModel warehouse)
StockServicegetStockLevel in interface StockServiceproduct - the productwarehouse - warehouse of the productpublic java.util.Collection<StockLevelModel> getAllStockLevels(ProductModel product)
StockServicegetAllStockLevels in interface StockServiceproduct - the productpublic java.util.Collection<StockLevelModel> getStockLevels(ProductModel product, java.util.Collection<WarehouseModel> warehouses)
StockServicegetStockLevels in interface StockServiceproduct - the productwarehouses - the warehousesprotected ModelService getModelService()
public void setModelService(ModelService modelService)
protected StockLevelDao getStockLevelDao()
public void setStockLevelDao(StockLevelDao stockLevelDao)
protected StockLevelStatusStrategy getStockLevelStatusStrategy()
public void setStockLevelStatusStrategy(StockLevelStatusStrategy stockLevelStatusStrategy)
protected ProductAvailabilityStrategy getProductAvailabilityStrategy()
public void setProductAvailabilityStrategy(ProductAvailabilityStrategy productAvailabilityStrategy)
productAvailabilityStrategy - the productAvailabilityStrategy to setprotected StockLevelProductStrategy getStockLevelProductStrategy()
public void setStockLevelProductStrategy(StockLevelProductStrategy stockLevelProductStrategy)
Copyright © 2018 SAP SE. All Rights Reserved.