com.ibm.commerce.price.commands
Class GetBaseUnitPriceCmdImpl

java.lang.Object
  |
  +--com.ibm.commerce.command.AbstractECCommand
        |
        +--com.ibm.commerce.command.TaskCommandImpl
              |
              +--com.ibm.commerce.price.commands.GetBaseUnitPriceCmdImpl
All Implemented Interfaces:
ECCommand, GetBaseSpecialPriceCmd, GetBaseUnitPriceCmd, GetProductBaseUnitPriceCmd, TaskCommand

public class GetBaseUnitPriceCmdImpl
extends TaskCommandImpl
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:

If a valid offer cannot be found for an item, the parent product offers will be searched.


Fields inherited from class com.ibm.commerce.command.AbstractECCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.price.commands.GetBaseUnitPriceCmd
COPYRIGHT, defaultCommandClassName, ERR_CODE_NO_PRICE, ERRTASK_NAME, NAME
 
Fields inherited from interface com.ibm.commerce.price.commands.GetBaseSpecialPriceCmd
COPYRIGHT, defaultCommandClassName, ERR_CODE_NO_PRICE, ERRTASK_NAME, NAME
 
Fields inherited from interface com.ibm.commerce.price.commands.GetProductBaseUnitPriceCmd
COPYRIGHT, defaultCommandClassName, ERR_CODE_NO_PRICE, ERRTASK_NAME, NAME
 
Constructor Summary
GetBaseUnitPriceCmdImpl()
          GetBaseUnitPriceCmdImpl constructor.
 
Method Summary
 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.
 OfferAccessBean 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(OrderItemAccessBean 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 com.ibm.commerce.command.AbstractECCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 

Constructor Detail

GetBaseUnitPriceCmdImpl

public GetBaseUnitPriceCmdImpl()
GetBaseUnitPriceCmdImpl constructor.
Method Detail

getBasePrice

public MonetaryAmount getBasePrice()
Gets the base price of the catalog entry. The base price is the price (and currency) found for the catalog entry before any conversion. This is only set when the requested currency is different from the base currency and the base price must be converted to the requested price.
Specified by:
getBasePrice in interface GetBaseUnitPriceCmd
Returns:
the base price of the product.

getContractIds

public java.lang.Long[] getContractIds()
                                throws ECSystemException
Get the contract IDs associated with the offer that supplied the price.
Specified by:
getContractIds in interface GetBaseUnitPriceCmd
Returns:
the contract ID(s).

getExpiryDateForCache

public java.sql.Timestamp getExpiryDateForCache()
                                         throws ECSystemException
Get the expiry date of the price. The expiry date of the price may be influenced by any other offer 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 GetBaseUnitPriceCmd
Returns:
the expiry date.

getOffer

public OfferAccessBean getOffer()
Get the offer access bean that was used to determine the price.
Specified by:
getOffer in interface GetBaseUnitPriceCmd
Returns:
the offer access bean associated with the offer used to calculate the price.

getOfferId

public java.lang.Long getOfferId()
getOfferID method comment.
Specified by:
getOfferId in interface GetBaseUnitPriceCmd
Returns:
the offer ID associated with the price.

getPrice

public MonetaryAmount getPrice()
Gets the actual price of the catalog entry. This price is in the requested currency of the shopper.
Specified by:
getPrice in interface GetBaseUnitPriceCmd
Returns:
the price of the catalog entry Id.

performExecute

public void performExecute()
                    throws ECException
Execute the command.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

reset

public void reset()
reset the command.
Overrides:
reset in class AbstractECCommand

setCatEntryId

public void setCatEntryId(java.lang.Long aCatEntryId)
Sets the primary key of the catalog entry whose price is to be retrieved.
Specified by:
setCatEntryId in interface GetBaseUnitPriceCmd
Parameters:
aCatEntryId - the reference number of a catalog entry.

setContractIds

public void setContractIds(java.lang.Long[] aContractIdList)
(Optional) Sets the contract IDs to be used to determine which offers apply. If no contract ID is specified then the default contract for the store is used.
Specified by:
setContractIds in interface GetBaseUnitPriceCmd
Parameters:
aContractIdList - the contract IDs to use.

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 GetBaseUnitPriceCmd
Parameters:
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 GetBaseUnitPriceCmd
Parameters:
anOfferIdList - the offer IDs.

setOrderItemAccessBean

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

setStoreId

public void setStoreId(java.lang.Integer newStoreId)
(Optional) Set the store Id to use for calculating the price. If the store Id is not specified then the store Id of the command context will be used.
Specified by:
setStoreId in interface GetBaseUnitPriceCmd
Parameters:
aStoreId - the store Id.

validateParameters

public void validateParameters()
                        throws ECException
Check mandatory parameters.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -