com.ibm.commerce.price.commands

Class GetContractUnitPriceCmdImpl

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


    public class GetContractUnitPriceCmdImpl
    extends com.ibm.commerce.command.TaskCommandImpl
    implements GetContractUnitPriceCmd, GetContractSpecialPriceCmd, GetProductContractUnitPriceCmd
    This GetContractUnitPriceCmd Task Command Implementation can be called by several commands such as ProductDisplayCmd, OrderItemAddCmd, OrderItemUpdateCmd, OrderItemDisplayCmd and OrderPrepareCmdController Command. This GetContractUnitPriceCmd Task Command Implementation supports single catalog entry and multiple catalog entries. It calculates the best contract price for each catalog entry given a list of trading agreements (and offers). And it is also for each of these trading agreements, obtains its best contract price.

    If the command is successful retrieving the price, it will return the best price, the offer id and access bean. And it will return the T&C id and the trading agreement id that determined the price.

    If unsuccessful, the command throws the ECApplicationException specifying an Error Message (ERR_RETRIEVE_PRICE), an Error Code (ERR_CODE_NO_PRICE) and the Error View (RetrievePriceErrorView).

    Behaviour

    • Obtain all the qualified offers for the input catalog entry.
    • Obtain all the qualified offers for the input information from multiple catalog entries. If the catalog entry prices were set, Catalog entry prices will be respected as the higher priority than the input of catalog entry id.
    • Obtain all the qualified offers according to the input catalog entry and specified trading agreements.
    • Trading agreements verification will take effect when the member id of the command was set. In the mode of single catalog entry, if some specified trading agreements are not eligible for this member, an exception will be thrown. In the mode of multiple catalog entries, if some specified trading agreements are not eligible for this member, the ineligible trading agreements will be filtered.
    These offers to be retrieved to find the prices of the catalog entries must satisfy the following criteria (Invoke CalculateContractPricesCmd):
    • the catalog entry must not be excluded by the input and eligible trading agreements.
    • offer id matches one of the supplied offer ids or no offer ids were supplied.
    • the offer must be associated with a price list that is referenced by one of the eligible trading agreements.
    • The trading agreement id provided the offer matches one of the supplied trading ids. If no trading ids were supplied, it matches one of those trading agreements. They are active and also eligible for the specified store and the user.
    • the offer must be published.
    • the current timestamp of the offer must be in the active range specified for the offer (between the STARTDATE and ENDDATE).
    • either no quantityAmount was specified 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.
    • the offer has a valid offer price 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 no valid offer can be found, the parent product offers will be searched providing the catalog entry. And the parent product is not excluded from the trading agreements. *

    Get the best price among all the qualified offers for the input catalog entry (Invoke SelectContractPricesCmd):

    • the price list provided the offer has the highest precedence among all the qualified price lists referenced by all the eligible trading agreements.
    • the offer has the highest possible precedence within its price list. A lower precedence offer may be chosen if there is no qualifying offer with a higher precedence level in the same price list.
    • the result offer price gives the lowest price, after applying the adjustment specified in the Ts&Cs from the trading agreements.

    Exception Conditions

    • If no eligible trading agreements can be obtained, the command throws the ECApplicationException specifying an Error Message (ERR_NO_ELIGIBLE_TRADING).
    • In mode of single catalog entry, if the specified trading agreement is not valid, the command throws the ECApplicationException specifying an Error Message (ERR_NO_VALID_TRADING).
    • If price list cannot be resolved from the price business policies, the command throws the ECApplicationException specifying an Error Message (ERR_FOUND_PRICE_LIST_FROM_POLICY).
    • If price list cannot be retrieved, the command throws the ECApplicationException specifying an Error Message (ERR_RETRIEVE_PRICE_LIST).
    • If no price is found, the command throws the ECApplicationException specifying an Error Message (ERR_RETRIEVE_PRICE).

      If ErrorMode is false, these errors will be ignored and a null value price will be passed back to the caller.

    This command calls the following TaskCommands:

    This command uses the following AccessBeans:
    • StoreAccessBean
    • OrderItemAccessBean
    • BusinessPolicyAccessBean
    • CatalogEntryShippingAccessBean
    • TradingAgreementAccessBean
    • OfferAccessBean
    • TermConditionAccessBean
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Long[] getApplicableTradingIds()
      For input single Catalog entry , returns the ids of the trading agreements that are used to determine the prices.
      MonetaryAmount[] getApplicableTradingUnitPrices()
      For input single Catalog entry, returns the unit prices of a catentry that were determined for each of the applied trading agreements.
      MonetaryAmount getBasePrice()
      For input single catalog entry, returns the base price of the input catalog entry.
      CatEntryPrices[] getCatEntryPrices()
      For input multiple catalog entries, return the price related information of the input catalog entries.
      com.ibm.commerce.order.objects.OfferAccessBean getOffer()
      For input single Catalog entry, returns the offer access bean that was used to determine the price.
      java.lang.Long getOfferId()
      For input single Catalog entry, returns the id of the output offer id that was used to determine the price.
      java.lang.Long getOrganizationId()
      Returns the organization ID to be used to determine entitled contracts.
      MonetaryAmount getPrice()
      For input single Catalog entry, returns the actual price of the catalog entry.
      java.lang.Long getTcId()
      Returns the id of the output T&C id which was associated with the offer that supplied the price.
      java.lang.Long getTradingId()
      Returns the id of the output trading agreement id which was associated with the offer that supplied the price.
      void performExecute()
      Executes main business logic of the command.
      void reset()
      reset the command.
      void setCatEntryId(java.lang.Long anCatEntryId)
      Sets the id of the input catalog entry.
      void setCatEntryPrices(CatEntryPrices[] aCatEntryPrices)
      Sets the information of one or more catalog entries.
      void setCurrency(java.lang.String astrCurrency)
      Sets the currency to be used for finding the price (Optional).
      void setErrorMode(boolean aErrorMode)
      Sets the flag to indicate if exception will be thrown when the price cannot be found for the input catentry (Optional).
      void setMemberId(java.lang.Long anMemberId)
      Sets the member id to be used for verifying and searching the trading agreements (Optional).
      void setOfferIds(java.lang.Long[] aOfferIds)
      Sets the ids of the input offers to be used for price (Optional).
      void setOrderItemAccessBean(com.ibm.commerce.order.objects.OrderItemAccessBean aOrderItemAB)
      Sets the orderitem Access Bean.
      void setOrganizationId(java.lang.Long organizationId)
      Sets the organization ID to be used to determine entitled contracts.
      void setQuantity(QuantityAmount aQuantityAmount)
      Sets the quantity amount of the input catalog entry that is to be priced (Optional).
      void setStoreId(java.lang.Integer aStoreId)
      Sets the id of the input store to be used for calculating the price (Optional).
      void setTradingIds(java.lang.Long[] aTradingIds)
      Sets the ids of the input trading agreements (Optional).
      void validateParameters()
      Checks 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