atg.commerce.inventory
Class RepositoryInventoryManager

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.messaging.SourceSinkTemplate
              extended by atg.commerce.inventory.RepositoryInventoryManager
All Implemented Interfaces:
InventoryManager, atg.commerce.inventory.LocationInventoryManager, MessageSink, MessageSource, atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class RepositoryInventoryManager
extends SourceSinkTemplate
implements atg.commerce.inventory.LocationInventoryManager

This is a repository based implementation of InventoryManager. It implements all the methods defined by the InventoryManager API. It is a thin wrapper around a repository that contains the inventory information. This allows a maximum amount of flexibility for potential third party integrators. Integrators can simply implement a repository containing the required properties for cooperation with the RepositoryInventoryManager. The Repository InventoryManager can then be configured to extract inventory manager information from the third party repository.

This class also is a message source. It can send UpdateInventory messages if there is new inventory available for a previously unavailable item.


Field Summary
static java.lang.String CLASS_VERSION
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.commerce.inventory.InventoryManager
AVAILABILITY_STATUS_BACKORDERABLE, AVAILABILITY_STATUS_DERIVED, AVAILABILITY_STATUS_DISCONTINUED, AVAILABILITY_STATUS_IN_STOCK, AVAILABILITY_STATUS_OUT_OF_STOCK, AVAILABILITY_STATUS_PREORDERABLE, INVENTORY_STATUS_FAIL, INVENTORY_STATUS_INSUFFICIENT_SUPPLY, INVENTORY_STATUS_ITEM_NOT_FOUND, INVENTORY_STATUS_SUCCEED
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
RepositoryInventoryManager()
           
 
Method Summary
 void acquireInventoryLocks(java.util.List pItemIds)
          Acquires locks for the inventory items that apply to the given ids.
 void acquireInventoryLocks(java.util.List pItemIds, java.lang.String pLocationId)
          For each item in the list, call lock The locks are acquired in sorted order.
 int backorder(java.lang.String pId, long pHowMany)
          Backorder an item.
 int backorder(java.lang.String pId, long pHowMany, java.lang.String pLocationId)
          decrement the item's backorder count, If the item is a bundle backorderBundle is called.
