java.lang.Object | +--CacheableCommandImpl | +--com.ibm.commerce.command.AbstractECTargetableCommand | +--com.ibm.commerce.command.TaskCommandImpl | +--com.ibm.commerce.price.commands.CalculateContractPricesCmdImpl
This CalculateContractPricesCmd
Task Command Implementation
retrieves all the qualified contract prices and calculates the price adjustment
specified by the contract for one or more catalog entries.
If the command is successful in retreiving offers, it will return a list of qualified offers that provide the offer prices which have been adjusted according the corresponding Ts&Cs defined in the trading agreements.
If unsuccessful, it wil return an empty list.
Behaviour
Obtain all the qualified offers for each catalog entries, each offer to be retrieved to find the price of a catalog entry must satisfy certain criteria.
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.
Select the best adjustments for each of the offers. The price adjustments are retrieved from those Ts&Cs which references the price list containing the offer.
Calculate the price adjustments for each of the offers.
This command calls the following TaskCommands:
This command uses the following AccessBeans:
StoreAccessBean
CatalogEntryShippingAccessBean
TradingAgreementAccessBean
OfferAccessBean
OfferPriceAccessBean
ProductSetCeRelAccessBean
CatalogEntryAccessBean
TermConditionAccessBean
PriceTCMasterCatalogWithOptionalAdjustmentAccessBean
PriceTCMasterCatalogWithFilteringAccessBean
PriceTCPriceListWithOptionalAdjustmentAccessBean
PriceTCPriceListWithSelectiveAdjustmentAccessBean
Field Summary | |
---|---|
static java.lang.String |
COPYRIGHT IBM copyright notice field. |
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand |
commandContext |
Fields inherited from interface com.ibm.commerce.price.commands. CalculateContractPricesCmd |
defaultCommandClassName,
NAME |
Fields inherited from interface com.ibm.commerce.command. ECCommand |
defaultCommandClassName |
Constructor Summary | |
---|---|
CalculateContractPricesCmdImpl() Constructor |
Method Summary | |
---|---|
protected
QualifyingOfferInfo |
calculatePriceAdjustment(
QualifyingOfferInfo aOfferInfo,
PriceTC aBestPriceTC) Calculates the result price by applying the best T&C price adjustment to the offer price. |
protected
java.lang.String |
getCurrency() Returns the currency to be used for the price. |
ItemPriceInfo[] |
getItemPriceInfo() Returns the internal item info structure. |
protected
java.util.Vector |
getOfferPrices(java.lang.Long anOfferId) Returns the OfferPrices of the specified Offer. |
void |
performExecute() Executes main business logic of the command. |
protected
PriceTC |
selectPriceAdjustment(java.lang.Long aItem,
java.util.Vector aTcInfoVec) Selects the best adjustments for a catalog entry. |
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 |
setItemPriceInfo(
ItemPriceInfo[] aItemPriceInfo) Sets the item info structure for internal use on calculating the prices. |
void |
setMasterCatalogPriceListIds(java.lang.Long[] aMasterpriceListIds) Sets the ids the price list associated with the Master Catalog (Optional). |
void |
setPriceListIds(java.lang.Long[] aPriceListIds) Sets the ids of the input price lists to be used for retrieving the offers. |
void |
setStoreId(java.lang.Integer aStoreId) Sets the id of the input store to be used for calculating the price (Optional). |
void |
setTradingABs(
TradingAgreementAccessBean[] aTradingABs) Sets the input trading agreement access beans for determining the contract prices. |
void |
setUseGlobalPriceList(boolean aUseGlobalPriceList) Sets the flag to indicate if the list of input price lists can be used globally for retrieving the offers for all of the input catentries (Optional). |
void |
validateParameters() Checks 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,
reset,
setAccCheck,
setCommandContext,
setCommandIfName,
setCommandStoreId,
setDefaultProperties |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait,
wait, wait |
Field Detail |
---|
public static final java.lang.String COPYRIGHT
Constructor Detail |
---|
public CalculateContractPricesCmdImpl()
Method Detail |
---|
protected QualifyingOfferInfo calculatePriceAdjustment(QualifyingOfferInfo aOfferInfo, PriceTC aBestPriceTC) throws ECException
aOfferInfo
- the offer info structure providing the offer id
and saving the result price.aBestPriceTC
- the T&C providing the best price
adjustment.ECException
protected java.lang.String getCurrency()
public ItemPriceInfo[] getItemPriceInfo()
getItemPriceInfo
in interface
CalculateContractPricesCmd
public void performExecute() throws ECException
performExecute
in interface
ECCommand
performExecute
in class
AbstractECTargetableCommand
ECException
protected PriceTC selectPriceAdjustment(java.lang.Long aItem, java.util.Vector aTcInfoVec) throws ECException
aItem
- the catalog entry for searching the adjustment product
set.aTcInfoVec
- Ts&Cs containing the adjustment and
adjustment product set.
ECException
public void setCurrency(java.lang.String astrCurrency)
setCurrency
in interface
CalculateContractPricesCmd
astrCurrency
- a currencypublic void setErrorMode(boolean aErrorMode)
setErrorMode
in interface
CalculateContractPricesCmd
aErrorMode
- the exception will be thrown if set
true.public void setItemPriceInfo(ItemPriceInfo[] aItemPriceInfo)
setItemPriceInfo
in interface
CalculateContractPricesCmd
aItemPriceInfo
- a ItemPriceInfo structure for internal
usepublic void setMasterCatalogPriceListIds(java.lang.Long[] aMasterpriceListIds)
setMasterCatalogPriceListIds
in interface
CalculateContractPricesCmd
aMasterpriceListIds
- an array of master
pricelistspublic void setPriceListIds(java.lang.Long[] aPriceListIds)
setPriceListIds
in interface
CalculateContractPricesCmd
aPriceListIds
- an array of pricelist Idspublic void setStoreId(java.lang.Integer aStoreId)
setStoreId
in interface
CalculateContractPricesCmd
aStoreId
- the ID of the input storepublic void setTradingABs(TradingAgreementAccessBean[] aTradingABs)
setTradingABs
in interface
CalculateContractPricesCmd
aTradingABs
- a set of Trading agreement access
beanspublic void setUseGlobalPriceList(boolean aUseGlobalPriceList)
setUseGlobalPriceList
in interface
CalculateContractPricesCmd
aUseGlobalPriceList
- The indicator to decide if the price
lists can be used globally. A true value (default) means apply the price lists
globally. A false value means individual set of price lists should be obtained
for each catentry (Future Support).public void validateParameters() throws ECException
validateParameters
in interface
ECCommand
validateParameters
in class
AbstractECTargetableCommand
ECException
protected java.util.Vector getOfferPrices(java.lang.Long anOfferId) throws ECException
anOfferId
- the Offer ID.ECException