com.ibm.commerce.price.commands

Class AbstractGetPriceCmdImpl

  • 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.AbstractGetPriceCmdImpl
    • Constructor Summary

      Constructors 
      Constructor and Description
      AbstractGetPriceCmdImpl()
      Constructor for PriceRuleGetContractUnitPriceCmdImpl.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Long[] getApplicableTradingIds()
      Returns the identifiers of the trading agreements that were used to determine the prices for a catalog entry.
      MonetaryAmount[] getApplicableTradingUnitPrices()
      Returns the prices that were determined for each of the applied trading agreements for a catalog entry.
      MonetaryAmount getBasePrice()
      Returns the best price of the input catalog entry before any currency conversions.
      CatEntryPrices[] getCatEntryPrices()
      Returns the price related information for the input catalog entries.
      com.ibm.commerce.order.objects.OfferAccessBean getOffer()
      Returns the offer access bean that was used to determine the price.
      java.lang.Long getOfferId()
      Returns the identifier of the offer that was used to determine the price.
      MonetaryAmount getPrice()
      Returns the best price of the catalog entry in the requested currency.
      java.lang.Integer getStoreId()
      Returns the store that was set by the user, or from the command context if the user did not set one.
      java.lang.Long getTcId()
      Returns the identifier of the term condition which was used to calculate the best price.
      java.lang.Long getTradingId()
      Returns the identifier of the trading agreement which was used to calculate the best price.
      void reset()
      Resets this command so that it is in its default state.
      void setCatEntryId(java.lang.Long newCatEntryID)
      Sets the identifier of the catalog entry whose price is to be calculated.
      void setCatEntryPrices(CatEntryPrices[] newCatEntries)
      Sets the information of one or more catalog entries whose prices are to be calculated.
      void setCurrency(java.lang.String newCurrency)
      Sets the desired currency to be used for the output price.
      void setErrorMode(boolean newThrowPriceExceptions)
      Sets whether an exception will be thrown when the price cannot be found for the input catalog entry.
      void setMemberId(java.lang.Long newMemberID)
      Sets the member identifier to be used for determining which trading agreements are valid to use to calculate the price.
      void setOfferIds(java.lang.Long[] newOfferIDs)
      Sets the identifiers of the input offers to be used for price.
      void setOrderItemAccessBean(com.ibm.commerce.order.objects.OrderItemAccessBean orderItemAccessBean)
      Set an order item.
      void setOrganizationId(java.lang.Long newOrganizationID)
      Sets the organization identifier to be used in conjunction with the member identifier for verifying and searching for trading agreements.
      void setQuantity(QuantityAmount newQuantity)
      Sets the quantity of the input catalog entry that is to be priced.
      void setStoreId(java.lang.Integer newStoreID)
      Sets the identifier of the store to be used for calculating the price.
      void setTradingIds(java.lang.Long[] newTradingIDs)
      Sets the identifiers of the input trading agreements.
      void validateParameters()
      Checks that there is a store ID, currency, and either a single mode catalog entry or one or more batch mode catalog entries.
      • 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, performExecute, 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, performExecute, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
    • Constructor Detail

      • AbstractGetPriceCmdImpl

        public AbstractGetPriceCmdImpl()
        Constructor for PriceRuleGetContractUnitPriceCmdImpl.
    • Method Detail

      • getBasePrice

        public MonetaryAmount getBasePrice()
        Description copied from interface: GetContractUnitPriceCmd
        Returns the best price of the input catalog entry before any currency conversions. This is only set when the requested currency is different from the base currency, in which case the base price must be converted to the requested price.

        If this command is used in single mode, this price will be for the input catalog entry. If this command is used in batch mode, then this price will be for the first catalog entry in the input array.

        Specified by:
        getBasePrice in interface GetContractSpecialPriceCmd
        Specified by:
        getBasePrice in interface GetContractUnitPriceCmd
        Specified by:
        getBasePrice in interface GetProductContractUnitPriceCmd
        Returns:
        The best price found for the specified catalog entry. This value will be null if no currency conversion was performed to obtain the price in the requested currency.
      • getStoreId

        public java.lang.Integer getStoreId()
        Returns the store that was set by the user, or from the command context if the user did not set one.
        Specified by:
        getStoreId in interface com.ibm.commerce.command.ECCommand
        Overrides:
        getStoreId in class com.ibm.commerce.command.AbstractECTargetableCommand
        Returns:
        The identifier of the store set by the user, or the one in the command context if the user did not set one. See setStoreId(java.lang.Integer) for details.
      • getTcId

        public java.lang.Long getTcId()
        Description copied from interface: GetContractUnitPriceCmd
        Returns the identifier of the term condition which was used to calculate the best price.

        If this command is used in single mode, this term condition will be for the input catalog entry. If this command is used in batch mode, then this term condition will be for the first catalog entry in the input array.

        Specified by:
        getTcId in interface GetContractSpecialPriceCmd
        Specified by:
        getTcId in interface GetContractUnitPriceCmd
        Specified by:
        getTcId in interface GetProductContractUnitPriceCmd
        Returns:
        The identifier of the term condition that was used to determine the best price. This value may be null if no term condition was used to determine the price or GetContractUnitPriceCmd.getPrice() returns null.
      • reset

        public void reset()
        Description copied from interface: GetContractUnitPriceCmd
        Resets this command so that it is in its default state.

        The original definition of this method described in com.ibm.websphere.command.Command.reset() requires that this method sets the output properties to the values they had before the execute() method was run. The original definition also requires that after calling this method, isReadyToCallExecute() method returns true.

        In addition to the above, this command requires that input parameters must also be set to their original default values. For example, consider the following sequence of calls:

         GetContractUnitPriceCmd cmd = ...
         cmd.setCatEntryId(id);
         cmd.reset();
         cmd.setCatEntryPrices(catEntryPricesArray);
         
        After these calls are executed, cmd will behave as though only setCatEntryPrices(CatEntryPrices[]) had been called.
        Specified by:
        reset in interface GetContractSpecialPriceCmd
        Specified by:
        reset in interface GetContractUnitPriceCmd
        Specified by:
        reset in interface GetProductContractUnitPriceCmd
        Overrides:
        reset in class com.ibm.commerce.command.AbstractECTargetableCommand
      • setErrorMode

        public void setErrorMode(boolean newThrowPriceExceptions)
        Description copied from interface: GetContractUnitPriceCmd
        Sets whether an exception will be thrown when the price cannot be found for the input catalog entry.

        This input value is optional. The default value is true.

        Specified by:
        setErrorMode in interface GetContractSpecialPriceCmd
        Specified by:
        setErrorMode in interface GetContractUnitPriceCmd
        Specified by:
        setErrorMode in interface GetProductContractUnitPriceCmd
        Parameters:
        newThrowPriceExceptions - True indicates an exception will be thrown when a price cannot be found, false indicates exceptions will be ignored and null will be returned for the price instead.
      • setMemberId

        public void setMemberId(java.lang.Long newMemberID)
        Description copied from interface: GetContractUnitPriceCmd
        Sets the member identifier to be used for determining which trading agreements are valid to use to calculate the price. See GetContractUnitPriceCmd.setTradingIds(Long[]) for details on how the trading agreements are used.

        This input value is optional. The default value is obtained from CommandContext#getUserId().

        Specified by:
        setMemberId in interface GetContractUnitPriceCmd
        Parameters:
        newMemberID - The member identifier to be used to verify the input list of trading agreements. If null, the default value will be used.
      • setOrderItemAccessBean

        public void setOrderItemAccessBean(com.ibm.commerce.order.objects.OrderItemAccessBean orderItemAccessBean)
        Description copied from interface: GetContractSpecialPriceCmd
        Set an order item.

        This value is never set or used, so implementors may safely do nothing.

        Specified by:
        setOrderItemAccessBean in interface GetContractSpecialPriceCmd
        Parameters:
        orderItemAccessBean - An order item access bean. May be null.
      • setOrganizationId

        public void setOrganizationId(java.lang.Long newOrganizationID)
        Description copied from interface: GetContractUnitPriceCmd
        Sets the organization identifier to be used in conjunction with the member identifier for verifying and searching for trading agreements. This value will only be used when the member identifier provided is different from the CommandContext#getUserId().

        This input value is optional. The default value is the EntitlementContext#getActiveOrganizationId().

        Specified by:
        setOrganizationId in interface GetContractUnitPriceCmd
        Parameters:
        newOrganizationID - The organization identifier to be used in conjunction with the member identifier to verify the input list of trading agreements. If null, the default value will be used.
      • setQuantity

        public void setQuantity(QuantityAmount newQuantity)
        Description copied from interface: GetContractUnitPriceCmd
        Sets the quantity of the input catalog entry that is to be priced. The quantity helps determine which prices are to be used when there are multiple price ranges.

        For example, consider the table below:

        Quantity range Price per unit
        1-5 10 USD
        6-10 9 USD
        If the quantity specified by this method is 2, the price per unit will be 10 USD. If the quantity is 8, the price per unit will be 9 USD.

        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. See the CATENTSHIP table for more information. This behavior can be implemented by calling RetrievePricesCmd.

        This input value is optional. The default value is the nominal quantity for the catalog entry. This quantity will only be used in conjunction with GetContractUnitPriceCmd.setCatEntryId(Long).

        Specified by:
        setQuantity in interface GetContractSpecialPriceCmd
        Specified by:
        setQuantity in interface GetContractUnitPriceCmd
        Specified by:
        setQuantity in interface GetProductContractUnitPriceCmd
        Parameters:
        newQuantity - The quantity amount of the catalog entry. If null, the nominal quantity will be used as described above.
      • setTradingIds

        public void setTradingIds(java.lang.Long[] newTradingIDs)
        Description copied from interface: GetContractUnitPriceCmd
        Sets the identifiers of the input trading agreements.

        Each member is entitled to a number of trading agreements (possibly zero), depending on the member and store. The trading agreements for each catalog entry are provided in one of three ways (from highest to lowest precedence):

        1. GetContractUnitPriceCmd.setCatEntryPrices(CatEntryPrices[]) (each catalog entry can have different trading agreements defined or none);
        2. This method;
        3. ContractCmdUtil#getCurrentTradingAgreements(CommandContext).
        The specified trading agreements will be checked against the entitled agreements for the specified member. Only the valid trading agreements will be used. If no trading agreements are specified, all entitled trading agreements will be used.

        This input value is optional. The default value is null.

        Specified by:
        setTradingIds in interface GetContractSpecialPriceCmd
        Specified by:
        setTradingIds in interface GetContractUnitPriceCmd
        Specified by:
        setTradingIds in interface GetProductContractUnitPriceCmd
        Parameters:
        newTradingIDs - The identifiers of the trading agreements to be used to determine the prices. If null or empty, the current or entitled trading agreements will be used as described above.
      • validateParameters

        public void validateParameters()
                                throws com.ibm.commerce.exception.ECException
        Checks that there is a store ID, currency, and either a single mode catalog entry or one or more batch mode catalog entries. The store ID and currencies may come from the command context and this will pass.
        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 - If any of the required parameters is missing.