Class GetBaseUnitPriceCmdImpl

  • java.lang.Object
  • All Implemented Interfaces:,,,, GetBaseSpecialPriceCmd, GetBaseUnitPriceCmd, GetProductBaseUnitPriceCmd,,

    public class GetBaseUnitPriceCmdImpl
    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

      Constructor and Description
      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. 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( 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

        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

      • Methods inherited from interface

        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()
        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
        the expiry date.
      • performExecute

        public void performExecute()
        Execute the command.
        Specified by:
        performExecute in interface
        performExecute in class
      • reset

        public void reset()
        reset the command.
        reset in class
      • 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
        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
        anOfferIdList - the offer IDs.
      • setOrderItemAccessBean

        public void setOrderItemAccessBean( anOrderItemAccessBean)
        (Optional) Set the order item.
        Specified by:
        setOrderItemAccessBean in interface GetBaseSpecialPriceCmd
        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
        aQuantityAmount - a quantity amount.
      • validateParameters

        public void validateParameters()
        Check mandatory parameters.
        Specified by:
        validateParameters in interface
        validateParameters in class