This section describes how to replace the existing InventoryManager with one of your own. It describes the minimum requirements for implementation and the properties to set throughout inventory and fulfillment. For more information on the fulfillment system, see the Configuring the Order Fulfillment Framework chapter.

If the ATG Commerce standard RepositoryInventoryManager does not meet your inventory management needs, you can create your own class that implements the InventoryManager interface. You could also create a new inventory manager if the RepositoryInventoryManager is more complex than you need or if you are building a bridge between the ATG Commerce interface and some existing inventory system already in place. The only requirement ATG Commerce has is that the new class implements InventoryManager.

You can build a new InventoryManager if your site does not require all the functionality provided by the InventoryManager. For example, if you do not allow backorders or preorders, then you can extend the AbstractInventoryManager. This provides default implementations of all the methods other than purchase.

The first set of methods to consider when implementing the InventoryManager API is purchase, purchaseOffBackorder, purchaseOffPreorder, backorder, and preorder. If it is important to maintain separate levels for backordered and preordered items, the purchaseOffBackorder and purchaseOffPreorder will need to maintain those, as well as provide the same functionality as purchase. If separate levels are not needed, they could just be implemented as follows: (this depends on your business rules):

public int purchaseOffBackorder (String pId, long pHowMany)
throws InventoryException
     return purchase(pId, pHowMany);

To allow an administrator to control the various inventory levels and to allow the system to automatically correct them, you need to implement the following methods:

  • setStockLevel

  • setBackorderLevel

  • setPreorderLevel

  • increaseStockLevel

  • increaseBackorderLevel

  • increasePreorderLevel

  • decreaseStockLevel

  • decreaseBackorderLevel

  • decreasePreorderLevel

setAvailabilityStatus and setAvailabilityDate also control attributes for the items in inventory. These are important when informing customers on the availability of the items in which they are interested.

If you want to be notified when any of the inventory levels becomes dangerously low, a threshold for each level must be maintained. To allow for this, provide implementations for setStockThreshold, setBackorderThreshold, and setPreorderThreshold.

All the query methods are useful for providing information on each of the items in inventory. The only one of these methods that ATG Commerce depends on out-of-the-box is queryAvailabilityStatus.

If your inventory manager will be providing notifications to other systems when inventory is increased, implement inventoryWasUpdated.

loading table of contents...