com.ibm.commerce.price.utils

Class PriceOutputCaseGetPriceCmdOutput

  • java.lang.Object
    • com.ibm.commerce.price.utils.PriceOutputCaseGetPriceCmdOutput
  • All Implemented Interfaces:
    GetPriceCmdOutput


    public class PriceOutputCaseGetPriceCmdOutput
    extends java.lang.Object
    implements GetPriceCmdOutput
    PriceOutputCaseGetPriceCmdOutput represents a GetPriceCmdOutput which is made up of many PriceOutputCases. This is used to reconstruct command output data from two or more commands, as is done in CompositeGetContractUnitPriceCmdImpl. This can also be used to convert the output of another type of price calculation framework, by first converting to output cases and then using this class to convert to command output. This is done in the PriceRuleGetContractUnitPriceCmdImpl class.
    • Constructor Detail

      • PriceOutputCaseGetPriceCmdOutput

        public PriceOutputCaseGetPriceCmdOutput(java.util.List<PriceInputCase> newPriceInputCases)
        Constructor for PriceOutputCaseGetPriceCmdOutput.
        Parameters:
        newPriceInputCases - The list of input cases that were used before calling the command. These are used to impose an order on the output cases that matches the input order. Cannot be null, but may be empty. Input cases that share the same catalog entry identifier and quantity must also have the same order item.
    • Method Detail

      • addPriceOutputCase

        public void addPriceOutputCase(PriceOutputCase outputCase)
        Adds the given output case to this. The accumulated output cases will be converted into a more efficient form on the first call to an output method (any "get" method defined in GetPriceCmdOutput).
        Parameters:
        outputCase - The output case to add. Cannot be null.
      • getApplicableTradingIDs

        public MixList<java.lang.Long> getApplicableTradingIDs()
        Description copied from interface: GetPriceCmdOutput
        Returns the identifiers of the trading agreements that were used to determine the prices for a catalog entry.

        If the command is used in single mode, these identifiers will reflect the trading agreements that were specified for that catalog entry. If the command is used in batch mode, then these identifiers will reflect the trading agreements that were used for the first catalog entry in the input array.

        Specified by:
        getApplicableTradingIDs in interface GetPriceCmdOutput
        Returns:
        The identifiers of all the trading agreements that were used to obtain the prices for the specified catalog entry. This array may be null or empty if GetPriceCmdOutput.getPrice() returns null.
      • getApplicableUnitPrices

        public MixList<MonetaryAmount> getApplicableUnitPrices()
        Description copied from interface: GetPriceCmdOutput
        Returns the prices that were determined for each of the applied trading agreements for a catalog entry. Each element in the returned array corresponds to the element at the same index in the array returned by #getApplicableTradingIds().

        If the command is used in single mode, these prices will reflect the prices that were found for the input catalog entry. If the command is used in batch mode, then these prices will reflect the prices that were used for the first catalog entry in the input array.

        Specified by:
        getApplicableUnitPrices in interface GetPriceCmdOutput
        Returns:
        The unit price amounts of the specified catalog entry in that each of them was determined individually for its corresponding trading agreement. This array may be null or empty if GetPriceCmdOutput.getPrice() returns null.
      • getBasePrice

        public MonetaryAmount getBasePrice()
        Description copied from interface: GetPriceCmdOutput
        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 the command is used in single mode, this price will be for the input catalog entry. If the 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 GetPriceCmdOutput
        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.
      • getOffer

        public com.ibm.commerce.order.objects.OfferAccessBean getOffer()
        Description copied from interface: GetPriceCmdOutput
        Returns the offer access bean that was used to determine the price.

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

        Specified by:
        getOffer in interface GetPriceCmdOutput
        Returns:
        The offer access bean associated with the offer that was used to determine the best price, or null if no offer was used or GetPriceCmdOutput.getPrice() returns null.
      • getOfferID

        public java.lang.Long getOfferID()
        Description copied from interface: GetPriceCmdOutput
        Returns the identifier of the offer that was used to determine the price.

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

        Specified by:
        getOfferID in interface GetPriceCmdOutput
        Returns:
        The identifier of the offer that was used to determine the price, or null if no offer was used or GetPriceCmdOutput.getPrice() returns null.
      • getPrice

        public MonetaryAmount getPrice()
        Description copied from interface: GetPriceCmdOutput
        Returns the best price of the catalog entry in the requested currency.

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

        Specified by:
        getPrice in interface GetPriceCmdOutput
        Returns:
        The best price of the catalog entry in the requested currency. This value may be null if the error mode is set to true and no price was found.
      • getTcID

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

        If the command is used in single mode, this term condition will be for the input catalog entry. If the 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 GetPriceCmdOutput
        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 GetPriceCmdOutput.getPrice() returns null.
      • getTradingID

        public java.lang.Long getTradingID()
        Description copied from interface: GetPriceCmdOutput
        Returns the identifier of the trading agreement which was used to calculate the best price.

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

        Specified by:
        getTradingID in interface GetPriceCmdOutput
        Returns:
        The identifier of the trading agreement that was used to determine the best price. This value may be null if no trading agreement was used to determine the price or GetPriceCmdOutput.getPrice() returns null.
      • isInputMatchForOutput

        public static boolean isInputMatchForOutput(PriceInputCase inputCase,
                                                    PriceOutputCase outputCase)
        Returns whether the given output is the result for the given input.
        Parameters:
        inputCase - The input case which might match the given output. Cannot be null.
        outputCase - The output case to find a match for. Cannot be null.
        Returns:
        True if the given input matches the given output, false otherwise.
      • toString

        public java.lang.String toString()
        Returns the string representation of this.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation of this. Will not be null or empty.