Class DefaultInventoryEventService
java.lang.Object
de.hybris.platform.warehousing.inventoryevent.service.impl.DefaultInventoryEventService
- All Implemented Interfaces:
InventoryEventService,Serializable
The default implementation of
InventoryEventService- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longaddToAllocationMap(Map<AllocationEventModel, Long> allocationMap, AllocationEventModel allocationEvent, long quantityLeft, Long quantityAvailable) AddsAllocationEventModeland quantity to the Map depending on the quantity left and quantity available.createAllocationEvents(ConsignmentModel consignment) Persists theAllocationEventModelto account for the changes in stock quantities.createAllocationEventsForConsignmentEntry(ConsignmentEntryModel consignmentEntry) Create multipleAllocationEventModelthat are required to fulfill theConsignmentEntryModelcreateCancellationEvents(CancellationEventModel cancellationEventModel) Create multipleCancellationEventModelcreateIncreaseEvent(IncreaseEventModel increaseEventModel) Create an inventory increase eventcreateShrinkageEvent(ShrinkageEventModel shrinkageEventModel) Create a shrinkage event.createWastageEvent(WastageEventModel wastageEventModel) Create a wastage event.protected voidfinalizeStockMap(Map<AllocationEventModel, Long> allocationMap, long quantityLeft) If there's still any quantity left, the first entry of the passed Stock map will be increased by this amount.getAllocationEventsForConsignment(ConsignmentModel consignment) Retrieves a collection ofAllocationEventModelfor the givenConsignmentModelgetAllocationEventsForConsignmentEntry(ConsignmentEntryModel consignmentEntry) Retrieves a collection ofAllocationEventModelfor aConsignmentEntryModelgetAllocationEventsForOrderEntry(OrderEntryModel orderEntry) Retrieves a collection ofAllocationEventModelfor anOrderEntryModelgetAllocationEventsForReallocation(Collection<AllocationEventModel> allocationEvents, Long quantityToDecline) Extracts theStockLevelModelofAllocationEventModeland sorts them by quantity.protected InventoryEventDao<T extends InventoryEventModel>
Collection<T>getInventoryEventsForStockLevel(StockLevelModel stockLevel, Class<T> eventClassType) Retrieves a collection ofInventoryEventModelfor theStockLevelModelprotected ModelServiceprotected StockLevelSelectionStrategyprotected StockServiceprotected TimeServicevoidreallocateAllocationEvent(DeclineEntry declineEntry, Long quantityToDecline) Delete or update the allocation event which has been created for a specific entry to declinevoidsetInventoryEventDao(InventoryEventDao inventoryEventDao) voidsetModelService(ModelService modelService) voidsetStockLevelSelectionStrategy(StockLevelSelectionStrategy stockLevelSelectionStrategy) voidsetStockService(StockService stockService) voidsetTimeService(TimeService timeService)
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER
-
-
Constructor Details
-
DefaultInventoryEventService
public DefaultInventoryEventService()
-
-
Method Details
-
getAllocationEventsForConsignmentEntry
public Collection<AllocationEventModel> getAllocationEventsForConsignmentEntry(ConsignmentEntryModel consignmentEntry) Description copied from interface:InventoryEventServiceRetrieves a collection ofAllocationEventModelfor aConsignmentEntryModel- Specified by:
getAllocationEventsForConsignmentEntryin interfaceInventoryEventService- Parameters:
consignmentEntry- theConsignmentEntryModelfor which to retrieve the event- Returns:
- the collection of
AllocationEventModelassociated to the consignment entry
-
getAllocationEventsForOrderEntry
public Collection<AllocationEventModel> getAllocationEventsForOrderEntry(OrderEntryModel orderEntry) Description copied from interface:InventoryEventServiceRetrieves a collection ofAllocationEventModelfor anOrderEntryModel- Specified by:
getAllocationEventsForOrderEntryin interfaceInventoryEventService- Parameters:
orderEntry- theOrderEntryModelfor which to retrieve the events- Returns:
- the collection of
AllocationEventModelfor the order entry
-
getInventoryEventsForStockLevel
public <T extends InventoryEventModel> Collection<T> getInventoryEventsForStockLevel(StockLevelModel stockLevel, Class<T> eventClassType) Description copied from interface:InventoryEventServiceRetrieves a collection ofInventoryEventModelfor theStockLevelModel- Specified by:
getInventoryEventsForStockLevelin interfaceInventoryEventService- Parameters:
stockLevel- theStockLevelModelfor which the events need to be extractedeventClassType- the class representing the type of inventory event- Returns:
- the collection of inventory events for the given
StockLevelModel
-
createAllocationEvents
Description copied from interface:InventoryEventServicePersists theAllocationEventModelto account for the changes in stock quantities.- Specified by:
createAllocationEventsin interfaceInventoryEventService- Parameters:
consignment- theConsignmentModelwhere stock was allocated; never null- Returns:
- a collection of
AllocationEventModel; never null
-
createAllocationEventsForConsignmentEntry
public List<AllocationEventModel> createAllocationEventsForConsignmentEntry(ConsignmentEntryModel consignmentEntry) Description copied from interface:InventoryEventServiceCreate multipleAllocationEventModelthat are required to fulfill theConsignmentEntryModel- Specified by:
createAllocationEventsForConsignmentEntryin interfaceInventoryEventService- Parameters:
consignmentEntry- theConsignmentEntryModel- Returns:
- a list of persisted
AllocationEventModel
-
createShrinkageEvent
Description copied from interface:InventoryEventServiceCreate a shrinkage event.- Specified by:
createShrinkageEventin interfaceInventoryEventService- Parameters:
shrinkageEventModel- the event containing information about the shrinkage- Returns:
- the shrinkage event; never null
-
createWastageEvent
Description copied from interface:InventoryEventServiceCreate a wastage event.- Specified by:
createWastageEventin interfaceInventoryEventService- Parameters:
wastageEventModel- the event containing information about the wastage- Returns:
- the wastage event; never null
-
createCancellationEvents
public List<CancellationEventModel> createCancellationEvents(CancellationEventModel cancellationEventModel) Description copied from interface:InventoryEventServiceCreate multipleCancellationEventModel- Specified by:
createCancellationEventsin interfaceInventoryEventService- Parameters:
cancellationEventModel- the event containing information about the cancelled consignment entry- Returns:
- the collection of persisted
CancellationEventModel
-
createIncreaseEvent
Description copied from interface:InventoryEventServiceCreate an inventory increase event- Specified by:
createIncreaseEventin interfaceInventoryEventService- Parameters:
increaseEventModel- theIncreaseEventModelcontaining information about the increase event model- Returns:
- the increase event model
-
reallocateAllocationEvent
Description copied from interface:InventoryEventServiceDelete or update the allocation event which has been created for a specific entry to decline- Specified by:
reallocateAllocationEventin interfaceInventoryEventService- Parameters:
declineEntry- theDeclineEntryto decline/reallocatequantityToDecline- the quantity to decline/reallocate
-
getAllocationEventsForReallocation
public Map<AllocationEventModel,Long> getAllocationEventsForReallocation(Collection<AllocationEventModel> allocationEvents, Long quantityToDecline) Description copied from interface:InventoryEventServiceExtracts theStockLevelModelofAllocationEventModeland sorts them by quantity. Tries to map quantity to a stock level for adjustement- Specified by:
getAllocationEventsForReallocationin interfaceInventoryEventService- Parameters:
allocationEvents- collection of allocation eventsquantityToDecline- total quantity to be adjusted- Returns:
- a map of
AllocationEventModelwith the quantity to adjust for this stock level
-
addToAllocationMap
protected long addToAllocationMap(Map<AllocationEventModel, Long> allocationMap, AllocationEventModel allocationEvent, long quantityLeft, Long quantityAvailable) AddsAllocationEventModeland quantity to the Map depending on the quantity left and quantity available. Returns the quantity that was not able to be fulfilled by the passedAllocationEventModel- Parameters:
allocationMap- theAllocationEventModelmap to append the stock passedallocationEvent- theAllocationEventModelquantityLeft- the quantity left to be added to the mapquantityAvailable- the quantity available in the passedInventoryEventModel.getStockLevel()- 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:
allocationMap- theAllocationEventModelto quantity mapquantityLeft- the quantity left to fulfill
-
getAllocationEventsForConsignment
public Collection<AllocationEventModel> getAllocationEventsForConsignment(ConsignmentModel consignment) Description copied from interface:InventoryEventServiceRetrieves a collection ofAllocationEventModelfor the givenConsignmentModel- Specified by:
getAllocationEventsForConsignmentin interfaceInventoryEventService- Parameters:
consignment- theConsignmentModelfor which all allocation events will be returned- Returns:
- the collection of
AllocationEventModel
-
getModelService
-
setModelService
-
getInventoryEventDao
-
setInventoryEventDao
-
getStockLevelSelectionStrategy
-
setStockLevelSelectionStrategy
-
getStockService
-
setStockService
-
getTimeService
-
setTimeService
-