com.ibm.commerce.inventory.facade.client

Class InventoryFacadeClient



  • public class InventoryFacadeClient
    extends AbstractInventoryFacadeClient

    This class provides common methods that this and other utility classes to the Inventory facade use. This class also provides a set of convenient Java APIs to represent particular Inventory operations. This set of Java APIs also include APIs for Web-based requests to transform the name-value pair requests into the appropriate request documents.

    • Constructor Detail

      • InventoryFacadeClient

        public InventoryFacadeClient()
        Creates an instance of the client to communicate with the Inventory facade.
      • InventoryFacadeClient

        public InventoryFacadeClient(BusinessContextType businessContext,
                                     javax.security.auth.callback.CallbackHandler callbackHandler)
        Creates an instance of the client to communicate with the Inventory facade.
        Parameters:
        businessContext - The default business context to associate with the messages when making requests.
        callbackHandler - Used for authentication purposes, as the controller provides the authentication information to the transport when required.
    • Method Detail

      • checkInventory

        public java.util.Map checkInventory(java.util.Map parameters)
                                     throws InventoryRequirementException
        Checks the inventory availability of an order in different locations (identified by the storeId or physicalStoreId). This method accepts a map with the following name/value pairs: orderId, storeId, physicalStoreId_n (n is 0, 1, 2 ...).

        Main flow:

        1. For each location (identified by storeId or physicalStoreId):
          1. Composes an InventoryRequirement SDO by calling ComposeOrderCmd with access profile IBM_Inventory.
          2. Updates the physical store ID of order items in the InventoryRequirement SDO.
        2. Calls the component's ProcessInventoryRequirement service with action code CheckInventory.
        3. For each location:
          1. Derives the overall inventory availability of the order/shopping cart by aggregating the inventory availability of order items in the order/shopping cart.
        It will return a list of maps containing the following name/values pairs:
        Parameters:
        parameters - A map that contains name/value pairs of orderId, storeId, physicalStoreId_n.
               orderId, the order ID which inventory availability will be checked.
               storeId, the online store Id.
               physicalStoreId_n, the No. n physical store Id, if only one, just use physicalStoreId.
           
        Returns:
        Returns A map containing the following name-value pairs:
        storeId ID of the online store.
        overallInventoryStatusThe overall (i.e. worst) inventory status of the order/shopping cart in the online store.
        overallAvailabilityDateThe overall (i.e. latest) availability date of the order/shopping cart in the online store.
        inventoryRequirementThe InventoryRequirement SDO corresponding to the online store.
        The map will also contain the following name-object pair:
        physicalStoreInventoryAvailabilityA list containing the inventory availability of the order/shopping cart in each of the physical stores specified
        Each element in the list will be a map containing the following name-value pairs:
        physicalStoreIdID of physical store n.
        overallInventoryStatusThe overall (i.e. worst) inventory status of the order/shopping cart in the physical store.
        overallAvailabilityDateThe overall (i.e. latest) availability date of the order/shopping cart in the physical store.
        inventoryRequirementThe InventoryRequirement SDO corresponding to the physical store.
        If storeId is provided in the input parameter map, the result of it will be always returned as the name-value pairs in the map. Sample code snippet:
                       Map parameters = new HashMap();
              parameters.put("orderId", "10051");
              parameters.put("storeId", "10001");
              parameters.put("physicalStoreId_0", "50001");
              parameters.put("physicalStoreId_1", "50002");
              InventoryFacadeClient ifcClient = new InventoryFacadeClient(yourBusinessContext, yourCallbackHandler);
              Map mapResult = ifcClient.checkInventory(parameters);
         
              mapResult.get("storeId");
              mapResult.get("overallInventoryStatus");
         
                       List physicalStoreResults = (List) (mapResult.get("physicalStoreInventoryAvailability"));
                       for (int i=0; i
         
        Throws:
        InventoryRequirementException
      • getCommerceFoundationFactory

        public CommerceFoundationFactory getCommerceFoundationFactory()
        Gets the commerce foundation factory.
        Returns:
        instance of the commerce foundation factory
      • getOrderFactory

        public OrderFactory getOrderFactory()
        Gets the order factory.
        Returns:
        instance of the order factory
      • getInventoryFactory

        public InventoryFactory getInventoryFactory()
        Gets the inventory factory.
        Returns:
        instance of the inventory factory