com.ibm.commerce.price.commands
Class GetBaseUnitPriceCmdImpl
- 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.GetBaseUnitPriceCmdImpl
-
- All Implemented Interfaces:
- com.ibm.commerce.command.CacheableECCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, com.ibm.commerce.command.TaskCommand, GetBaseSpecialPriceCmd, GetBaseUnitPriceCmd, GetProductBaseUnitPriceCmd, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command
public class GetBaseUnitPriceCmdImpl extends com.ibm.commerce.command.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 has no member groups associated with it. Or that 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 precedence 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:
StoreAccessBean
CatalogEntryShippingAccessBean
OfferAccessBean
OfferPriceAccessBean
CatalogEntryAccessBean
ServerJDBCHelperBean
UserAccessBean
MemberGroupMemberAccessBean
-
-
Field Summary
-
Fields inherited from interface com.ibm.commerce.price.commands.GetBaseUnitPriceCmd
defaultCommandClassName, ERR_CODE_NO_PRICE, ERRTASK_NAME, NAME
-
Fields inherited from interface com.ibm.commerce.price.commands.GetBaseSpecialPriceCmd
defaultCommandClassName, ERR_CODE_NO_PRICE, ERRTASK_NAME, NAME
-
Fields inherited from interface com.ibm.commerce.price.commands.GetProductBaseUnitPriceCmd
defaultCommandClassName, ERR_CODE_NO_PRICE, ERRTASK_NAME, NAME
-
-
Constructor Summary
Constructors Constructor and Description GetBaseUnitPriceCmdImpl()
GetBaseUnitPriceCmdImpl constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description 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.com.ibm.commerce.order.objects.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(com.ibm.commerce.order.objects.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 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.ECCommand
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, 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 interfaceGetBaseSpecialPriceCmd
- Specified by:
getBasePrice
in interfaceGetBaseUnitPriceCmd
- Specified by:
getBasePrice
in interfaceGetProductBaseUnitPriceCmd
- Returns:
- the base price of the product.
-
getContractIds
public java.lang.Long[] getContractIds() throws com.ibm.commerce.exception.ECSystemException
Get the contract IDs associated with the offer that supplied the price.- Specified by:
getContractIds
in interfaceGetBaseSpecialPriceCmd
- Specified by:
getContractIds
in interfaceGetBaseUnitPriceCmd
- Specified by:
getContractIds
in interfaceGetProductBaseUnitPriceCmd
- Returns:
- the contract ID(s).
- Throws:
com.ibm.commerce.exception.ECSystemException
-
getExpiryDateForCache
public java.sql.Timestamp getExpiryDateForCache() throws com.ibm.commerce.exception.ECSystemException
Get the expiry date of the price. The expiry date of the price may be influenced by any other offers 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 interfaceGetBaseSpecialPriceCmd
- Specified by:
getExpiryDateForCache
in interfaceGetBaseUnitPriceCmd
- Specified by:
getExpiryDateForCache
in interfaceGetProductBaseUnitPriceCmd
- Returns:
- the expiry date.
- Throws:
com.ibm.commerce.exception.ECSystemException
-
getOffer
public com.ibm.commerce.order.objects.OfferAccessBean getOffer()
Get the offer access bean that was used to determine the price.- Specified by:
getOffer
in interfaceGetBaseSpecialPriceCmd
- Specified by:
getOffer
in interfaceGetBaseUnitPriceCmd
- Specified by:
getOffer
in interfaceGetProductBaseUnitPriceCmd
- 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 interfaceGetBaseSpecialPriceCmd
- Specified by:
getOfferId
in interfaceGetBaseUnitPriceCmd
- Specified by:
getOfferId
in interfaceGetProductBaseUnitPriceCmd
- 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 interfaceGetBaseSpecialPriceCmd
- Specified by:
getPrice
in interfaceGetBaseUnitPriceCmd
- Specified by:
getPrice
in interfaceGetProductBaseUnitPriceCmd
- Returns:
- the price of the catalog entry Id.
-
performExecute
public void performExecute() throws com.ibm.commerce.exception.ECException
Execute the command.- Specified by:
performExecute
in interfacecom.ibm.commerce.command.ECCommand
- Overrides:
performExecute
in classcom.ibm.commerce.command.AbstractECTargetableCommand
- Throws:
com.ibm.commerce.exception.ECException
-
reset
public void reset()
reset the command.- Overrides:
reset
in classcom.ibm.commerce.command.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 interfaceGetBaseSpecialPriceCmd
- Specified by:
setCatEntryId
in interfaceGetBaseUnitPriceCmd
- Specified by:
setCatEntryId
in interfaceGetProductBaseUnitPriceCmd
- 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 interfaceGetBaseSpecialPriceCmd
- Specified by:
setContractIds
in interfaceGetBaseUnitPriceCmd
- Specified by:
setContractIds
in interfaceGetProductBaseUnitPriceCmd
- 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 interfaceGetBaseSpecialPriceCmd
- Specified by:
setCurrency
in interfaceGetBaseUnitPriceCmd
- Specified by:
setCurrency
in interfaceGetProductBaseUnitPriceCmd
- 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 interfaceGetBaseSpecialPriceCmd
- Specified by:
setOfferIds
in interfaceGetBaseUnitPriceCmd
- Specified by:
setOfferIds
in interfaceGetProductBaseUnitPriceCmd
- Parameters:
anOfferIdList
- the offer IDs.
-
setOrderItemAccessBean
public void setOrderItemAccessBean(com.ibm.commerce.order.objects.OrderItemAccessBean anOrderItemAccessBean)
(Optional) Set the order item.- Specified by:
setOrderItemAccessBean
in interfaceGetBaseSpecialPriceCmd
- 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 interfaceGetBaseSpecialPriceCmd
- Specified by:
setQuantity
in interfaceGetBaseUnitPriceCmd
- Specified by:
setQuantity
in interfaceGetProductBaseUnitPriceCmd
- 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 interfaceGetBaseSpecialPriceCmd
- Specified by:
setStoreId
in interfaceGetBaseUnitPriceCmd
- Specified by:
setStoreId
in interfaceGetProductBaseUnitPriceCmd
- Parameters:
aStoreId
- the store Id.
-
validateParameters
public void validateParameters() throws com.ibm.commerce.exception.ECException
Check mandatory parameters.- Specified by:
validateParameters
in interfacecom.ibm.commerce.command.ECCommand
- Overrides:
validateParameters
in classcom.ibm.commerce.command.AbstractECTargetableCommand
- Throws:
com.ibm.commerce.exception.ECException
-
-