Class DefaultStockLevelSelectionStrategy
java.lang.Object
de.hybris.platform.warehousing.stock.strategies.impl.DefaultStockLevelSelectionStrategy
- All Implemented Interfaces:
StockLevelSelectionStrategy,Serializable
public class DefaultStockLevelSelectionStrategy
extends Object
implements StockLevelSelectionStrategy
The default implementation of
StockLevelSelectionStrategy- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longaddToStockMap(Map<StockLevelModel, Long> stockMap, StockLevelModel stockLevel, long quantityLeft, Long quantityAvailable) AddsStockLevelModeland quantity to the Map depending on the quantity left and quantity available.protected List<StockLevelModel>filterAsnCancelledStockLevels(Collection<StockLevelModel> stockLevels) Removes theStockLevelModel(s), which belong to cancelledAdvancedShippingNoticeModelprotected voidfinalizeStockMap(Map<StockLevelModel, 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 CommerceAvailabilityCalculationStrategygetStockLevelsForAllocation(Collection<StockLevelModel> stockLevels, Long quantityToAllocate) Sorts and splits theStockLevelModeland returns a Map ofStockLevelModelto fulfill the quantity passed.getStockLevelsForCancellation(Collection<AllocationEventModel> allocationEvents, Long quantityToCancel) Extracts the stock levels out of the listAllocationEventModel.voidsetCommerceStockLevelCalculationStrategy(CommerceAvailabilityCalculationStrategy commerceStockLevelCalculationStrategy)
-
Constructor Details
-
DefaultStockLevelSelectionStrategy
public DefaultStockLevelSelectionStrategy()
-
-
Method Details
-
getStockLevelsForAllocation
public Map<StockLevelModel,Long> getStockLevelsForAllocation(Collection<StockLevelModel> stockLevels, Long quantityToAllocate) Description copied from interface:StockLevelSelectionStrategySorts and splits theStockLevelModeland returns a Map ofStockLevelModelto fulfill the quantity passed.- Specified by:
getStockLevelsForAllocationin interfaceStockLevelSelectionStrategy- Parameters:
stockLevels- collection of stock level modelquantityToAllocate- total quantity to be allocated- Returns:
- a map of
StockLevelModeland quantity to be allocated per stock level
-
getStockLevelsForCancellation
public Map<StockLevelModel,Long> getStockLevelsForCancellation(Collection<AllocationEventModel> allocationEvents, Long quantityToCancel) Description copied from interface:StockLevelSelectionStrategyExtracts the stock levels out of the listAllocationEventModel. Sorts, splits and returns a Map ofStockLevelModelto fulfill the quantity passed.- Specified by:
getStockLevelsForCancellationin interfaceStockLevelSelectionStrategy- Parameters:
allocationEvents- collection of allocation eventsquantityToCancel- total quantity to be cancelled- Returns:
- a map of
StockLevelModela the quantity to cancel for this stock level.
-
addToStockMap
protected long addToStockMap(Map<StockLevelModel, Long> stockMap, StockLevelModel stockLevel, long quantityLeft, Long quantityAvailable) AddsStockLevelModeland quantity to the Map depending on the quantity left and quantity available. Returns the quantity that was not able to be fulfilled by the passedStockLevelModel- Parameters:
stockMap- theStockLevelModelmap to append the stock passedstockLevel- theStockLevelModelquantityLeft- the quantity left to be added to the mapquantityAvailable- the quantity available in the passedStockLevelModel- Returns:
- the quantity left.
-
finalizeStockMap
If there's still any quantity left, the first entry of the passed Stock map will be increased by this amount.- Parameters:
stockMap- theStockLevelModelto quantity mapquantityLeft- the quantity left to fulfill
-
filterAsnCancelledStockLevels
protected List<StockLevelModel> filterAsnCancelledStockLevels(Collection<StockLevelModel> stockLevels) Removes theStockLevelModel(s), which belong to cancelledAdvancedShippingNoticeModel- Parameters:
stockLevels- the given collection ofStockLevelModel- Returns:
- the filtered list of
StockLevelModel(s) or null if the filtered list is empty
-
getCommerceStockLevelCalculationStrategy
-
setCommerceStockLevelCalculationStrategy
public void setCommerceStockLevelCalculationStrategy(CommerceAvailabilityCalculationStrategy commerceStockLevelCalculationStrategy)
-