com.ibm.commerce.price.commands

Class GetStandardOfferCmdImpl

  • 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.GetStandardOfferCmdImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, com.ibm.commerce.command.TaskCommand, GetStandardOfferCmd, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class GetStandardOfferCmdImpl
    extends com.ibm.commerce.command.TaskCommandImpl
    implements GetStandardOfferCmd
    This GetStandardOfferCmd Task Command Implementation retrieves the standard offer prices for one or more catalog entries from the standard price lists.

    If the command is successful in retreiving offer prices, it will return a list of standard offer prices.

    If unsuccessful, it wil return an empty list.

    Behaviour

    Obtain the standard offer price for each of the catalog entries.

    This command calls the following TaskCommands:

    This command uses the following AccessBeans:
    • BusinessPolicyAccessBean
    • CatalogEntryAccessBean
    • OfferAccessBean
    • OfferPriceAccessBean
    • StoreAccessBean
    • OrderItemAccessBean
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      MonetaryAmount[] getBasePrices()
      Gets the prices for the given catlog entries with the currency specified in the database table.
      java.lang.Long[] getCatEntryIds()
      Returns the catEntryIds.
      java.lang.String getCurrency()
      Returns the currency.
      java.lang.Long[] getOfferIds() 
      com.ibm.commerce.order.objects.OfferAccessBean[] getOffers() 
      MonetaryAmount[] getPrices()
      Gets the prices for the given catlog entries with the requested currency.
      QuantityAmount[] getQuantities()
      Returns the quantities.
      java.lang.Integer getStoreId() 
      MonetaryAmount[] getUnitPrices()
      This method returns all the single unit standard price, which is based on an offer.
      void performExecute()
      The tasks in this method include 1) Retrieve Trade-Position-Container IDs from the standard pricelist for the store 2) Retrieve offers using RetrievePricesCmd based on a) Catalog entry IDs; b) TPC IDs; c) Quantities; d) Currency; e) Store ID 3) Filter the retrieved offers a) Keep only the offers with the highest TPC precedence b) If there are multiple offers, keep the offers with the highest OFFER precedence Note: it is still possible for a catalog entry may have multiple valid offers (i.e.
      void reset() 
      void setCatEntryIds(java.lang.Long[] arrCatEntryIDs)
      Sets the catEntryIds.
      void setCurrency(java.lang.String aCurrency)
      Sets the currency.
      void setOrderItemAccessBeans(com.ibm.commerce.order.objects.OrderItemAccessBean[] inOrderItemABs)
      Sets the order item access beans.
      void setPolicyPriceListType(java.lang.String aPolicyPriceListTypeToUse)
      (Optional) Sets the price list type of the business policy to use in retrieving price lists.
      void setQuantities(QuantityAmount[] arrQuantities)
      Sets the quantities.
      void setStoreId(java.lang.Integer aStoreId) 
      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, 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, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GetStandardOfferCmdImpl

        public GetStandardOfferCmdImpl()
    • Method Detail

      • getCatEntryIds

        public java.lang.Long[] getCatEntryIds()
        Returns the catEntryIds.
        Returns:
        Long[]
      • getCurrency

        public java.lang.String getCurrency()
                                     throws com.ibm.commerce.exception.ECSystemException
        Returns the currency.
        Returns:
        String
        Throws:
        com.ibm.commerce.exception.ECSystemException
      • getQuantities

        public QuantityAmount[] getQuantities()
        Returns the quantities.
        Returns:
        QuantityAmount[]
      • getStoreId

        public java.lang.Integer getStoreId()
        Specified by:
        getStoreId in interface com.ibm.commerce.command.ECCommand
        Overrides:
        getStoreId in class com.ibm.commerce.command.AbstractECTargetableCommand
        See Also:
        ECCommand.getStoreId()
      • getUnitPrices

        public MonetaryAmount[] getUnitPrices()
        This method returns all the single unit standard price, which is based on an offer.
        Specified by:
        getUnitPrices in interface GetStandardOfferCmd
        Returns:
        an Array of offer unit price.
      • performExecute

        public void performExecute()
                            throws com.ibm.commerce.exception.ECException
        The tasks in this method include 1) Retrieve Trade-Position-Container IDs from the standard pricelist for the store 2) Retrieve offers using RetrievePricesCmd based on a) Catalog entry IDs; b) TPC IDs; c) Quantities; d) Currency; e) Store ID 3) Filter the retrieved offers a) Keep only the offers with the highest TPC precedence b) If there are multiple offers, keep the offers with the highest OFFER precedence Note: it is still possible for a catalog entry may have multiple valid offers (i.e. with the highest TPC precedence and the highest OFFER precedence). 4) Retrieve prices for the filtered offers and the requested currency 5) If some offers do not have the requested price, retrieve their base prices (the prices with currencies specified in the OFFERPRICE table) Note: A offer may have multiple prices (w.r.t different currencies). The relationship looks like 1 * 1 * Catalog-Entry --------- Offer ---------- Price (requested/base prices) 6) For each offer, convert all its base prices to the requested currency, and select the lowest price as the best base price. 1 * 1 0..1 Catalog-Entry --------- Offer ---------- Price (requested/best base price) 7) Select the best offer for each catalog entry, the one with the lowest price wins 1 0..1 1 0..1 Catalog-Entry --------- Offer (best) ---------- Price (requested/best base price) 8) Finally calculate the price for each catalog entry based on a) offer price; b) quantity; The requested price is rounded. The best base price is not rounded, and if the requested price is available, it is viewed as the best base price.
        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()
        Overrides:
        reset in class com.ibm.commerce.command.AbstractECTargetableCommand
        See Also:
        com.ibm.websphere.command.Command#reset()
      • setCatEntryIds

        public void setCatEntryIds(java.lang.Long[] arrCatEntryIDs)
        Sets the catEntryIds.
        Specified by:
        setCatEntryIds in interface GetStandardOfferCmd
        Parameters:
        arrCatEntryIDs - The catalog entries to set.
      • setCurrency

        public void setCurrency(java.lang.String aCurrency)
        Sets the currency.
        Specified by:
        setCurrency in interface GetStandardOfferCmd
        Parameters:
        aCurrency - The currency to set
      • setOrderItemAccessBeans

        public void setOrderItemAccessBeans(com.ibm.commerce.order.objects.OrderItemAccessBean[] inOrderItemABs)
        Sets the order item access beans. OrderItemAccessBeans has a higher priority as the input of this command than the group containing catEntryIds , currency and quantities. That means if OrderItemAccessBeans is set, this command will retrieve standard offer for OrderItemAccessBeans and ignore the catEntryIds , currency and quantities may be input at the meantime.
        Specified by:
        setOrderItemAccessBeans in interface GetStandardOfferCmd
        Parameters:
        inOrderItemABs - an array of order item access bean
      • setPolicyPriceListType

        public void setPolicyPriceListType(java.lang.String aPolicyPriceListTypeToUse)
        (Optional) Sets the price list type of the business policy to use in retrieving price lists. If this value is set then only policies with this type in their properties will be used to find price lists.
        Specified by:
        setPolicyPriceListType in interface GetStandardOfferCmd
        Parameters:
        aPolicyPriceListTypeToUse - the policy price list type to use in retrieving price lists.
      • 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