Class EnsureOffersExistGetContractUnitPriceCmdImpl

  • java.lang.Object
  • All Implemented Interfaces:,,,, GetContractSpecialPriceCmd, GetContractUnitPriceCmd, GetProductContractUnitPriceCmd,,

    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 <Next Implementation of> <Next Implementation of > <Next Implementation of>

    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.
        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.
        The best price for the offer. It will return null if error occurs, will not return empty string.
      • getOfferByPriceListAndCatentry

        public 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)
        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.
        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.
        The base offer in the specific price list. Return null if there is no valid offer.
        Throws: - 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.
        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.
        True if the offer is valid.
      • performExecute

        public void performExecute()
        Performs the steps described in the class description.
        Specified by:
        performExecute in interface
        performExecute in class
        Throws: - 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.