com.ibm.commerce.price.commands

Class EnsureOffersExistGetContractUnitPriceCmdImpl

  • java.lang.Object
    • com.ibm.websphere.command.CacheableCommandImpl
      • com.ibm.commerce.command.MeasuredCacheableCommandImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, com.ibm.commerce.command.TaskCommand, GetContractSpecialPriceCmd, GetContractUnitPriceCmd, GetProductContractUnitPriceCmd, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class EnsureOffersExistGetContractUnitPriceCmdImpl
    extends AbstractGetPriceCmdImpl
    EnsureOffersExistGetContractUnitPriceCmdImpl is a price command that can be used to enhance other commands to ensure that offers exist in the returned output. This allows the order component to avoid repeated requests for prices under some circumstances, improving overall system performance. This command implementation cannot be used independently.

    To use this command, register the interface name in the command registry similar to the example below.

    Interface name Command
    com.ibm.commerce.price.commands.GetContractUnitPriceCmd com.ibm.commerce.price.commands.EnsureOffersExistGetContractUnitPriceCmdImpl
    com.ibm.commerce.price.commands.GetProductContractUnitPriceCmd com.ibm.commerce.price.commands.EnsureOffersExistGetContractUnitPriceCmdImpl
    com.ibm.commerce.price.commands.GetContractSpecialPriceCmd com.ibm.commerce.price.commands.EnsureOffersExistGetContractUnitPriceCmdImpl
    com.ibm.commerce.price.commands.GetContractUnitPriceCmd+AfterEnsureOffersExist <Next Implementation of com.ibm.commerce.price.commands.GetContractUnitPriceCmd>
    com.ibm.commerce.price.commands.GetProductContractUnitPriceCmd+AfterEnsureOffersExist <Next Implementation of com.ibm.commerce.price.commands.GetProductContractUnitPriceCmd >
    com.ibm.commerce.price.commands.GetContractSpecialPriceCmd+AfterEnsureOffersExist <Next Implementation of com.ibm.commerce.price.commands.GetContractSpecialPriceCmd>

    Note that this command can be called by other price commands to form a chain.

    This command implementation has the following steps:

    1. Creates all combinations of catalog entries and trading agreements that were requested through the input parameters using PriceInputCase.createPriceCases(GetPriceCmdInput).
    2. Calls the next command in the command registry using AbstractGetPriceCmdImpl.executeNextInChain(GetPriceCmdInput, String) with a suffix of "AfterEnsureOffersExist".
    3. Analyzes the output of the command. For any returned prices that do not have accompanying offer identifiers and OfferAccessBeans, a query will be performed to find any offer for the corresponding catalog entry. If a price could not be found (a price is null), an offer will not be added. This will be done for both single- and batch-style return values.
    • Constructor Detail

      • EnsureOffersExistGetContractUnitPriceCmdImpl

        public EnsureOffersExistGetContractUnitPriceCmdImpl()
    • Method Detail

      • getBestPriceForOfferWithSpecificCurrency

        public MonetaryAmount getBestPriceForOfferWithSpecificCurrency(java.lang.String offerId,
                                                                       java.lang.String currency,
                                                                       java.lang.String storeId)
        Get best price for an offer with specific currency, if the currency is null, will return alternative prices. It returns null if error occurs.
        Parameters:
        offerId - The offerId. If null or empty, will return null.
        currency - The currency. If null or empty, will return null.
        storeId - The storeId. If null or empty, will return null.
        Returns:
        The best price for the offer. It will return null if error occurs, will not return empty string.
      • getOfferByPriceListAndCatentry

        public com.ibm.commerce.order.objects.OfferAccessBean getOfferByPriceListAndCatentry(java.lang.String priceListIdStr,
                                                                                             java.lang.String catentryIdStr,
                                                                                             java.lang.String storeId,
                                                                                             java.lang.String currency,
                                                                                             java.lang.String uom,
                                                                                             java.lang.Double quantity,
                                                                                             java.util.Map runtimeParameters)
                                                                                      throws com.ibm.commerce.exception.ECException
        This method is used to get the offer for a catalog entry in a specific price list. If there is no offer defined in the desired currency, get the best price after currency conversion.
        Parameters:
        priceListIdStr - The price list ID.
        catentryIdStr - The catalog entry ID.
        storeId - The store ID.
        currency - The currency.
        uom - The unit of measurement.
        quantity - The quantity.
        runtimeParameters - The runtime parameters for rule, from which the pricing time can be retrieved.
        Returns:
        The base offer in the specific price list. Return null if there is no valid offer.
        Throws:
        com.ibm.commerce.exception.ECException - If problems happens when retrieving offers from database.
      • isValidOffer

        public boolean isValidOffer(java.lang.Double offerMinQuantity,
                                    java.lang.Double offerMaxQuantity,
                                    java.lang.String offerUOM,
                                    QuantityAmount aQuantity,
                                    java.lang.Long catentryID)
        Filter the valid offer.
        Parameters:
        offerMinQuantity - The minimum quantity. If null or empty, will return false.
        offerMaxQuantity - The maximum quantity. If null or empty, will return false.
        offerUOM - The UOM. If null or empty, will return false.
        aQuantity - The quantity. If null or empty, will return false.
        catentryID - The catalog entry id. This parameter can't be null or empty.
        Returns:
        True if the offer is valid.
      • performExecute

        public void performExecute()
                            throws com.ibm.commerce.exception.ECException
        Performs the steps described in the class description.
        Specified by:
        performExecute in interface com.ibm.commerce.command.ECCommand
        Overrides:
        performExecute in class com.ibm.commerce.command.AbstractECTargetableCommand
        Throws:
        com.ibm.commerce.exception.ECException - If an error occurs while executing the next price command in the chain, or while finding an appropriate missing offer. This error will not be thrown if AbstractGetPriceCmdImpl.setErrorMode(boolean) was set to false.