protected  int backorderBundle(java.lang.String pBundleId, long pHowMany, java.lang.String pLocationId)
          Backorders a bundle.
 int decreaseBackorderLevel(java.lang.String pId, long pNumber)
          Decrease an item's backorder level by the specified amount.
 int decreaseBackorderLevel(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          decrease the item's backorder level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.
 int decreasePreorderLevel(java.lang.String pId, long pNumber)
          Decrease an item's preorder level by the specified amount.
 int decreasePreorderLevel(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          decrease the item's preorder level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.
 int decreaseStockLevel(java.lang.String pId, long pNumber)
          Decrease an item's stock level by the specified amount.
 int decreaseStockLevel(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          decrease the item's stock level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.
protected  int decrementSKULevel(MutableRepositoryItem pItem, long pHowMany, java.lang.String pLevelName, java.lang.String pThresholdName)
          Decrement the given level by the given amount.
protected  int decrementSKULevel(MutableRepositoryItem pItem, java.lang.String pLocationId, long pHowMany, java.lang.String pLevelName, java.lang.String pThresholdName)
           
protected  int deriveAvailabilityStatus(java.lang.String pId)
          Derive the availabilityStatus based on the properties of the item Always derives the status, does not check the current value of availabilityStatus.
protected  int deriveAvailabilityStatus(java.lang.String pId, java.lang.String pLocationId)
          Derive the availabilityStatus based on the properties of the item Always derives the status, does not check the current value of availabilityStatus.
protected  int deriveBundleAvailabilityStatus(java.lang.String pBundleId)
          Derives the availability status for a bundle.
protected  int deriveBundleAvailabilityStatus(java.lang.String pBundleId, java.lang.String pLocationId)
          Derives the availability status for a bundle.
 java.lang.String getATPDatePropertyName()
          Returns property ATPDatePropertyName
 java.lang.String getATPInformationPropertyName()
          Returns property ATPInformationPropertyName
 java.lang.String getATPQuantityPropertyName()
          Returns property ATPQuantityPropertyName
 java.lang.String getAvailabilityDatePropertyName()
          Returns property AvailabilityDatePropertyName
 int getAvailabilityStatusBackorderableValue()
          The integer value for the availabilityStatus of BACKORDERABLE
 int getAvailabilityStatusDerivedValue()
          The integer value for the availabilityStatus of DERIVED
 int getAvailabilityStatusDiscontinuedValue()
          The integer value for the availabilityStatus of DISCONTINUED
 int getAvailabilityStatusInStockValue()
          The integer value for the availabilityStatus of IN_STOCK
 int getAvailabilityStatusOutOfStockValue()
          The integer value for the availabilityStatus of OUT_OF_STOCK
 int getAvailabilityStatusPreorderableValue()
          The integer value for the availabilityStatus of PREORDERABLE
 java.lang.String getAvailabilityStatusPropertyName()
          Returns property AvailabilityStatusPropertyName
 java.lang.String getBackorderLevelPropertyName()
          Returns property BackorderLevelPropertyName
 java.lang.String getBackorderThresholdPropertyName()
          Returns property BackorderThresholdPropertyName
 java.util.List getBundledIds(java.lang.String pBundleId)
          Return the list of catalog ref ids contained in the bundle.
protected  java.util.List getBundleLinks(RepositoryItem pBundle)
          Return the List of bundle links for the given id.
protected  java.util.List getBundleLinks(java.lang.String pId)
          Return the List of bundle links for the given id.
 java.lang.String getBundleLinksPropertyName()
          The name of the property bundleLinks
 RqlStatement getCatalogRefIdMatchQuery()
          Returns property CatalogRefIdMatchQuery
 java.lang.String getCatalogRefIdPropertyName()
          Returns property CatalogRefIdPropertyName
protected  RepositoryItem getCatalogRefItem(java.lang.String pId)
          Return the RepositoryItem which represents the catalog ref (aka SKU)
 java.lang.String getCatalogRefItemType()
          Returns property CatalogRefItemType
 Repository getCatalogRefRepository()
          Returns property CatalogRefRepository
 ClientLockManager getClientLockManager()
          Deprecated. locks are no longer used
 long getDefaultBackorderLevel()
          The default value if the backorder level of an item is not defined
 long getDefaultPreorderLevel()
          The default value if the preorder level of an item is not defined
 long getDefaultStockLevel()
          The default value if the stock level of an item is not defined
 java.lang.String getInventoryEventPort()
          The port to which all inventory scenario events are sent.
protected  RepositoryItem getInventoryItem(java.lang.String pId)
          Return the RepositoryItem which represents the inventory information
protected  RepositoryItem getInventoryItem(java.lang.String pId, java.lang.String pLocationId)
          Return the RepositoryItem which represents the inventory information
protected  MutableRepositoryItem getInventoryItemForUpdate(java.lang.String pId)
          Return the MutableRepositoryItem which represents the inventory information
protected  MutableRepositoryItem getInventoryItemForUpdate(java.lang.String pId, java.lang.String pLocationId)
          Return the MutableRepositoryItem which represents the inventory information
 java.lang.String getInventoryName()
          A displayable name for this inventory manager.
 java.lang.String getInventoryRowLockProperty()
          The name of the property of inventory that is used to grab a row lock
 java.lang.String getInventoryRowLockSQL()
          The sql command that is used to grab the row lock
 java.lang.String getItemType()
          Returns property ItemType
 RqlStatement getLocationCatalogRefIdMatchQuery()
          Returns property CatalogRefIdMatchQuery
 java.lang.String getLocationInventoryRowLockSQL()
          The sql command that is used to grab the row lock for a non-null inventory location.
 int getMaximumRetriesPerRowLock()
           
 IdGenerator getMessageIdGenerator()
          The service that generates Ids for all messages.
 java.lang.String getMessageIdSpaceName()
          The name of the idspace to get our message ids from
 int getMillisecondDelayBeforeLockRetry()
           
 java.lang.String getNextMessageId()
          Returns the next unique Id for commerce messages.
 java.lang.String getPreorderLevelPropertyName()
          Returns property PreorderLevelPropertyName
 java.lang.String getPreorderThresholdPropertyName()
          Returns property PreorderThresholdPropertyName
 MutableRepository getRepository()
          Returns property Repository
 java.lang.String getSkuLinkItemPropertyName()
          the name of the item property in a sku link.
 java.lang.String getSkuLinkQuantityPropertyName()
          The name of the quantity property in a sku link
 java.lang.String getStockLevelPropertyName()
          Returns property StockLevelPropertyName
 java.lang.String getStockThresholdPropertyName()
          Returns property StockThresholdPropertyName
 java.lang.String getUpdateInventoryPort()
          The port to which all UpdateInventory messages are sent.
 int increaseBackorderLevel(java.lang.String pId, long pNumber)
          Increase an item's backorder level by the specified number.
 int increaseBackorderLevel(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          increase the item's backorder level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.
 int increasePreorderLevel(java.lang.String pId, long pNumber)
          Increase an item's preorder level by the specified number.
 int increasePreorderLevel(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          increase the item's preorder level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.
 int increaseStockLevel(java.lang.String pId, long pNumber)
          Increase an item's stock level by the specified number.
 int increaseStockLevel(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          increase the item's stock level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.
 int inventoryWasUpdated(java.util.List pItemIds)
          Informs the inventory manager that the given ids are now available.
 int inventoryWasUpdated(java.util.List pItemIds, java.lang.String pLocationId)
          Send an UpdateInventory message out the UpdateInventoryPort.
protected  boolean isBundle(java.lang.String pId)
          Checks to see if the given id refers to a bundle.
protected  void lock(java.lang.String pItemId)
          To allow multiple instance of Dynamo to simultaneously edit inventory items, we need to make sure the repository item we load is current.
protected  void lock(java.lang.String pItemId, java.lang.String pLocationId)
          To allow multiple instance of Dynamo to simultaneously edit inventory items, we need to make sure the repository item we load is current.
 int preorder(java.lang.String pId, long pHowMany)
          Preorder an item.
 int preorder(java.lang.String pId, long pHowMany, java.lang.String pLocationId)
          decrement the item's preorder count, If the item is a bundle preorderBundle is called.
protected  int preorderBundle(java.lang.String pBundleId, long pHowMany)
          Preorders a bundle.
protected  int preorderBundle(java.lang.String pBundleId, long pHowMany, java.lang.String pLocationId)
           
 int purchase(java.lang.String pId, long pHowMany)
          Actually purchases a product.
 int purchase(java.lang.String pId, long pHowMany, java.lang.String pLocationId)
          Check the availability status (queryAvailabilityStatus).
protected  int purchaseBundle(java.lang.String pBundleId, long pHowMany)
          Purchases a bundle by purchase each of its bundle items.
protected  int purchaseBundle(java.lang.String pBundleId, long pHowMany, java.lang.String pLocationId)
          Purchases a bundle by purchase each of its bundle items.
protected  int purchaseBundleOffBackorder(java.lang.String pBundleId, long pHowMany)
          Purchases the bundle then increments the backorderLevel of each item in the bundle.
protected  int purchaseBundleOffBackorder(java.lang.String pBundleId, long pHowMany, java.lang.String pLocationId)
          Purchases the bundle then increments the backorderLevel of each item in the bundle.
protected  int purchaseBundleOffPreorder(java.lang.String pBundleId, long pHowMany)
          Purchases the bundle and increments the preorderLevel of each item in the bundle.
protected  int purchaseBundleOffPreorder(java.lang.String pBundleId, long pHowMany, java.lang.String pLocationId)
          Purchases the bundle and increments the preorderLevel of each item in the bundle.
 int purchaseOffBackorder(java.lang.String pId, long pHowMany)
          Actually purchases a product.
 int purchaseOffBackorder(java.lang.String pId, long pHowMany, java.lang.String pLocationId)
          Check the availability status (queryAvailabilityStatus).
 int purchaseOffPreorder(java.lang.String pId, long pHowMany)
          Actually purchases a product.
 int purchaseOffPreorder(java.lang.String pId, long pHowMany, java.lang.String pLocationId)
          Check the availability status (queryAvailabilityStatus).
 java.util.Date queryAvailabilityDate(java.lang.String pId)
          Return the availability date of an item.
 java.util.Date queryAvailabilityDate(java.lang.String pId, java.lang.String pLocationId)
          query the availability date of an item.
 int queryAvailabilityStatus(java.lang.String pId)
          Return the availability status of a given item.
 int queryAvailabilityStatus(java.lang.String pId, java.lang.String pLocationId)
          Returns the availability status of the item.
 atg.commerce.inventory.AvailableToPromise queryAvailableToPromise(java.lang.String pId, java.lang.String pLocationId)
           
 long queryBackorderLevel(java.lang.String pId)
          Return how many of a given item can be backorder.
 long queryBackorderLevel(java.lang.String pId, java.lang.String pLocationId)
          query the number of items available for backorder.
 long queryBackorderThreshold(java.lang.String pId)
          Return the threshold associated with backorderLevel
 long queryBackorderThreshold(java.lang.String pId, java.lang.String pLocationId)
          Return the threshold associated with backorderLevel
 java.util.Date queryBundleAvailabilityDate(java.lang.String pBundleId, java.lang.String pLocationId)
          Cycles through each item in a bundle and calls queryAvailabilityDate on each.
protected  long queryBundleBackorderLevel(java.lang.String pId)
          Cycles through the items in a bundle and returns the greatest quantity of bundles that could be allocated given each items backorder level.
protected  long queryBundleBackorderLevel(java.lang.String pId, java.lang.String pLocationId)
          Cycles through the items in a bundle and returns the greatest quantity of bundles that could be allocated given each items backorder level.
protected  long queryBundleBackorderThreshold(java.lang.String pId, java.lang.String pLocationId)
          Currently all bundles have thresholds of 0.
protected  long queryBundlePreorderLevel(java.lang.String pId, java.lang.String pLocationId)
          Cycles through the items in a bundle and returns the greatest quantity of bundles that could be preordered given each items backorder level.
protected  long queryBundlePreorderThreshold(java.lang.String pId, java.lang.String pLocationId)
          Currently all bundles have thresholds of 0.
protected  long queryBundleStockLevel(java.lang.String pId, java.lang.String pLocationId)
          Cycles through the items in a bundle and returns the greatest quantity of bundles that could be allocated given each items stock level.
protected  long queryBundleStockThreshold(java.lang.String pId, java.lang.String pLocationId)
          Currently all bundles have thresholds of 0.
 java.util.Collection<InventoryInfo> queryInventoryInformation(java.util.Collection<java.lang.String> pItemIds, java.util.Collection<java.lang.String> pLocationIds)
           
 java.util.Collection<InventoryInfo> queryInventoryInformation(java.util.Collection<java.lang.String> pItemIds, java.lang.String pLocationId)
           
 java.util.Collection<InventoryInfo> queryInventoryInformation(java.lang.String pId, java.util.Collection<java.lang.String> pLocationIds)
           
 InventoryInfo queryInventoryInformation(java.lang.String pId, java.lang.String pLocationId)
           
 long queryPreorderLevel(java.lang.String pId)
          Return how many of a given item can be preorder.
 long queryPreorderLevel(java.lang.String pId, java.lang.String pLocationId)
          query the number of items in available in preorder.
 long queryPreorderThreshold(java.lang.String pId)
          Return the threshold associated with preorderLevel
 long queryPreorderThreshold(java.lang.String pId, java.lang.String pLocationId)
          Return the threshold associated with preorderLevel
 long queryStockLevel(java.lang.String pId)
          Return how many of a given item are in the system.
 long queryStockLevel(java.lang.String pId, java.lang.String pLocationId)
          query the number of items in stock.
 long queryStockThreshold(java.lang.String pId)
          Return the threshold associated with stockLevel.
 long queryStockThreshold(java.lang.String pId, java.lang.String pLocationId)
          Return the threshold associated with stockLevel.
 void releaseInventoryLocks(java.util.List pItemIds)
          Release locks for the inventory items that apply to the given ids.
 void releaseInventoryLocks(java.util.List pItemIds, java.lang.String pLocationId)
          Release locks for the inventory items that apply to the given ids.
 void setATPDatePropertyName(java.lang.String pATPDatePropertyName)
          Sets property ATPDatePropertyName
 void setATPInformationPropertyName(java.lang.String pATPInformationPropertyName)
          Sets property ATPInformationPropertyName
 void setATPQuantityPropertyName(java.lang.String pATPQuantityPropertyName)
          Sets property ATPQuantityPropertyName
 int setAvailabilityDate(java.lang.String pId, java.util.Date pDate)
          Set an item's availability date.
 int setAvailabilityDate(java.lang.String pId, java.util.Date pDate, java.lang.String pLocationId)
          Set an item's availability date.
 void setAvailabilityDatePropertyName(java.lang.String pAvailabilityDatePropertyName)
          Sets property AvailabilityDatePropertyName
 int setAvailabilityStatus(java.lang.String pId, int pStatus)
          Set an item's availability status.
 int setAvailabilityStatus(java.lang.String pId, int pStatus, java.lang.String pLocationId)
          Set an item's availability status.
 void setAvailabilityStatusBackorderableValue(int pAvailabilityStatusBackorderableValue)
           
 void setAvailabilityStatusDerivedValue(int pAvailabilityStatusDerivedValue)
           
 void setAvailabilityStatusDiscontinuedValue(int pAvailabilityStatusDiscontinuedValue)
           
 void setAvailabilityStatusInStockValue(int pAvailabilityStatusInStockValue)
           
 void setAvailabilityStatusOutOfStockValue(int pAvailabilityStatusOutOfStockValue)
           
 void setAvailabilityStatusPreorderableValue(int pAvailabilityStatusPreorderableValue)
           
 void setAvailabilityStatusPropertyName(java.lang.String pAvailabilityStatusPropertyName)
          Sets property AvailabilityStatusPropertyName
 int setBackorderLevel(java.lang.String pId, long pNumber)
          Set an item's backorder level to the specified number.
 int setBackorderLevel(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          set the item's backorder level to pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.
 void setBackorderLevelPropertyName(java.lang.String pBackorderLevelPropertyName)
          Sets property BackorderLevelPropertyName
 int setBackorderThreshold(java.lang.String pId, long pNumber)
          Set an item's backorder level threshold.
 int setBackorderThreshold(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          Set an item's backorder level threshold.
 void setBackorderThresholdPropertyName(java.lang.String pBackorderThresholdPropertyName)
          Sets property BackorderThresholdPropertyName
 void setBundleLinksPropertyName(java.lang.String pBundleLinksPropertyName)
           
 void setCatalogRefIdMatchQuery(RqlStatement pCatalogRefIdMatchQuery)
          Sets property CatalogRefIdMatchQuery
 void setCatalogRefIdPropertyName(java.lang.String pCatalogRefIdPropertyName)
          Sets property CatalogRefIdPropertyName
 void setCatalogRefItemType(java.lang.String pCatalogRefItemType)
          Sets property CatalogRefItemType
 void setCatalogRefRepository(Repository pCatalogRefRepository)
          Sets property CatalogRefRepository
 void setClientLockManager(ClientLockManager pClientLockManager)
          Deprecated. locks are no longer used
 void setDefaultBackorderLevel(long pDefaultBackorderLevel)
           
 void setDefaultPreorderLevel(long pDefaultPreorderLevel)
           
 void setDefaultStockLevel(long pDefaultStockLevel)
           
 void setInventoryEventPort(java.lang.String pInventoryEventPort)
           
 void setInventoryName(java.lang.String pInventoryName)
           
 void setInventoryRowLockProperty(java.lang.String pInventoryRowLockProperty)
           
 void setInventoryRowLockSQL(java.lang.String pInventoryRowLockSQL)
           
 void setItemType(java.lang.String pItemType)
          Sets property ItemType
 void setLocationCatalogRefIdMatchQuery(RqlStatement pLocationCatalogRefIdMatchQuery)
          Sets property CatalogRefIdMatchQuery
 void setLocationInventoryRowLockSQL(java.lang.String pLocationInventoryRowLockSQL)
           
 void setMaximumRetriesPerRowLock(int pMaximumRetriesPerRowLock)
           
 void setMessageIdGenerator(IdGenerator pMessageIdGenerator)
           
 void setMessageIdSpaceName(java.lang.String pMessageIdSpaceName)
           
 void setMillisecondDelayBeforeLockRetry(int pMillisecondDelayBeforeLockRetry)
           
 int setPreorderLevel(java.lang.String pId, long pNumber)
          Set an item's preorder level to the specified number.
 int setPreorderLevel(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          set the item's preorder level to pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.
 void setPreorderLevelPropertyName(java.lang.String pPreorderLevelPropertyName)
          Sets property PreorderLevelPropertyName
 int setPreorderThreshold(java.lang.String pId, long pNumber)
          Set an item's preorder level threshold.
 int setPreorderThreshold(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          Set an item's preorder level threshold.
 void setPreorderThresholdPropertyName(java.lang.String pPreorderThresholdPropertyName)
          Sets property PreorderThresholdPropertyName
 void setRepository(MutableRepository pRepository)
          Sets property Repository
 void setSkuLinkItemPropertyName(java.lang.String pSkuLinkItemPropertyName)
           
 void setSkuLinkQuantityPropertyName(java.lang.String pSkuLinkQuantityPropertyName)
           
 int setStockLevel(java.lang.String pId, long pNumber)
          Set an item's stock level to the specified number.
 int setStockLevel(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          set the item's stock level to pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.
 void setStockLevelPropertyName(java.lang.String pStockLevelPropertyName)
          Sets property StockLevelPropertyName
 int setStockThreshold(java.lang.String pId, long pNumber)
          Set an item's stock level threshold.
 int setStockThreshold(java.lang.String pId, long pNumber, java.lang.String pLocationId)
          Set an item's stock level threshold.
 void setStockThresholdPropertyName(java.lang.String pStockThresholdPropertyName)
          Sets property StockThresholdPropertyName
 void setUpdateInventoryPort(java.lang.String pUpdateInventoryPort)
           
protected  void thresholdHasBeenReached(java.lang.String pId, java.lang.String pLevelPropertyName, java.lang.String pThresholdPropertyName, long pCurrentValue, long pThreshold)
          This gets called when some level sinks below the threshold.
protected  void thresholdHasBeenReached(java.lang.String pId, java.lang.String pLocationId, java.lang.String pLevelPropertyName, java.lang.String pThresholdPropertyName, long pCurrentValue, long pThreshold)
          This gets called when some level sinks below the threshold.
protected  void unlock(java.lang.String pItemId)
          Release the lock for the given id.
protected  void unlock(java.lang.String pItemId, java.lang.String pLocationId)
           
protected  void updateItem(MutableRepositoryItem pItem)
          Update the item in the inventory
 
Methods inherited from class atg.commerce.messaging.SourceSinkTemplate
getDelayOnSendRetry, getMessageSourceContext, getMessageSourceName, getTransactionManager, isAllowMessageSending, receiveMessage, sendCommerceMessage, sendObjectMessage, setAllowMessageSending, setDelayOnSendRetry, setMessageSourceContext, setMessageSourceName, setTransactionManager, startMessageSource, stopMessageSource
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
See Also:
Constant Field Values
Constructor Detail

RepositoryInventoryManager

public RepositoryInventoryManager()
Method Detail

setStockLevelPropertyName

public void setStockLevelPropertyName(java.lang.String pStockLevelPropertyName)
Sets property StockLevelPropertyName


getStockLevelPropertyName

public java.lang.String getStockLevelPropertyName()
Returns property StockLevelPropertyName


setBackorderLevelPropertyName

public void setBackorderLevelPropertyName(java.lang.String pBackorderLevelPropertyName)
Sets property BackorderLevelPropertyName


getBackorderLevelPropertyName

public java.lang.String getBackorderLevelPropertyName()
Returns property BackorderLevelPropertyName


setPreorderLevelPropertyName

public void setPreorderLevelPropertyName(java.lang.String pPreorderLevelPropertyName)
Sets property PreorderLevelPropertyName


getPreorderLevelPropertyName

public java.lang.String getPreorderLevelPropertyName()
Returns property PreorderLevelPropertyName


setStockThresholdPropertyName

public void setStockThresholdPropertyName(java.lang.String pStockThresholdPropertyName)
Sets property StockThresholdPropertyName


getStockThresholdPropertyName

public java.lang.String getStockThresholdPropertyName()
Returns property StockThresholdPropertyName


setBackorderThresholdPropertyName

public void setBackorderThresholdPropertyName(java.lang.String pBackorderThresholdPropertyName)
Sets property BackorderThresholdPropertyName


getBackorderThresholdPropertyName

public java.lang.String getBackorderThresholdPropertyName()
Returns property BackorderThresholdPropertyName


setPreorderThresholdPropertyName

public void setPreorderThresholdPropertyName(java.lang.String pPreorderThresholdPropertyName)
Sets property PreorderThresholdPropertyName


getPreorderThresholdPropertyName

public java.lang.String getPreorderThresholdPropertyName()
Returns property PreorderThresholdPropertyName


setAvailabilityStatusPropertyName

public void setAvailabilityStatusPropertyName(java.lang.String pAvailabilityStatusPropertyName)
Sets property AvailabilityStatusPropertyName


getAvailabilityStatusPropertyName

public java.lang.String getAvailabilityStatusPropertyName()
Returns property AvailabilityStatusPropertyName


setAvailabilityDatePropertyName

public void setAvailabilityDatePropertyName(java.lang.String pAvailabilityDatePropertyName)
Sets property AvailabilityDatePropertyName


getAvailabilityDatePropertyName

public java.lang.String getAvailabilityDatePropertyName()
Returns property AvailabilityDatePropertyName


setATPInformationPropertyName

public void setATPInformationPropertyName(java.lang.String pATPInformationPropertyName)
Sets property ATPInformationPropertyName


getATPInformationPropertyName

public java.lang.String getATPInformationPropertyName()
Returns property ATPInformationPropertyName


setATPDatePropertyName

public void setATPDatePropertyName(java.lang.String pATPDatePropertyName)
Sets property ATPDatePropertyName


getATPDatePropertyName

public java.lang.String getATPDatePropertyName()
Returns property ATPDatePropertyName


setATPQuantityPropertyName

public void setATPQuantityPropertyName(java.lang.String pATPQuantityPropertyName)
Sets property ATPQuantityPropertyName


getATPQuantityPropertyName

public java.lang.String getATPQuantityPropertyName()
Returns property ATPQuantityPropertyName


setCatalogRefIdPropertyName

public void setCatalogRefIdPropertyName(java.lang.String pCatalogRefIdPropertyName)
Sets property CatalogRefIdPropertyName


getCatalogRefIdPropertyName

public java.lang.String getCatalogRefIdPropertyName()
Returns property CatalogRefIdPropertyName


setBundleLinksPropertyName

public void setBundleLinksPropertyName(java.lang.String pBundleLinksPropertyName)

getBundleLinksPropertyName

public java.lang.String getBundleLinksPropertyName()
The name of the property bundleLinks


setSkuLinkItemPropertyName

public void setSkuLinkItemPropertyName(java.lang.String pSkuLinkItemPropertyName)

getSkuLinkItemPropertyName

public java.lang.String getSkuLinkItemPropertyName()
the name of the item property in a sku link.


setSkuLinkQuantityPropertyName

public void setSkuLinkQuantityPropertyName(java.lang.String pSkuLinkQuantityPropertyName)

getSkuLinkQuantityPropertyName

public java.lang.String getSkuLinkQuantityPropertyName()
The name of the quantity property in a sku link


setAvailabilityStatusDerivedValue

public void setAvailabilityStatusDerivedValue(int pAvailabilityStatusDerivedValue)

getAvailabilityStatusDerivedValue

public int getAvailabilityStatusDerivedValue()
The integer value for the availabilityStatus of DERIVED


setAvailabilityStatusInStockValue

public void setAvailabilityStatusInStockValue(int pAvailabilityStatusInStockValue)

getAvailabilityStatusInStockValue

public int getAvailabilityStatusInStockValue()
The integer value for the availabilityStatus of IN_STOCK


setAvailabilityStatusBackorderableValue

public void setAvailabilityStatusBackorderableValue(int pAvailabilityStatusBackorderableValue)

getAvailabilityStatusBackorderableValue

public int getAvailabilityStatusBackorderableValue()
The integer value for the availabilityStatus of BACKORDERABLE


setAvailabilityStatusPreorderableValue

public void setAvailabilityStatusPreorderableValue(int pAvailabilityStatusPreorderableValue)

getAvailabilityStatusPreorderableValue

public int getAvailabilityStatusPreorderableValue()
The integer value for the availabilityStatus of PREORDERABLE


setAvailabilityStatusOutOfStockValue

public void setAvailabilityStatusOutOfStockValue(int pAvailabilityStatusOutOfStockValue)

getAvailabilityStatusOutOfStockValue

public int getAvailabilityStatusOutOfStockValue()
The integer value for the availabilityStatus of OUT_OF_STOCK


setAvailabilityStatusDiscontinuedValue

public void setAvailabilityStatusDiscontinuedValue(int pAvailabilityStatusDiscontinuedValue)

getAvailabilityStatusDiscontinuedValue

public int getAvailabilityStatusDiscontinuedValue()
The integer value for the availabilityStatus of DISCONTINUED


setDefaultStockLevel

public void setDefaultStockLevel(long pDefaultStockLevel)

getDefaultStockLevel

public long getDefaultStockLevel()
The default value if the stock level of an item is not defined


setDefaultBackorderLevel

public void setDefaultBackorderLevel(long pDefaultBackorderLevel)

getDefaultBackorderLevel

public long getDefaultBackorderLevel()
The default value if the backorder level of an item is not defined


setDefaultPreorderLevel

public void setDefaultPreorderLevel(long pDefaultPreorderLevel)

getDefaultPreorderLevel

public long getDefaultPreorderLevel()
The default value if the preorder level of an item is not defined


setMessageIdGenerator

public void setMessageIdGenerator(IdGenerator pMessageIdGenerator)

getMessageIdGenerator

public IdGenerator getMessageIdGenerator()
The service that generates Ids for all messages.


setMessageIdSpaceName

public void setMessageIdSpaceName(java.lang.String pMessageIdSpaceName)

getMessageIdSpaceName

public java.lang.String getMessageIdSpaceName()
The name of the idspace to get our message ids from


setRepository

public void setRepository(MutableRepository pRepository)
Sets property Repository


getRepository

public MutableRepository getRepository()
Returns property Repository


setItemType

public void setItemType(java.lang.String pItemType)
Sets property ItemType


getItemType

public java.lang.String getItemType()
Returns property ItemType


setCatalogRefIdMatchQuery

public void setCatalogRefIdMatchQuery(RqlStatement pCatalogRefIdMatchQuery)
Sets property CatalogRefIdMatchQuery


getCatalogRefIdMatchQuery

public RqlStatement getCatalogRefIdMatchQuery()
Returns property CatalogRefIdMatchQuery


setLocationCatalogRefIdMatchQuery

public void setLocationCatalogRefIdMatchQuery(RqlStatement pLocationCatalogRefIdMatchQuery)
Sets property CatalogRefIdMatchQuery


getLocationCatalogRefIdMatchQuery

public RqlStatement getLocationCatalogRefIdMatchQuery()
Returns property CatalogRefIdMatchQuery


setCatalogRefRepository

public void setCatalogRefRepository(Repository pCatalogRefRepository)
Sets property CatalogRefRepository


getCatalogRefRepository

public Repository getCatalogRefRepository()
Returns property CatalogRefRepository


setCatalogRefItemType

public void setCatalogRefItemType(java.lang.String pCatalogRefItemType)
Sets property CatalogRefItemType


getCatalogRefItemType

public java.lang.String getCatalogRefItemType()
Returns property CatalogRefItemType


setClientLockManager

public void setClientLockManager(ClientLockManager pClientLockManager)
Deprecated. locks are no longer used


getClientLockManager

public ClientLockManager getClientLockManager()
Deprecated. locks are no longer used


setUpdateInventoryPort

public void setUpdateInventoryPort(java.lang.String pUpdateInventoryPort)

getUpdateInventoryPort

public java.lang.String getUpdateInventoryPort()
The port to which all UpdateInventory messages are sent.


setInventoryEventPort

public void setInventoryEventPort(java.lang.String pInventoryEventPort)

getInventoryEventPort

public java.lang.String getInventoryEventPort()
The port to which all inventory scenario events are sent.


getCatalogRefItem

protected RepositoryItem getCatalogRefItem(java.lang.String pId)
                                    throws RepositoryException
Return the RepositoryItem which represents the catalog ref (aka SKU)

Throws:
RepositoryException - if there was a problem accessing the item

setMaximumRetriesPerRowLock

public void setMaximumRetriesPerRowLock(int pMaximumRetriesPerRowLock)

getMaximumRetriesPerRowLock

public int getMaximumRetriesPerRowLock()

setMillisecondDelayBeforeLockRetry

public void setMillisecondDelayBeforeLockRetry(int pMillisecondDelayBeforeLockRetry)

getMillisecondDelayBeforeLockRetry

public int getMillisecondDelayBeforeLockRetry()

setInventoryRowLockProperty

public void setInventoryRowLockProperty(java.lang.String pInventoryRowLockProperty)

getInventoryRowLockProperty

public java.lang.String getInventoryRowLockProperty()
The name of the property of inventory that is used to grab a row lock


setInventoryRowLockSQL

public void setInventoryRowLockSQL(java.lang.String pInventoryRowLockSQL)

getInventoryRowLockSQL

public java.lang.String getInventoryRowLockSQL()
The sql command that is used to grab the row lock


setLocationInventoryRowLockSQL

public void setLocationInventoryRowLockSQL(java.lang.String pLocationInventoryRowLockSQL)

getLocationInventoryRowLockSQL

public java.lang.String getLocationInventoryRowLockSQL()
The sql command that is used to grab the row lock for a non-null inventory location.


getInventoryItemForUpdate

protected MutableRepositoryItem getInventoryItemForUpdate(java.lang.String pId)
                                                   throws RepositoryException
Return the MutableRepositoryItem which represents the inventory information

Throws:
RepositoryException - if there was a problem accessing the item

getInventoryItemForUpdate

protected MutableRepositoryItem getInventoryItemForUpdate(java.lang.String pId,
                                                          java.lang.String pLocationId)
                                                   throws RepositoryException
Return the MutableRepositoryItem which represents the inventory information

Throws:
RepositoryException - if there was a problem accessing the item

getInventoryItem

protected RepositoryItem getInventoryItem(java.lang.String pId)
                                   throws RepositoryException
Return the RepositoryItem which represents the inventory information

Returns:
The RepositoryItem
Throws:
RepositoryException - if there was a problem accessing the item

getInventoryItem

protected RepositoryItem getInventoryItem(java.lang.String pId,
                                          java.lang.String pLocationId)
                                   throws RepositoryException
Return the RepositoryItem which represents the inventory information

Returns:
The RepositoryItem
Throws:
RepositoryException - if there was a problem accessing the item

setInventoryName

public void setInventoryName(java.lang.String pInventoryName)

getInventoryName

public java.lang.String getInventoryName()
A displayable name for this inventory manager.

Specified by:
getInventoryName in interface InventoryManager

purchase

public int purchase(java.lang.String pId,
                    long pHowMany,
                    java.lang.String pLocationId)
             throws InventoryException
Check the availability status (queryAvailabilityStatus). If it is not IN_STOCK, return INVENTORY_STATUS_FAIL. If it is in stock, but there is less than pHowMany, return INVENTORY_STATUS_INSUFFICIENT_SUPPLY. Decrement the stockLevel by the amount allocated. If the item passed in is a bundle purchaseBundle is called.

Specified by:
purchase in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU being purchased.
pLocation - the location id of where the SKU is being purchased from.
pHowMany - The amount of the SKU being purchased.
Returns:
INVENTORY_STATUS_ITEM_NOT_FOUND if the SKU isn't found.
Throws:
InventoryException
See Also:
queryAvailabilityStatus(java.lang.String, java.lang.String), purchaseBundle(java.lang.String, long)

purchaseOffBackorder

public int purchaseOffBackorder(java.lang.String pId,
                                long pHowMany,
                                java.lang.String pLocationId)
                         throws InventoryException
Check the availability status (queryAvailabilityStatus). If it is not IN_STOCK, return INVENTORY_STATUS_FAIL. If it is in stock, but there is less than pHowMany, return INVENTORY_STATUS_INSUFFICIENT_SUPPLY. Decrement the stockLevel by the amount allocated and increment the backorderLevel by the same. If the item is a bundle purchaseBundleOffBackorder is called.

Specified by:
purchaseOffBackorder in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU being purchased.
pLocationId - The location of the SKU being purchased.
pHowMany - The amount of the SKU being purchased.
Returns:
INVENTORY_STATUS_ITEM_NOT_FOUND if the SKU isn't found.
Throws:
InventoryException
See Also:
queryAvailabilityStatus(java.lang.String, java.lang.String), purchaseBundleOffBackorder(java.lang.String, long)

purchaseOffPreorder

public int purchaseOffPreorder(java.lang.String pId,
                               long pHowMany,
                               java.lang.String pLocationId)
                        throws InventoryException
Check the availability status (queryAvailabilityStatus). If it is not IN_STOCK, return INVENTORY_STATUS_FAIL. If it is in stock, but there is less than pHowMany, return INVENTORY_STATUS_INSUFFICIENT_SUPPLY. Decrement the stockLevel by the amount allocated and increment the preorderLevel by the same. If the item is a bundle purchaseBundleOffPreorder is called.

Specified by:
purchaseOffPreorder in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU being purchased.
pLocationId - the location where the SKU is being purchased from.
pHowMany - The amount of the SKU being purchased.
Returns:
INVENTORY_STATUS_ITEM_NOT_FOUND if the SKU isn't found.
Throws:
InventoryException
See Also:
queryAvailabilityStatus(java.lang.String, java.lang.String), purchaseBundleOffPreorder(java.lang.String, long)

preorder

public int preorder(java.lang.String pId,
                    long pHowMany,
                    java.lang.String pLocationId)
             throws InventoryException
decrement the item's preorder count, If the item is a bundle preorderBundle is called.

Specified by:
preorder in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU being preordered.
pLocationId - the location of the SKU being preordered.
pHowMany - The amount of the SKU being preordered.
Returns:
INVENTORY_STATUS_ITEM_NOT_FOUND if the SKU doesn't correspond to any item
Throws:
InventoryException
See Also:
preorderBundle(java.lang.String, long)

backorder

public int backorder(java.lang.String pId,
                     long pHowMany,
                     java.lang.String pLocationId)
              throws InventoryException
decrement the item's backorder count, If the item is a bundle backorderBundle is called.

Specified by:
backorder in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU being backordered.
pLocationId - the location of the sku being backordered.
pHowMany - The amount of the SKU being backordered..
Returns:
INVENTORY_STATUS_ITEM_NOT_FOUND if the SKU doesn't correspond to any item
Throws:
InventoryException
See Also:
backorderBundle(java.lang.String, long, java.lang.String)

decrementSKULevel

protected int decrementSKULevel(MutableRepositoryItem pItem,
                                long pHowMany,
                                java.lang.String pLevelName,
                                java.lang.String pThresholdName)
                         throws InventoryException
Decrement the given level by the given amount. Does no checks on the availabilityStatus of the item in the repository. If the given threshold is reached, then thresholdHasBeenReached will be called. This method assumes the item is not a bundle.

Parameters:
pItem - The id of the SKU being changed.
pHowMany - The amount the level should be decreased by.
pLevelName - The name of the level that should be decreased. (one of stockLevel, backorderLevel, preorderLevel)
pThresholdName - The name of the threshold associated with pLevelName
Returns:
INVENTORY_STATUS_ITEM_NOT_FOUND if the SKU doesn't correspond to any item
Throws:
InventoryException
See Also:
thresholdHasBeenReached(java.lang.String, java.lang.String, java.lang.String, long, long)

decrementSKULevel

protected int decrementSKULevel(MutableRepositoryItem pItem,
                                java.lang.String pLocationId,
                                long pHowMany,
                                java.lang.String pLevelName,
                                java.lang.String pThresholdName)
                         throws InventoryException
Throws:
InventoryException

setStockLevel

public int setStockLevel(java.lang.String pId,
                         long pNumber,
                         java.lang.String pLocationId)
                  throws InventoryException
set the item's stock level to pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.

Specified by:
setStockLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose stockLevel is being set
pNumber - The amount to set the stockLevel to.
pLocationId - the location where the SKU's stock level is being set.
Returns:
INVENTORY_STATUS_SUCCEED if the item's stock level was set successfully.
Throws:
InventoryException

setBackorderLevel

public int setBackorderLevel(java.lang.String pId,
                             long pNumber,
                             java.lang.String pLocationId)
                      throws InventoryException
set the item's backorder level to pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.

Specified by:
setBackorderLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose backorderLevel is being set
pLocationId - the location where the SKU's backorderLevel is being set
pNumber - The amount to set the backorderLevel to.
Returns:
INVENTORY_STATUS_SUCCEED if the item's backorder level was set successfully.
Throws:
InventoryException

setPreorderLevel

public int setPreorderLevel(java.lang.String pId,
                            long pNumber,
                            java.lang.String pLocationId)
                     throws InventoryException
set the item's preorder level to pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.

Specified by:
setPreorderLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose preorderLevel is being set
pLocationId - The location id where the SKU's preorderLevel is being set
pNumber - The amount to set the preorderLevel to.
Returns:
INVENTORY_STATUS_SUCCEED if the item's preorder level was set successfully.
Throws:
InventoryException

increaseStockLevel

public int increaseStockLevel(java.lang.String pId,
                              long pNumber,
                              java.lang.String pLocationId)
                       throws InventoryException
increase the item's stock level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED. If the stock level is not set, there is no effect.

Specified by:
increaseStockLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose stockLevel is being increased.
pLocationId - the Location Id where the SKU's stock level is being increased.
pNumber - The amount to increase the stockLevel to.
Returns:
INVENTORY_STATUS_SUCCEED if the item's stock level was set successfully.
Throws:
InventoryException

decreaseStockLevel

public int decreaseStockLevel(java.lang.String pId,
                              long pNumber,
                              java.lang.String pLocationId)
                       throws InventoryException
decrease the item's stock level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED. This method is to be used for inventory adjustments, not for purchases. For purchases, use the purchase(String pId, long pHowMany) method.

Specified by:
decreaseStockLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose stockLevel is being decreased.
pNumber - The amount to decrease the stockLevel to.
pLocationId - the Location Id where the SKU's stock level is being decreased.
Returns:
INVENTORY_STATUS_SUCCEED if the item's stock level was set successfully.
Throws:
InventoryException

increaseBackorderLevel

public int increaseBackorderLevel(java.lang.String pId,
                                  long pNumber,
                                  java.lang.String pLocationId)
                           throws InventoryException
increase the item's backorder level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED. If the backorder level is not set, there is no effect.

Specified by:
increaseBackorderLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose backorderLevel is being increased.
pLocationId - the Location Id where the SKU's backorder level is being increased.
pNumber - The amount to increase the backorderLevel to.
Returns:
INVENTORY_STATUS_SUCCEED if the item's backorder level was set successfully.
Throws:
InventoryException

decreaseBackorderLevel

public int decreaseBackorderLevel(java.lang.String pId,
                                  long pNumber,
                                  java.lang.String pLocationId)
                           throws InventoryException
decrease the item's backorder level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.

Specified by:
decreaseBackorderLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose backorderLevel is being decreased.
pLocationId - the Location Id where the SKU's backorderLevel is being decreased.
pNumber - The amount to decrease the backorderLevel to.
Returns:
INVENTORY_STATUS_SUCCEED if the item's backorder level was set successfully.
Throws:
InventoryException

increasePreorderLevel

public int increasePreorderLevel(java.lang.String pId,
                                 long pNumber,
                                 java.lang.String pLocationId)
                          throws InventoryException
increase the item's preorder level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED. If the preorder level is not set, there is no effect.

Specified by:
increasePreorderLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose preorderLevel is being increased.
pLocationId - the Location Id where the SKU's preorderLevel is being increased.
pNumber - The amount to increase the preorderLevel to.
Returns:
INVENTORY_STATUS_SUCCEED if the item's preorder level was set successfully.
Throws:
InventoryException

decreasePreorderLevel

public int decreasePreorderLevel(java.lang.String pId,
                                 long pNumber,
                                 java.lang.String pLocationId)
                          throws InventoryException
decrease the item's preorder level by pNumber, If the item is a bundle, this method does nothing and returns INVENTORY_STATUS_SUCCEED.

Specified by:
decreasePreorderLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose preorderLevel is being decreased.
pLocationId - the Location Id where the SKU's preorderLevel is being decreased.
pNumber - The amount to decrease the preorderLevel to.
Returns:
INVENTORY_STATUS_SUCCEED if the item's preorder level was set successfully.
Throws:
InventoryException

setAvailabilityStatus

public int setAvailabilityStatus(java.lang.String pId,
                                 int pStatus,
                                 java.lang.String pLocationId)
                          throws InventoryException
Set an item's availability status. Does not check if the item is a bundle.

Specified by:
setAvailabilityStatus in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - the id of the item involved
pStatus - the new status (one of AVAILABILITY_STATUS_IN_STOCK, AVAILABILITY_STATUS_BACKORDERABLE, AVAILABILITY_STATUS_PREORDERABLE, AVAILABILITY_STATUS_OUT_OF_STOCK, AVAILABILITY_STATUS_DISCONTINUED, or AVAILABILITY_STATUS_DERIVED)
pLocationId - the Location Id where the SKU's availability status is being set.
Returns:
INVENTORY_STATUS_SUCCEED, INVENTORY_STATUS_ITEM_NOT_FOUND, or INVENTORY_STATUS_FAIL
Throws:
InventoryException

setAvailabilityDate

public int setAvailabilityDate(java.lang.String pId,
                               java.util.Date pDate,
                               java.lang.String pLocationId)
                        throws InventoryException
Set an item's availability date. Does nothing if the item is a bundle.

Specified by:
setAvailabilityDate in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - the id of the item involved
pLocationId - the location of the item involved.
pDate - The new availability date for the item.
Returns:
INVENTORY_STATUS_SUCCEED, INVENTORY_STATUS_ITEM_NOT_FOUND, or INVENTORY_STATUS_FAIL
Throws:
InventoryException

queryAvailabilityStatus

public int queryAvailabilityStatus(java.lang.String pId,
                                   java.lang.String pLocationId)
                            throws InventoryException
Returns the availability status of the item. If the status in the repository is DERIVED, then deriveAvailabilityStatus is called, otherwise the value is returned. If the item is a bundle, then deriveBundleAvailabilityStatus

Specified by:
queryAvailabilityStatus in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose status is being queried
pLocationId - the location of the item involved.
Returns:
AVAILABILITY_STATUS_IN_STOCK
Throws:
InventoryException
See Also:
deriveAvailabilityStatus(java.lang.String), deriveBundleAvailabilityStatus(java.lang.String)

queryStockLevel

public long queryStockLevel(java.lang.String pId,
                            java.lang.String pLocationId)
                     throws InventoryException
query the number of items in stock. If the item is a bundle, then queryBundleStockLevel

Specified by:
queryStockLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose stockLevel is returned
pLocationId - the location of the item involved.
Returns:
The stockLevel of the SKU
Throws:
InventoryException
See Also:
queryBundleStockLevel(java.lang.String, java.lang.String)

queryBackorderLevel

public long queryBackorderLevel(java.lang.String pId,
                                java.lang.String pLocationId)
                         throws InventoryException
query the number of items available for backorder. If the item is a bundle, then queryBundleBackorderLevel

Specified by:
queryBackorderLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose backorderLevel is returned
pLocationId - the location of the item involved.
Returns:
The backorderLevel of the SKU
Throws:
InventoryException
See Also:
queryBundleBackorderLevel(java.lang.String)

queryPreorderLevel

public long queryPreorderLevel(java.lang.String pId,
                               java.lang.String pLocationId)
                        throws InventoryException
query the number of items in available in preorder. If the item is a bundle, then queryBundlePreorderLevel

Specified by:
queryPreorderLevel in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose preorderLevel is returned
pLocationId - the location of the item involved.
Returns:
The preorderLevel of the SKU
Throws:
InventoryException
See Also:
queryBundlePreorderLevel(java.lang.String, java.lang.String)

queryAvailabilityDate

public java.util.Date queryAvailabilityDate(java.lang.String pId,
                                            java.lang.String pLocationId)
                                     throws InventoryException
query the availability date of an item. If the item is a bundle then queryBundleAvailabilityDate

Specified by:
queryAvailabilityDate in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - The id of the SKU whose availabilityDate is returned
pLocationId - the location of the item involved.
Returns:
The availabilityDate of the SKU
Throws:
InventoryException
See Also:
queryBundleAvailabilityDate(java.lang.String, java.lang.String)

inventoryWasUpdated

public int inventoryWasUpdated(java.util.List pItemIds,
                               java.lang.String pLocationId)
                        throws InventoryException
Send an UpdateInventory message out the UpdateInventoryPort. No changes are made to the inventory.

Specified by:
inventoryWasUpdated in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pItemIds - The items with recently added inventory
pLocationId - the location of the items involved.
Returns:
INVENTORY_STATUS_SUCCESS
Throws:
MissingInventoryItemException - if a given id does not exist.
InventoryException
See Also:
JMSException

setStockThreshold

public int setStockThreshold(java.lang.String pId,
                             long pNumber,
                             java.lang.String pLocationId)
                      throws InventoryException
Set an item's stock level threshold.

Specified by:
setStockThreshold in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - the id of the SKU involved
pNumber - the number to set the threshold to
Returns:
INVENTORY_STATUS_SUCCEED if the item's stock threshold was set successfully.
Throws:
InventoryException

setBackorderThreshold

public int setBackorderThreshold(java.lang.String pId,
                                 long pNumber,
                                 java.lang.String pLocationId)
                          throws InventoryException
Set an item's backorder level threshold.

Specified by:
setBackorderThreshold in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - the id of the SKU involved
pNumber - the number to set the threshold to
pLocationId - the location of the item involved
Returns:
INVENTORY_STATUS_SUCCEED if the item's stock threshold was set successfully.
Throws:
InventoryException

setPreorderThreshold

public int setPreorderThreshold(java.lang.String pId,
                                long pNumber,
                                java.lang.String pLocationId)
                         throws InventoryException
Set an item's preorder level threshold.

Specified by:
setPreorderThreshold in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - the id of the SKU involved
pNumber - the number to set the threshold to
pLocationId - the location of the item involved.
Returns:
INVENTORY_STATUS_SUCCEED if the item's stock threshold was set successfully.
Throws:
InventoryException

queryStockThreshold

public long queryStockThreshold(java.lang.String pId,
                                java.lang.String pLocationId)
                         throws InventoryException
Return the threshold associated with stockLevel.

Specified by:
queryStockThreshold in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - the id of the SKU involved
pLocationId - the location of the item involved.
Returns:
The value of the threshold
Throws:
InventoryException

queryBackorderThreshold

public long queryBackorderThreshold(java.lang.String pId,
                                    java.lang.String pLocationId)
                             throws InventoryException
Return the threshold associated with backorderLevel

Specified by:
queryBackorderThreshold in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - the id of the SKU involved
pLocationId - the location of the item involved.
Returns:
The value of the threshold
Throws:
InventoryException

queryPreorderThreshold

public long queryPreorderThreshold(java.lang.String pId,
                                   java.lang.String pLocationId)
                            throws InventoryException
Return the threshold associated with preorderLevel

Specified by:
queryPreorderThreshold in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pId - the id of the SKU involved
pLocationId - the location of the item involved.
Returns:
The value of the threshold
Throws:
InventoryException

thresholdHasBeenReached

protected void thresholdHasBeenReached(java.lang.String pId,
                                       java.lang.String pLevelPropertyName,
                                       java.lang.String pThresholdPropertyName,
                                       long pCurrentValue,
                                       long pThreshold)
                                throws InventoryException
This gets called when some level sinks below the threshold. It creates an InventoryThresholdReached object and sends it over the inventory event port

Parameters:
pId - The id of the SKU at a critical inventory level.
pLevelPropertyName - The name of the property that is at a critical level
pThresholdPropertyName - The name of the threshold that has been reached.
pCurrentValue - The current value of pLevelPropertyName
pThreshold - The vale of pThresholdPropertyName
Throws:
InventoryException
See Also:
InventoryThresholdReached, getInventoryEventPort()

thresholdHasBeenReached

protected void thresholdHasBeenReached(java.lang.String pId,
                                       java.lang.String pLocationId,
                                       java.lang.String pLevelPropertyName,
                                       java.lang.String pThresholdPropertyName,
                                       long pCurrentValue,
                                       long pThreshold)
                                throws InventoryException
This gets called when some level sinks below the threshold. It creates an InventoryThresholdReached object and sends it over the inventory event port

Parameters:
pId - The id of the SKU at a critical inventory level.
pLocationId - The id of the location for this inventory.
pLevelPropertyName - The name of the property that is at a critical level
pThresholdPropertyName - The name of the threshold that has been reached.
pCurrentValue - The current value of pLevelPropertyName
pThreshold - The vale of pThresholdPropertyName
Throws:
InventoryException
See Also:
InventoryThresholdReached, getInventoryEventPort()

deriveAvailabilityStatus

protected int deriveAvailabilityStatus(java.lang.String pId)
                                throws InventoryException
Derive the availabilityStatus based on the properties of the item Always derives the status, does not check the current value of availabilityStatus. Uses these rules: (a negative level indicates infinite supply) if(stockLevel != 0) return IN_STOCK; else if(backorderLevel != 0) return BACKORDERABLE; else if(preorderLevel != 0) return PREORDERABLE; else return OUT_OF_STOCK;

Parameters:
pId - The sku we are deriving the status for
Returns:
The derived status
Throws:
InventoryException

deriveAvailabilityStatus

protected int deriveAvailabilityStatus(java.lang.String pId,
                                       java.lang.String pLocationId)
                                throws InventoryException
Derive the availabilityStatus based on the properties of the item Always derives the status, does not check the current value of availabilityStatus. Uses these rules: (a negative level indicates infinite supply) if(stockLevel != 0) return IN_STOCK; else if(backorderLevel != 0) return BACKORDERABLE; else if(preorderLevel != 0) return PREORDERABLE; else return OUT_OF_STOCK;

Parameters:
pId - The sku we are deriving the status for
pLocationId - The location of the inventory we are deriving the status for
Returns:
The derived status
Throws:
InventoryException

getNextMessageId

public java.lang.String getNextMessageId()
                                  throws InventoryException
Returns the next unique Id for commerce messages.

Throws:
InventoryException

updateItem

protected void updateItem(MutableRepositoryItem pItem)
                   throws RepositoryException
Update the item in the inventory

Parameters:
pItem - The inventory's RepositoryItem
Throws:
RepositoryException

lock

protected void lock(java.lang.String pItemId)
             throws java.sql.SQLException
To allow multiple instance of Dynamo to simultaneously edit inventory items, we need to make sure the repository item we load is current. To help ensure this, write to the row in the database. The database will give the thread the row lock for the table. Other changes from other machines or Dynamos need to wait until we commit our changes. This method effectively locks the row. If the id does not exist, the lock call automatically works.

Parameters:
pItemId - The catalog ref id whose inventory we want to change
Throws:
java.sql.SQLException
See Also:
getMillisecondDelayBeforeLockRetry(), getMaximumRetriesPerRowLock(), getInventoryRowLockProperty(), getInventoryRowLockSQL()

lock

protected void lock(java.lang.String pItemId,
                    java.lang.String pLocationId)
             throws java.sql.SQLException
To allow multiple instance of Dynamo to simultaneously edit inventory items, we need to make sure the repository item we load is current. To help ensure this, write to the row in the database. The database will give the thread the row lock for the table. Other changes from other machines or Dynamos need to wait until we commit our changes. This method effectively locks the row. If the id does not exist, the lock call automatically works.

Parameters:
pItemId - The catalog ref id whose inventory we want to change
pLocationId - the LocationId of the inventory we want to change
Throws:
java.sql.SQLException
See Also:
getMillisecondDelayBeforeLockRetry(), getMaximumRetriesPerRowLock(), getInventoryRowLockProperty(), getInventoryRowLockSQL()

unlock

protected void unlock(java.lang.String pItemId)
               throws java.sql.SQLException
Release the lock for the given id. In this implementation, unlock does nothing since we are relying on the database row locks. They will be released when the transaction ends.

Throws:
java.sql.SQLException

unlock

protected void unlock(java.lang.String pItemId,
                      java.lang.String pLocationId)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

acquireInventoryLocks

public void acquireInventoryLocks(java.util.List pItemIds,
                                  java.lang.String pLocationId)
                           throws InventoryException
For each item in the list, call lock The locks are acquired in sorted order. Any locks for ids contained within a bundle are also acquired in the correct order. If one of the ids does not exist, it is ignored.

Specified by:
acquireInventoryLocks in interface atg.commerce.inventory.LocationInventoryManager
Parameters:
pItemIds - The list of catalog ref ids
Throws:
InventoryException

releaseInventoryLocks

public void releaseInventoryLocks(java.util.List pItemIds,
                                  java.lang.String pLocationId)
                           throws InventoryException
Release locks for the inventory items that apply to the given ids. This implementation does nothing since we are relying on the database row locks, which are released when the transaction ends.

Specified by:
releaseInventoryLocks in interface atg.commerce.inventory.LocationInventoryManager
Throws:
InventoryException

getBundledIds

public java.util.List getBundledIds(java.lang.String pBundleId)
                             throws InventoryException
Return the list of catalog ref ids contained in the bundle.

Throws:
InventoryException

getBundleLinks

protected java.util.List getBundleLinks(java.lang.String pId)
                                 throws InventoryException
Return the List of bundle links for the given id.

Parameters:
pId - The id of the sku in question
Returns:
A list of bundle links.
Throws:
InventoryException

getBundleLinks

protected java.util.List getBundleLinks(RepositoryItem pBundle)
                                 throws InventoryException
Return the List of bundle links for the given id.

Parameters:
pBundle - The sku.
Returns:
A list of bundle links.
Throws:
InventoryException

isBundle

protected boolean isBundle(java.lang.String pId)
                    throws InventoryException
Checks to see if the given id refers to a bundle. If bundles should be treated just like all other items This method should be overwritten to return false. The criteria for determining if a sku is a bundle, is if the sku has a nonempty bundleLinks list.

Parameters:
pId - The id of the sku in question
Returns:
true if the item is a bundle, false otherwise
Throws:
InventoryException

deriveBundleAvailabilityStatus

protected int deriveBundleAvailabilityStatus(java.lang.String pBundleId)
                                      throws InventoryException
Derives the availability status for a bundle. Assumes the given sku represents a bundle. for each item queryAvailabilityStatus(item) if any items are AVAILABILITY_STATUS_OUT_OF_STOCK return AVAILABILITY_STATUS_OUT_OF_STOCK else if any are AVAILABILITY_STATUS_PREORDERABLE return AVAILABILITY_STATUS_PREORDERABLE else if any are AVAILABILITY_STATUS_BACKORDERABLE return AVAILABILITY_STATUS_BACKORDERABLE else return AVAILABILITY_STATUS_IN_STOCK

Parameters:
pId - the id of the bundle
Returns:
the availability status according to the above rules.
Throws:
InventoryException

deriveBundleAvailabilityStatus

protected int deriveBundleAvailabilityStatus(java.lang.String pBundleId,
                                             java.lang.String pLocationId)
                                      throws InventoryException
Derives the availability status for a bundle. Assumes the given sku represents a bundle. for each item queryAvailabilityStatus(item) if any items are AVAILABILITY_STATUS_OUT_OF_STOCK return AVAILABILITY_STATUS_OUT_OF_STOCK else if any are AVAILABILITY_STATUS_PREORDERABLE return AVAILABILITY_STATUS_PREORDERABLE else if any are AVAILABILITY_STATUS_BACKORDERABLE return AVAILABILITY_STATUS_BACKORDERABLE else return AVAILABILITY_STATUS_IN_STOCK

Parameters:
pId - the id of the bundle
pLocationId - the location id of the bundle
Returns:
the availability status according to the above rules.
Throws:
InventoryException

purchaseBundle

protected int purchaseBundle(java.lang.String pBundleId,
                             long pHowMany)
                      throws InventoryException
Purchases a bundle by purchase each of its bundle items. foreach item queryAvailabilityStatus(bundle) if AVAILABILITY_STATUS_IN_STOCK for each item purchase(item, itemQuantity) if purchase returns INVENTORY_STATUS_INSUFFICIENT_SUPPLY for each item already purchased increaseStockLevel return INVENTORY_STATUS_INSUFFICIENT_SUPPLY if purchase returns INVENTORY_STATUS_FAILED for each item already purchased increaseStockLevel return INVENTORY_STATUS_FAILED return INVENTORY_STATUS_SUCCEED else return INVENTORY_STATUS_FAILED

Parameters:
pBundleId - The id of the bundle
pHowMany - the quantity of the bundle to purchase
Returns:
The success flag of this operation.
Throws:
InventoryException

purchaseBundle

protected int purchaseBundle(java.lang.String pBundleId,
                             long pHowMany,
                             java.lang.String pLocationId)
                      throws InventoryException
Purchases a bundle by purchase each of its bundle items. foreach item queryAvailabilityStatus(bundle) if AVAILABILITY_STATUS_IN_STOCK for each item purchase(item, itemQuantity) if purchase returns INVENTORY_STATUS_INSUFFICIENT_SUPPLY for each item already purchased increaseStockLevel return INVENTORY_STATUS_INSUFFICIENT_SUPPLY if purchase returns INVENTORY_STATUS_FAILED for each item already purchased increaseStockLevel return INVENTORY_STATUS_FAILED return INVENTORY_STATUS_SUCCEED else return INVENTORY_STATUS_FAILED

Parameters:
pBundleId - The id of the bundle
pHowMany - the quantity of the bundle to purchase
pLocationId - the location of the bundle
Returns:
The success flag of this operation.
Throws:
InventoryException

backorderBundle

protected int backorderBundle(java.lang.String pBundleId,
                              long pHowMany,
                              java.lang.String pLocationId)
                       throws InventoryException
Backorders a bundle. Does the following for the bundle: foreach item backorder(item, itemQuantity) if backorder returns INVENTORY_STATUS_INSUFFICIENT_SUPPLY for each item already backordered increaseBackorderLevel return INVENTORY_STATUS_INSUFFICIENT_SUPPLY if backorder returns INVENTORY_STATUS_FAILED for each item already backordered increaseBackorderLevel return INVENTORY_STATUS_FAILED return INVENTORY_STATUS_SUCCEED else return INVENTORY_STATUS_FAILED

Parameters:
pBundleId - The id of the bundle we are backordering
pHowMany - the quantity of the bundle to backorder
Returns:
a success flag
Throws:
InventoryException

preorderBundle

protected int preorderBundle(java.lang.String pBundleId,
                             long pHowMany)
                      throws InventoryException
Preorders a bundle. Does the following for the bundle: foreach item preorder(item, itemQuantity) if preorder returns INVENTORY_STATUS_INSUFFICIENT_SUPPLY for each item already preordered increasePreorderLevel return INVENTORY_STATUS_INSUFFICIENT_SUPPLY if preorder returns INVENTORY_STATUS_FAILED for each item already preordered increasePreorderLevel return INVENTORY_STATUS_FAILED return INVENTORY_STATUS_SUCCEED else return INVENTORY_STATUS_FAILED

Parameters:
pBundleId - The id of the bundle we are backordering
pHowMany - the quantity of the bundle to backorder
Returns:
a success flag
Throws:
InventoryException

preorderBundle

protected int preorderBundle(java.lang.String pBundleId,
                             long pHowMany,
                             java.lang.String pLocationId)
                      throws InventoryException
Throws:
InventoryException

purchaseBundleOffPreorder

protected int purchaseBundleOffPreorder(java.lang.String pBundleId,
                                        long pHowMany)
                                 throws InventoryException
Purchases the bundle and increments the preorderLevel of each item in the bundle.

Parameters:
pBundleId - The id of the bundle
pHowMany - the quantity of the bundle to purchase
Returns:
The success flag of this operation.
Throws:
InventoryException

purchaseBundleOffPreorder

protected int purchaseBundleOffPreorder(java.lang.String pBundleId,
                                        long pHowMany,
                                        java.lang.String pLocationId)
                                 throws InventoryException
Purchases the bundle and increments the preorderLevel of each item in the bundle.

Parameters:
pBundleId - The id of the bundle
pHowMany - the quantity of the bundle to purchase
pLocationId - the location of the bundle
Returns:
The success flag of this operation.
Throws:
InventoryException

purchaseBundleOffBackorder

protected int purchaseBundleOffBackorder(java.lang.String pBundleId,
                                         long pHowMany)
                                  throws InventoryException
Purchases the bundle then increments the backorderLevel of each item in the bundle.

Parameters:
pBundleId - The id of the bundle
pHowMany - the quantity of the bundle to purchase
Returns:
The success flag of this operation.
Throws:
InventoryException

purchaseBundleOffBackorder

protected int purchaseBundleOffBackorder(java.lang.String pBundleId,
                                         long pHowMany,
                                         java.lang.String pLocationId)
                                  throws InventoryException
Purchases the bundle then increments the backorderLevel of each item in the bundle.

Parameters:
pBundleId - The id of the bundle
pHowMany - the quantity of the bundle to purchase
pLocationId - the location id of the bundle
Returns:
The success flag of this operation.
Throws:
InventoryException

queryBundleStockLevel

protected long queryBundleStockLevel(java.lang.String pId,
                                     java.lang.String pLocationId)
                              throws InventoryException
Cycles through the items in a bundle and returns the greatest quantity of bundles that could be allocated given each items stock level. Takes into account the quantity of each item in the bundle. If the bundle calls for 5 of item A and 1 of item B and item A has a stock level of 10 and item B has a stock level of 10. This method will return 2 since that is the number of bundles that those stock levels can support.

Parameters:
pId - The id of the bundle
Returns:
the largest quantity of the bundle that can be allocated
Throws:
InventoryException

queryBundleBackorderLevel

protected long queryBundleBackorderLevel(java.lang.String pId)
                                  throws InventoryException
Cycles through the items in a bundle and returns the greatest quantity of bundles that could be allocated given each items backorder level. Takes into account the quantity of each item in the bundle. If the bundle calls for 5 of item A and 1 of item B and item A has a backorder level of 10 and item B has a backorder level of 10. This method will return 2 since that is the number of bundles that those backorder levels can support.

Parameters:
pId - The id of the bundle
Returns:
the largest quantity of the bundle that can be backordered
Throws:
InventoryException

queryBundleBackorderLevel

protected long queryBundleBackorderLevel(java.lang.String pId,
                                         java.lang.String pLocationId)
                                  throws InventoryException
Cycles through the items in a bundle and returns the greatest quantity of bundles that could be allocated given each items backorder level. Takes into account the quantity of each item in the bundle. If the bundle calls for 5 of item A and 1 of item B and item A has a backorder level of 10 and item B has a backorder level of 10. This method will return 2 since that is the number of bundles that those backorder levels can support.

Parameters:
pId - The id of the bundle
pLocationId - the location id of the bundle
Returns:
the largest quantity of the bundle that can be backordered
Throws:
InventoryException

queryBundlePreorderLevel

protected long queryBundlePreorderLevel(java.lang.String pId,
                                        java.lang.String pLocationId)
                                 throws InventoryException
Cycles through the items in a bundle and returns the greatest quantity of bundles that could be preordered given each items backorder level. Takes into account the quantity of each item in the bundle. If the bundle calls for 5 of item A and 1 of item B and item A has a preorder level of 10 and item B has a preorder level of 10. This method will return 2 since that is the number of bundles that those preorder levels can support.

Parameters:
pId - The id of the bundle
Returns:
the largest quantity of the bundle that can be preordered
Throws:
InventoryException

queryBundleStockThreshold

protected long queryBundleStockThreshold(java.lang.String pId,
                                         java.lang.String pLocationId)
                                  throws InventoryException
Currently all bundles have thresholds of 0. If this behavior should change, override this method.

Parameters:
pId - The id of the bundle
Returns:
0
Throws:
InventoryException

queryBundleBackorderThreshold

protected long queryBundleBackorderThreshold(java.lang.String pId,
                                             java.lang.String pLocationId)
                                      throws InventoryException
Currently all bundles have thresholds of 0. If this behavior should change, override this method.

Parameters:
pId - The id of the bundle
Returns:
0
Throws:
InventoryException

queryBundlePreorderThreshold

protected long queryBundlePreorderThreshold(java.lang.String pId,
                                            java.lang.String pLocationId)
                                     throws InventoryException
Currently all bundles have thresholds of 0. If this behavior should change, override this method.

Parameters:
pId - The id of the bundle
Returns:
0
Throws:
InventoryException

queryBundleAvailabilityDate

public java.util.Date queryBundleAvailabilityDate(java.lang.String pBundleId,
                                                  java.lang.String pLocationId)
                                           throws InventoryException
Cycles through each item in a bundle and calls queryAvailabilityDate on each. This method returns the latest of those dates.

Parameters:
pBundleId - The id of the bundle
Returns:
The availabilityDate of the bundle
Throws:
InventoryException
MissingInventoryItemException
See Also:
queryAvailabilityDate(java.lang.String, java.lang.String)

queryInventoryInformation

public java.util.Collection<InventoryInfo> queryInventoryInformation(java.util.Collection<java.lang.String> pItemIds,
                                                                     java.lang.String pLocationId)
                                                              throws InventoryException
Specified by:
queryInventoryInformation in interface atg.commerce.inventory.LocationInventoryManager
Throws:
InventoryException

queryInventoryInformation

public java.util.Collection<InventoryInfo> queryInventoryInformation(java.lang.String pId,
                                                                     java.util.Collection<java.lang.String> pLocationIds)
                                                              throws InventoryException
Specified by:
queryInventoryInformation in interface atg.commerce.inventory.LocationInventoryManager
Throws:
InventoryException

queryInventoryInformation

public java.util.Collection<InventoryInfo> queryInventoryInformation(java.util.Collection<java.lang.String> pItemIds,
                                                                     java.util.Collection<java.lang.String> pLocationIds)
                                                              throws InventoryException
Specified by:
queryInventoryInformation in interface atg.commerce.inventory.LocationInventoryManager
Throws:
InventoryException

queryInventoryInformation

public InventoryInfo queryInventoryInformation(java.lang.String pId,
                                               java.lang.String pLocationId)
                                        throws InventoryException
Specified by:
queryInventoryInformation in interface atg.commerce.inventory.LocationInventoryManager
Throws:
InventoryException

queryAvailableToPromise

public atg.commerce.inventory.AvailableToPromise queryAvailableToPromise(java.lang.String pId,
                                                                         java.lang.String pLocationId)
                                                                  throws InventoryException
Specified by:
queryAvailableToPromise in interface atg.commerce.inventory.LocationInventoryManager
Throws:
InventoryException

purchase

public int purchase(java.lang.String pId,
                    long pHowMany)
             throws InventoryException
Description copied from interface: InventoryManager
Actually purchases a product. The backend inventory system should register that a purchase has been made.

Specified by:
purchase in interface InventoryManager
Parameters:
pId - the id of the item involved
Returns:
One of the following:
Throws:
InventoryException - if there was a problem during the purchase process.

purchaseOffBackorder

public int purchaseOffBackorder(java.lang.String pId,
                                long pHowMany)
                         throws InventoryException
Description copied from interface: InventoryManager
Actually purchases a product. The backend inventory system should register that a purchase has been made. If the purchase succeeds, the item's backorderLevel is increased appropriately.

Specified by:
purchaseOffBackorder in interface InventoryManager
Parameters:
pId - the id of the item involved
Returns:
One of the following:
Throws:
InventoryException - if there was a problem during the purchase process.

purchaseOffPreorder

public int purchaseOffPreorder(java.lang.String pId,
                               long pHowMany)
                        throws InventoryException
Description copied from interface: InventoryManager
Actually purchases a product. The backend inventory system should register that a purchase has been made. If the purchase succeeds, the item's preorderLevel is increased appropriately.

Specified by:
purchaseOffPreorder in interface InventoryManager
Parameters:
pId - the id of the item involved
Returns:
One of the following:
Throws:
InventoryException - if there was a problem during the purchase process.

preorder

public int preorder(java.lang.String pId,
                    long pHowMany)
             throws InventoryException
Description copied from interface: InventoryManager
Preorder an item. The usual implication of preordering is that the retailer has never had the item in stock, but promises to have the item soon.

Specified by:
preorder in interface InventoryManager
Parameters:
pId - the id of the item involved
Returns:
One of the following:
Throws:
InventoryException - if there was a problem in trying to preorder the item

backorder

public int backorder(java.lang.String pId,
                     long pHowMany)
              throws InventoryException
Description copied from interface: InventoryManager
Backorder an item. The usual implication of this is very similar to preorder, except that the store did at one time have this item, it's just out of it now.

Specified by:
backorder in interface InventoryManager
Parameters:
pId - the id of the item involved
Returns:
One of the following:
Throws:
InventoryException - if there was a problem with the backordering process.

setStockLevel

public int setStockLevel(java.lang.String pId,
                         long pNumber)
                  throws InventoryException
Description copied from interface: InventoryManager
Set an item's stock level to the specified number.

Specified by:
setStockLevel in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of the given item to restock
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

setBackorderLevel

public int setBackorderLevel(java.lang.String pId,
                             long pNumber)
                      throws InventoryException
Description copied from interface: InventoryManager
Set an item's backorder level to the specified number.

Specified by:
setBackorderLevel in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of the given item to restock
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

setPreorderLevel

public int setPreorderLevel(java.lang.String pId,
                            long pNumber)
                     throws InventoryException
Description copied from interface: InventoryManager
Set an item's preorder level to the specified number.

Specified by:
setPreorderLevel in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of the given item to restock
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

increaseStockLevel

public int increaseStockLevel(java.lang.String pId,
                              long pNumber)
                       throws InventoryException
Description copied from interface: InventoryManager
Increase an item's stock level by the specified number.

Specified by:
increaseStockLevel in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of items to add to the current stock level
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

decreaseStockLevel

public int decreaseStockLevel(java.lang.String pId,
                              long pNumber)
                       throws InventoryException
Description copied from interface: InventoryManager
Decrease an item's stock level by the specified amount. This method is to be used for inventory adjustments, not for purchases. For purchases, use the purchase(String pId, long pHowMany) method.

Specified by:
decreaseStockLevel in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of items to decrease from the current stock level
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

increaseBackorderLevel

public int increaseBackorderLevel(java.lang.String pId,
                                  long pNumber)
                           throws InventoryException
Description copied from interface: InventoryManager
Increase an item's backorder level by the specified number.

Specified by:
increaseBackorderLevel in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of items to add to the current stock level
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

decreaseBackorderLevel

public int decreaseBackorderLevel(java.lang.String pId,
                                  long pNumber)
                           throws InventoryException
Description copied from interface: InventoryManager
Decrease an item's backorder level by the specified amount.

Specified by:
decreaseBackorderLevel in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of items to decrease from the current stock level
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

increasePreorderLevel

public int increasePreorderLevel(java.lang.String pId,
                                 long pNumber)
                          throws InventoryException
Description copied from interface: InventoryManager
Increase an item's preorder level by the specified number.

Specified by:
increasePreorderLevel in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of items to add to the current stock level
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

decreasePreorderLevel

public int decreasePreorderLevel(java.lang.String pId,
                                 long pNumber)
                          throws InventoryException
Description copied from interface: InventoryManager
Decrease an item's preorder level by the specified amount.

Specified by:
decreasePreorderLevel in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of items to decrease from the current stock level
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

setStockThreshold

public int setStockThreshold(java.lang.String pId,
                             long pNumber)
                      throws InventoryException
Description copied from interface: InventoryManager
Set an item's stock level threshold.

Specified by:
setStockThreshold in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of the given item to restock
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

setBackorderThreshold

public int setBackorderThreshold(java.lang.String pId,
                                 long pNumber)
                          throws InventoryException
Description copied from interface: InventoryManager
Set an item's backorder level threshold.

Specified by:
setBackorderThreshold in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of the given item to restock
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

setPreorderThreshold

public int setPreorderThreshold(java.lang.String pId,
                                long pNumber)
                         throws InventoryException
Description copied from interface: InventoryManager
Set an item's preorder level threshold.

Specified by:
setPreorderThreshold in interface InventoryManager
Parameters:
pId - the id of the item involved
pNumber - the number of the given item to restock
Returns:
One of the following:
Throws:
InventoryException - if there was a problem trying to restock

setAvailabilityStatus

public int setAvailabilityStatus(java.lang.String pId,
                                 int pStatus)
                          throws InventoryException
Description copied from interface: InventoryManager
Set an item's availability status.

Specified by:
setAvailabilityStatus in interface InventoryManager
Parameters:
pId - the id of the item involved
pStatus - the new status (one of AVAILABILITY_STATUS_IN_STOCK, AVAILABILITY_STATUS_BACKORDERABLE, AVAILABILITY_STATUS_PREORDERABLE, AVAILABILITY_STATUS_OUT_OF_STOCK, AVAILABILITY_STATUS_DISCONTINUED, or AVAILABILITY_STATUS_DERIVED)
Returns:
One of the following:
Throws:
InventoryException

setAvailabilityDate

public int setAvailabilityDate(java.lang.String pId,
                               java.util.Date pDate)
                        throws InventoryException
Description copied from interface: InventoryManager
Set an item's availability date.

Specified by:
setAvailabilityDate in interface InventoryManager
Parameters:
pId - the id of the item involved
pDate - The new availability date for the item.
Returns:
One of the following:
Throws:
InventoryException

queryAvailabilityStatus

public int queryAvailabilityStatus(java.lang.String pId)
                            throws InventoryException
Description copied from interface: InventoryManager
Return the availability status of a given item. If an item has a status of DERIVED, then the return value is calculated. Otherwise the existing status is returned.

Specified by:
queryAvailabilityStatus in interface InventoryManager
Parameters:
pId - The id of the item involved.
Returns:
One of the following states:
Throws:
InventoryException - if there was a problem determining the status of the item

queryStockLevel

public long queryStockLevel(java.lang.String pId)
                     throws InventoryException
Description copied from interface: InventoryManager
Return how many of a given item are in the system.

Specified by:
queryStockLevel in interface InventoryManager
Returns:
how many items, with the given id, are available for purchase
Throws:
InventoryException - if there was a problem determining the number

queryBackorderLevel

public long queryBackorderLevel(java.lang.String pId)
                         throws InventoryException
Description copied from interface: InventoryManager
Return how many of a given item can be backorder.

Specified by:
queryBackorderLevel in interface InventoryManager
Returns:
how many items, with the given id, are available for purchase
Throws:
InventoryException - if there was a problem determining the number

queryPreorderLevel

public long queryPreorderLevel(java.lang.String pId)
                        throws InventoryException
Description copied from interface: InventoryManager
Return how many of a given item can be preorder.

Specified by:
queryPreorderLevel in interface InventoryManager
Returns:
how many items, with the given id, are available for purchase
Throws:
InventoryException - if there was a problem determining the number

queryStockThreshold

public long queryStockThreshold(java.lang.String pId)
                         throws InventoryException
Description copied from interface: InventoryManager
Return the threshold associated with stockLevel.

Specified by:
queryStockThreshold in interface InventoryManager
Returns:
how many items, with the given id, are available for purchase
Throws:
InventoryException - if there was a problem determining the number

queryBackorderThreshold

public long queryBackorderThreshold(java.lang.String pId)
                             throws InventoryException
Description copied from interface: InventoryManager
Return the threshold associated with backorderLevel

Specified by:
queryBackorderThreshold in interface InventoryManager
Returns:
how many items, with the given id, are available for purchase
Throws:
InventoryException - if there was a problem determining the number

queryPreorderThreshold

public long queryPreorderThreshold(java.lang.String pId)
                            throws InventoryException
Description copied from interface: InventoryManager
Return the threshold associated with preorderLevel

Specified by:
queryPreorderThreshold in interface InventoryManager
Returns:
how many items, with the given id, are available for purchase
Throws:
InventoryException - if there was a problem determining the number

queryAvailabilityDate

public java.util.Date queryAvailabilityDate(java.lang.String pId)
                                     throws InventoryException
Description copied from interface: InventoryManager
Return the availability date of an item.

Specified by:
queryAvailabilityDate in interface InventoryManager
Returns:
the date that the item will be available for puchase if the item's availability status is not AVAILABILITY_STATUS_IN_STOCK. If the item's availability status is AVAILABILITY_STATUS_IN_STOCK, then we return null.
Throws:
InventoryException - if there was a problem determining the date

inventoryWasUpdated

public int inventoryWasUpdated(java.util.List pItemIds)
                        throws InventoryException
Description copied from interface: InventoryManager
Informs the inventory manager that the given ids are now available. Some implementations of the InventoryManager may send a message informing other systems that some items that were previously unavailable are now available. No changes are made to the inventory.

Specified by:
inventoryWasUpdated in interface InventoryManager
Parameters:
pItemIds - The items with recently added inventory
Throws:
InventoryException

acquireInventoryLocks

public void acquireInventoryLocks(java.util.List pItemIds)
                           throws InventoryException
Description copied from interface: InventoryManager
Acquires locks for the inventory items that apply to the given ids.

Specified by:
acquireInventoryLocks in interface InventoryManager
Throws:
InventoryException

releaseInventoryLocks

public void releaseInventoryLocks(java.util.List pItemIds)
                           throws InventoryException
Description copied from interface: InventoryManager
Release locks for the inventory items that apply to the given ids.

Specified by:
releaseInventoryLocks in interface InventoryManager
Throws:
InventoryException