Inventory Import Extensibility Guide
The main extension points of the inventory import are the following classes
- InventoryImportDTO
- To add fields to the dto (and thus adding fields in the import payload) extend InventoryImportDTO and create a bean overriding the default bean. The id of the bean to override is
com.broadleafcommerce.inventory.advanced.admin.web.api.dto.InventoryImportDTO
- To add fields to the dto (and thus adding fields in the import payload) extend InventoryImportDTO and create a bean overriding the default bean. The id of the bean to override is
- UpdateInventoryInfo
- This will most likely need to be overridden if
InventoryImportDTO
is overridden. - Additionally AdvancedInventoryImportServiceImpl#createInfoRecord will need be overridden to add the additional fields added to
InventoryImportDTO
- This will most likely need to be overridden if
- AdminAdvancedInventoryImportEndpoint
- This should be extended if the request mappings need to be changed for importing inventory or fulfillment locations
- AdvancedInventoryImportEventScheduler
- This class should be extended in the event that there needs to be a customization in how to create the system event. This would include adding new system event details, or changing the worker type (run on a different node than admin).
- SingleLocationInventoryImportEventConsumer
- Configurable property : Batch Size
- property name : advanced-inventory.import.batchSize
- default : 50
- purpose : Limit the number of inventory records we process at a time in order to manage memory usage. Too high of a number may create an OutOfMemoryException or Garbage Collection Overhead Exceeded exception, too low of a number causes slow imports
- Extension points
- processInventoryImport : reads the given file for the import and parses it. Then delegates to other methods to set the inventory
- This method should be overridden in the event that the import file is not JSON
- MultipleLocationInventoryImportEventConsumer
- Configurable property : Batch Size
- Same as batch size for
SingleLocationInventoryImportEventConsumer
- Extension points
- Same as
SingleLocationInventoryImportEventConsumer
- AdvancedInventoryService
validateUpdateInventoryRequest
- This should be overridden if additional validation should be required to set inventory
updateInventoryRecord
- This should be overridden if there's a client override of
Inventory
andUpdateInventoryInfo
since additional fields will need to be transferred from theUpdateInventoryInfo
object to theInventory
record createInventoryRecord
- Reasons for extension are the same as
updateInventoryRecord