The SwitchingInventoryManager component determines which InventoryManager to use in ASA. If a location is not specified, the existing StoreInventoryManager that extends the RepositoryInventoryManager is used. When a specific location is used and the inventory at a specific location is requested, the SIMInventoryManager is used.

An example configuration:

# /atg/commerce/inventory/InventoryManager.properties
$class=atg.projects.store.mobile.inventory.SwitchingInventoryManager

# in-store items will use the new SIMInventoryManager
inStoreInventoryManager=/atg/.../SIMInventoryManager

# online items will use the existing atg.projects.store.inventory.StoreInventoryManager component
onlineInventoryManager=/atg/.../RepositoryInventoryManager

A coding example:

LocationInventoryManager determineInventoryManager(String pID, String pLocationID) {
  // if a location is specified, use the SIMInventoryManager
  if (pLocationID != null) return getInStoreInventoryManager();
  // no location specified means the item is being shipped from the "online warehouse"
  // return the
  return getOnlineInventoryManager();
}
public int purchase (String pId, long pHowMany, String pLocationId) {
  return determineInventoryManager(pId, pLocationId()).purchase(pId, pHowMany, pLocationId);
}

Copyright © 1997, 2016 Oracle and/or its affiliates. All rights reserved. Legal Notices