public class DefaultStockLevelSelectionStrategy extends java.lang.Object implements StockLevelSelectionStrategy
StockLevelSelectionStrategy| Constructor and Description |
|---|
DefaultStockLevelSelectionStrategy() |
| Modifier and Type | Method and Description |
|---|---|
protected long |
addToStockMap(java.util.Map<StockLevelModel,java.lang.Long> stockMap,
StockLevelModel stockLevel,
long quantityLeft,
java.lang.Long quantityAvailable)
Adds
StockLevelModel and quantity to the Map depending on the quantity left and quantity available. |
protected java.util.List<StockLevelModel> |
filterAsnCancelledStockLevels(java.util.Collection<StockLevelModel> stockLevels)
Removes the
StockLevelModel(s), which belong to cancelled AdvancedShippingNoticeModel |
protected void |
finalizeStockMap(java.util.Map<StockLevelModel,java.lang.Long> stockMap,
long quantityLeft)
If there's still any quantity left, the first entry of the passed Stock map will be increased by this amount.
|
protected CommerceAvailabilityCalculationStrategy |
getCommerceStockLevelCalculationStrategy() |
java.util.Map<StockLevelModel,java.lang.Long> |
getStockLevelsForAllocation(java.util.Collection<StockLevelModel> stockLevels,
java.lang.Long quantityToAllocate)
Sorts and splits the
StockLevelModel and returns a Map of StockLevelModel to fulfill the quantity passed. |
java.util.Map<StockLevelModel,java.lang.Long> |
getStockLevelsForCancellation(java.util.Collection<AllocationEventModel> allocationEvents,
java.lang.Long quantityToCancel)
Extracts the stock levels out of the list
AllocationEventModel. |
void |
setCommerceStockLevelCalculationStrategy(CommerceAvailabilityCalculationStrategy commerceStockLevelCalculationStrategy) |
public java.util.Map<StockLevelModel,java.lang.Long> getStockLevelsForAllocation(java.util.Collection<StockLevelModel> stockLevels, java.lang.Long quantityToAllocate)
StockLevelSelectionStrategyStockLevelModel and returns a Map of StockLevelModel to fulfill the quantity passed.getStockLevelsForAllocation in interface StockLevelSelectionStrategystockLevels - collection of stock level modelquantityToAllocate - total quantity to be allocatedStockLevelModel and quantity to be allocated per stock levelpublic java.util.Map<StockLevelModel,java.lang.Long> getStockLevelsForCancellation(java.util.Collection<AllocationEventModel> allocationEvents, java.lang.Long quantityToCancel)
StockLevelSelectionStrategyAllocationEventModel. Sorts, splits and returns a Map of StockLevelModel to
fulfill the quantity passed.getStockLevelsForCancellation in interface StockLevelSelectionStrategyallocationEvents - collection of allocation eventsquantityToCancel - total quantity to be cancelledStockLevelModel a the quantity to cancel for this stock level.protected long addToStockMap(java.util.Map<StockLevelModel,java.lang.Long> stockMap, StockLevelModel stockLevel, long quantityLeft, java.lang.Long quantityAvailable)
StockLevelModel and quantity to the Map depending on the quantity left and quantity available.
Returns the quantity that was not able to be fulfilled by the passed StockLevelModelstockMap - the StockLevelModel map to append the stock passedstockLevel - the StockLevelModelquantityLeft - the quantity left to be added to the mapquantityAvailable - the quantity available in the passed StockLevelModelprotected void finalizeStockMap(java.util.Map<StockLevelModel,java.lang.Long> stockMap, long quantityLeft)
stockMap - the StockLevelModel to quantity mapquantityLeft - the quantity left to fulfillprotected java.util.List<StockLevelModel> filterAsnCancelledStockLevels(java.util.Collection<StockLevelModel> stockLevels)
StockLevelModel(s), which belong to cancelled AdvancedShippingNoticeModelstockLevels - the given collection of StockLevelModelStockLevelModel(s) or null if the filtered list is emptyprotected CommerceAvailabilityCalculationStrategy getCommerceStockLevelCalculationStrategy()
public void setCommerceStockLevelCalculationStrategy(CommerceAvailabilityCalculationStrategy commerceStockLevelCalculationStrategy)
Copyright © 2018 SAP SE. All Rights Reserved.