com.ibm.commerce.price.commands
Class GetBaseUnitPriceCmdImpl
java.lang.Object
CacheableCommandImpl
com.ibm.commerce.command.AbstractECTargetableCommand
com.ibm.commerce.command.TaskCommandImpl
com.ibm.commerce.price.commands.GetBaseUnitPriceCmdImpl
- All Implemented Interfaces:
- ECCommand, ECTargetableCommand, 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:
- offer Id matches one of the supplied offer Ids or no offer Ids were supplied.
- the offer must be associated with a trading position container that either has no member groups associated with it or has a member group associated with it that the shopper is explicitly a member of (MBRGRPMBR table).
- the trading position container must be associated with a contract that is associated with the same store under which the command is running.
- the offer must be published.
- the current timestamp must be in the active range specified for the offer (between the STARTDATE and ENDDATE).
- the offer will have the highest possible precedence within its trading position container. A lower precedence offer may be chosen if there is no qualifying offer with a higher precendence level in the same trading position container.
- at most one offer will be chosen from each trading position container. The best of each offer from each trading position container will be the final offer.
- either no quantityAmount was specified (see setQuantity(QuantityAmount) 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.
- there is an offer price for the offer 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 a valid offer cannot be found for an item, the parent product offers will be searched.
This command calls the following TaskCommands:
This command uses the following AccessBeans:
- See Also:
- Serialized Form
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.AbstractECTargetableCommand |
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GetBaseUnitPriceCmdImpl
public GetBaseUnitPriceCmdImpl()
- GetBaseUnitPriceCmdImpl constructor.
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).
- Throws:
- ECSystemException
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.
- Throws:
- ECSystemException
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 AbstractECTargetableCommand
-
- Throws:
- ECException
reset
public void reset()
- reset the command.
-
- Overrides:
- reset in class AbstractECTargetableCommand
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:
- newQuantityAmount - 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:
- newStoreId - the store Id.
validateParameters
public void validateParameters()
throws ECException
- Check mandatory parameters.
-
- Specified by:
- validateParameters in interface ECCommand
- Overrides:
- validateParameters in class AbstractECTargetableCommand
-
- Throws:
- ECException
Feedback
(C) Copyright IBM Corporation 1996, 2005. All Rights Reserved.