Class DefaultInventoryEventService
- java.lang.Object
-
- de.hybris.platform.warehousing.inventoryevent.service.impl.DefaultInventoryEventService
-
- All Implemented Interfaces:
InventoryEventService
public class DefaultInventoryEventService extends java.lang.Object implements InventoryEventService
The default implementation ofInventoryEventService
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerLOGGER
-
Constructor Summary
Constructors Constructor Description DefaultInventoryEventService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longaddToAllocationMap(java.util.Map<AllocationEventModel,java.lang.Long> allocationMap, AllocationEventModel allocationEvent, long quantityLeft, java.lang.Long quantityAvailable)AddsAllocationEventModeland quantity to the Map depending on the quantity left and quantity available.java.util.Collection<AllocationEventModel>createAllocationEvents(ConsignmentModel consignment)Persists theAllocationEventModelto account for the changes in stock quantities.java.util.List<AllocationEventModel>createAllocationEventsForConsignmentEntry(ConsignmentEntryModel consignmentEntry)Create multipleAllocationEventModelthat are required to fulfill theConsignmentEntryModeljava.util.List<CancellationEventModel>createCancellationEvents(CancellationEventModel cancellationEventModel)Create multipleCancellationEventModelIncreaseEventModelcreateIncreaseEvent(IncreaseEventModel increaseEventModel)Create an inventory increase eventShrinkageEventModelcreateShrinkageEvent(ShrinkageEventModel shrinkageEventModel)Create a shrinkage event.WastageEventModelcreateWastageEvent(WastageEventModel wastageEventModel)Create a wastage event.protected voidfinalizeStockMap(java.util.Map<AllocationEventModel,java.lang.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.java.util.Collection<AllocationEventModel>getAllocationEventsForConsignment(ConsignmentModel consignment)Retrieves a collection ofAllocationEventModelfor the givenConsignmentModeljava.util.Collection<AllocationEventModel>getAllocationEventsForConsignmentEntry(ConsignmentEntryModel consignmentEntry)Retrieves a collection ofAllocationEventModelfor aConsignmentEntryModeljava.util.Collection<AllocationEventModel>getAllocationEventsForOrderEntry(OrderEntryModel orderEntry)Retrieves a collection ofAllocationEventModelfor anOrderEntryModeljava.util.Map<AllocationEventModel,java.lang.Long>getAllocationEventsForReallocation(java.util.Collection<AllocationEventModel> allocationEvents, java.lang.Long quantityToDecline)Extracts theStockLevelModelofAllocationEventModeland sorts them by quantity.protected InventoryEventDaogetInventoryEventDao()<T extends InventoryEventModel>
java.util.Collection<T>getInventoryEventsForStockLevel(StockLevelModel stockLevel, java.lang.Class<T> eventClassType)Retrieves a collection ofInventoryEventModelfor theStockLevelModelprotected ModelServicegetModelService()protected StockLevelSelectionStrategygetStockLevelSelectionStrategy()protected StockServicegetStockService()protected TimeServicegetTimeService()voidreallocateAllocationEvent(DeclineEntry declineEntry, java.lang.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)
-
-
-
Method Detail
-
getAllocationEventsForConsignmentEntry
public java.util.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 java.util.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> java.util.Collection<T> getInventoryEventsForStockLevel(StockLevelModel stockLevel, java.lang.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
public java.util.Collection<AllocationEventModel> createAllocationEvents(ConsignmentModel consignment)
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 java.util.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
public ShrinkageEventModel createShrinkageEvent(ShrinkageEventModel shrinkageEventModel)
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
public WastageEventModel createWastageEvent(WastageEventModel wastageEventModel)
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 java.util.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
public IncreaseEventModel createIncreaseEvent(IncreaseEventModel increaseEventModel)
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
public void reallocateAllocationEvent(DeclineEntry declineEntry, java.lang.Long quantityToDecline)
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 java.util.Map<AllocationEventModel,java.lang.Long> getAllocationEventsForReallocation(java.util.Collection<AllocationEventModel> allocationEvents, java.lang.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(java.util.Map<AllocationEventModel,java.lang.Long> allocationMap, AllocationEventModel allocationEvent, long quantityLeft, java.lang.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
protected void finalizeStockMap(java.util.Map<AllocationEventModel,java.lang.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.- Parameters:
allocationMap- theAllocationEventModelto quantity mapquantityLeft- the quantity left to fulfill
-
getAllocationEventsForConsignment
public java.util.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
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getInventoryEventDao
protected InventoryEventDao getInventoryEventDao()
-
setInventoryEventDao
public void setInventoryEventDao(InventoryEventDao inventoryEventDao)
-
getStockLevelSelectionStrategy
protected StockLevelSelectionStrategy getStockLevelSelectionStrategy()
-
setStockLevelSelectionStrategy
public void setStockLevelSelectionStrategy(StockLevelSelectionStrategy stockLevelSelectionStrategy)
-
getStockService
protected StockService getStockService()
-
setStockService
public void setStockService(StockService stockService)
-
getTimeService
protected TimeService getTimeService()
-
setTimeService
public void setTimeService(TimeService timeService)
-
-