com.ibm.commerce.price.commands

Class GetBaseUnitPriceCmdImpl

  • java.lang.Object
    • com.ibm.websphere.command.CacheableCommandImpl
      • com.ibm.commerce.command.MeasuredCacheableCommandImpl
        • com.ibm.commerce.command.AbstractECTargetableCommand
          • com.ibm.commerce.command.TaskCommandImpl
            • com.ibm.commerce.price.commands.GetBaseUnitPriceCmdImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, com.ibm.commerce.command.TaskCommand, GetBaseSpecialPriceCmd, GetBaseUnitPriceCmd, GetProductBaseUnitPriceCmd, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class GetBaseUnitPriceCmdImpl
    extends com.ibm.commerce.command.TaskCommandImpl
    implements GetBaseUnitPriceCmd, GetBaseSpecialPriceCmd, GetProductBaseUnitPriceCmd
    Get the best price for a catalog entry.

    The offer that is used to find the price of a catalog entry Id must satisfy the following criteria:

    • offer Id matches one of the supplied offer Ids or no offer Ids were supplied.
    • the offer must be associated with a trading position container. That has no member groups associated with it. Or that has a member group associated with it that the shopper is explicitly a member of (MBRGRPMBR table).
    • the trading position container must be associated with a contract that is associated with the same store under which the command is running.
    • the offer must be published.
    • the current timestamp must be in the active range specified for the offer (between the STARTDATE and ENDDATE).
    • the offer will have the highest possible precedence within its trading position container. A lower precedence offer may be chosen if there is no qualifying offer with a higher precedence level in the same trading position container.
    • at most one offer will be chosen from each trading position container. The best of each offer from each trading position container will be the final offer.
    • either no quantityAmount was specified (see setQuantity(QuantityAmount) or the quantity range specified on the offer includes the quantity amount specified. If a conversion is required and cannot be performed (because there is no conversion rule) then the offer is not considered.
    • there is an offer price for the offer in the correct currency or a conversion exists from the offer price currency to the requested currency. If there is more than one currency that can be converted to the requested currency then the lowest price will be used from all the conversions.

    If a valid offer cannot be found for an item, the parent product offers will be searched.

    This command calls the following TaskCommands:

    This command uses the following AccessBeans:
    • StoreAccessBean
    • CatalogEntryShippingAccessBean
    • OfferAccessBean
    • OfferPriceAccessBean
    • CatalogEntryAccessBean
    • ServerJDBCHelperBean
    • UserAccessBean
    • MemberGroupMemberAccessBean
    • Constructor Summary

      Constructors 
      Constructor and Description
      GetBaseUnitPriceCmdImpl()
      GetBaseUnitPriceCmdImpl constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      MonetaryAmount getBasePrice()
      Gets the base price of the catalog entry.
      java.lang.Long[] getContractIds()
      Get the contract IDs associated with the offer that supplied the price.
      java.sql.Timestamp getExpiryDateForCache()
      Get the expiry date of the price.
      com.ibm.commerce.order.objects.OfferAccessBean getOffer()
      Get the offer access bean that was used to determine the price.
      java.lang.Long getOfferId()
      getOfferID method comment.
      MonetaryAmount getPrice()
      Gets the actual price of the catalog entry.
      void performExecute()
      Execute the command.
      void reset()
      reset the command.
      void setCatEntryId(java.lang.Long aCatEntryId)
      Sets the primary key of the catalog entry whose price is to be retrieved.
      void setContractIds(java.lang.Long[] aContractIdList)
      (Optional) Sets the contract IDs to be used to determine which offers apply.
      void setCurrency(java.lang.String aCurrency)
      (Optional) Set the currency to be used for finding the price.
      void setOfferIds(java.lang.Long[] anOfferIdList)
      (Optional) Sets the offer IDs to use for the price.
      void setOrderItemAccessBean(com.ibm.commerce.order.objects.OrderItemAccessBean anOrderItemAccessBean)
      (Optional) Set the order item.
      void setQuantity(QuantityAmount newQuantityAmount)
      (Optional) Set the quantity amount of the catalog entry that is to be priced.
      void setStoreId(java.lang.Integer newStoreId)
      (Optional) Set the store Id to use for calculating the price.
      void validateParameters()
      Check mandatory parameters.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand

        accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
      • Methods inherited from interface com.ibm.commerce.command.CacheableECCommand

        execute
      • Methods inherited from interface com.ibm.commerce.command.ECCommand

        checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
    • Constructor Detail

      • GetBaseUnitPriceCmdImpl

        public GetBaseUnitPriceCmdImpl()
        GetBaseUnitPriceCmdImpl constructor.
    • Method Detail

      • getExpiryDateForCache

        public java.sql.Timestamp getExpiryDateForCache()
                                                 throws com.ibm.commerce.exception.ECSystemException
        Get the expiry date of the price. The expiry date of the price may be influenced by any other offers even those that the user does not qualify for. This simplifies the algorithm that decides which page to display for a particular user and also simplifies the algorithm for cache expiration.
        Specified by:
        getExpiryDateForCache in interface GetBaseSpecialPriceCmd
        Specified by:
        getExpiryDateForCache in interface GetBaseUnitPriceCmd
        Specified by:
        getExpiryDateForCache in interface GetProductBaseUnitPriceCmd
        Returns:
        the expiry date.
        Throws:
        com.ibm.commerce.exception.ECSystemException
      • performExecute

        public void performExecute()
                            throws com.ibm.commerce.exception.ECException
        Execute the command.
        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
      • reset

        public void reset()
        reset the command.
        Overrides:
        reset in class com.ibm.commerce.command.AbstractECTargetableCommand
      • setCurrency

        public void setCurrency(java.lang.String aCurrency)
        (Optional) Set the currency to be used for finding the price. If the currency is not specified then the "negotiated" currency is used for the store Id and shopper's preferred currency. (The negotiated currency is the currency returned from the getCurrency() method of the currency manager).
        Specified by:
        setCurrency in interface GetBaseSpecialPriceCmd
        Specified by:
        setCurrency in interface GetBaseUnitPriceCmd
        Specified by:
        setCurrency in interface GetProductBaseUnitPriceCmd
        Parameters:
        aCurrency - the currency.
      • setOfferIds

        public void setOfferIds(java.lang.Long[] anOfferIdList)
        (Optional) Sets the offer IDs to use for the price. If no offer IDs are supplied, then the "best" of all qualifying offers will be used. If offer IDs are specified, the "best" of the specified offers will be returned.
        Specified by:
        setOfferIds in interface GetBaseSpecialPriceCmd
        Specified by:
        setOfferIds in interface GetBaseUnitPriceCmd
        Specified by:
        setOfferIds in interface GetProductBaseUnitPriceCmd
        Parameters:
        anOfferIdList - the offer IDs.
      • setOrderItemAccessBean

        public void setOrderItemAccessBean(com.ibm.commerce.order.objects.OrderItemAccessBean anOrderItemAccessBean)
        (Optional) Set the order item.
        Specified by:
        setOrderItemAccessBean in interface GetBaseSpecialPriceCmd
        Parameters:
        anOrderItemAccessBean - an order item access bean.
      • setQuantity

        public void setQuantity(QuantityAmount newQuantityAmount)
        (Optional) Set the quantity amount of the catalog entry that is to be priced. The quantity amount helps determine which offers are valid. If the quantity amount is not specified; then the nominal quantity (rounded up to the nearest multiple as specified in the quantityMultiple attribute) of the Catalog entry is assumed to be the requested quantity.
        Specified by:
        setQuantity in interface GetBaseSpecialPriceCmd
        Specified by:
        setQuantity in interface GetBaseUnitPriceCmd
        Specified by:
        setQuantity in interface GetProductBaseUnitPriceCmd
        Parameters:
        aQuantityAmount - a quantity amount.
      • validateParameters

        public void validateParameters()
                                throws com.ibm.commerce.exception.ECException
        Check mandatory parameters.
        Specified by:
        validateParameters in interface com.ibm.commerce.command.ECCommand
        Overrides:
        validateParameters in class com.ibm.commerce.command.AbstractECTargetableCommand
        Throws:
        com.ibm.commerce.exception.ECException