java.lang.Object | +--CacheableCommandImpl | +--com.ibm.commerce.command.AbstractECTargetableCommand | +--com.ibm.commerce.command.TaskCommandImpl | +--com.ibm.commerce.price.commands.GetContractUnitPriceCmdImpl
This GetContractUnitPriceCmd
Task Command Implementation can be
called by several commands such as ProductDisplayCmd
,
OrderItemAddCmd
, OrderItemUpdateCmd
,
OrderItemDisplayCmd
and OrderPrepareCmd
,Controller
Command to calculate the best contract price for a catalog entry given a list
of trading agreements (and offers) and also for each of these trading
agreements, obtain its best contract price.
If the command is successful retrieving the price, it will return the best price, the offer id and access bean, 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, each offer to
be retrieved to find the price of a catalog entry must satisfy the following
criteria (Invoke CalculateContractPricesCmd
):
Get the best price among all the qualified offers for the input catalog
entry (Invoke SelectContractPricesCmd
):
Exception Conditions
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
Field Summary |
---|
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand |
commandContext |
Fields inherited from interface com.ibm.commerce.price.commands. GetContractUnitPriceCmd |
COPYRIGHT,
NAME |
Fields inherited from interface com.ibm.commerce.price.commands. GetContractSpecialPriceCmd |
COPYRIGHT,
NAME |
Fields inherited from interface com.ibm.commerce.price.commands. GetProductContractUnitPriceCmd |
COPYRIGHT,
defaultCommandClassName,
NAME |
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand |
COPYRIGHT |
Fields inherited from interface com.ibm.commerce.command. ECCommand |
defaultCommandClassName |
Constructor Summary | |
---|---|
GetContractUnitPriceCmdImpl() GetBaseUnitPriceCmdImpl constructor. |
Method Summary | |
---|---|
protected
void |
calculatePrices(java.lang.Integer storeId) Retrieves all the qualified offers for the input catalog entry in that each offer must meet a list of criteria. |
java.lang.Long[] |
getApplicableTradingIds() Returns the ids of the trading agreements that are used to determine the prices. |
MonetaryAmount[] |
getApplicableTradingUnitPrices() Returns the unit prices of a catentry that were determined for each of the applied trading agreements. |
MonetaryAmount |
getBasePrice() Returns the base price of the input catalog entry. |
CatEntryPrices[] |
getCatEntryPrices() Returns the price related information of the input catalog entries. |
OfferAccessBean |
getOffer() Returns the offer access bean that was used to determine the price. |
java.lang.Long |
getOfferId() Returns the id of the output offer id that was used to determine the price. |
MonetaryAmount |
getPrice() 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. |
protected
java.util.Hashtable |
resolvePriceLists(
BusinessPolicyAccessBean[] pricePolicyABs) Resolve the price lists referenced by a list of price business policies. |
protected
boolean |
resolveTradingAgreements() Verifies and resolves a list of eligible trading agreements for the user. |
protected
void |
retrievePrices() Retrieves all the qualified offers for the input catalog entry in that each offer must meet a list of criteria. |
protected
void |
selectPrices(java.lang.Integer storeId) Selects the best offer for the input catalog entry among a list of qualified offers. |
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 (Future Support). |
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(
OrderItemAccessBean aOrderItemAB) Sets the orderitem Access Bean. |
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 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 |
Constructor Detail |
---|
public GetContractUnitPriceCmdImpl()
Method Detail |
---|
protected void calculatePrices(java.lang.Integer storeId) throws ECException
storeId
- Integer of the a Store IDECException
public java.lang.Long[] getApplicableTradingIds()
getApplicableTradingIds
in interface
GetContractUnitPriceCmd
public MonetaryAmount[] getApplicableTradingUnitPrices()
getApplicableTradingUnitPrices
in interface
GetContractUnitPriceCmd
public MonetaryAmount getBasePrice()
getBasePrice
in interface
GetContractUnitPriceCmd
public CatEntryPrices[] getCatEntryPrices()
getCatEntryPrices
in interface
GetContractUnitPriceCmd
public OfferAccessBean getOffer()
getOffer
in interface
GetContractUnitPriceCmd
public java.lang.Long getOfferId()
getOfferId
in interface
GetContractUnitPriceCmd
public MonetaryAmount getPrice()
getPrice
in interface
GetContractUnitPriceCmd
public java.lang.Long getTcId()
getTcId
in interface
GetContractUnitPriceCmd
public java.lang.Long getTradingId()
getTradingId
in interface
GetContractUnitPriceCmd
public void performExecute() throws ECException
performExecute
in interface
ECCommand
performExecute
in class
AbstractECTargetableCommand
ECException
public void reset()
reset
in class
AbstractECTargetableCommand
protected java.util.Hashtable resolvePriceLists(BusinessPolicyAccessBean[] pricePolicyABs) throws ECException
pricePolicyABs
- the access beans of price business policies.
ECException
protected boolean resolveTradingAgreements() throws ECException
If trading agreements are specified, the input list will be verified against the eligible list when the member id is provided. The eligible list of trading agreements can be obtained from the Command Context if the input member id is the one in Command Context.
If trading agreements are not specified, the list may be obtained directly from the Command Context (if no member id is provided or the input member id is the one in Command Context) or retrieved by means of the member id (if the id is provided and is different from that in the Command Context).
ECException
- If no eligible trading agreements can be obtained
(ERR_NO_ELIGIBLE_TRADING).protected void retrievePrices() throws ECException
ECException
protected void selectPrices(java.lang.Integer storeId) throws ECException
storeId
- the store IDECException
public void setCatEntryId(java.lang.Long anCatEntryId)
setCatEntryId
in interface
GetContractUnitPriceCmd
anCatEntryId
- the catEntry IDpublic void setCatEntryPrices(CatEntryPrices[] aCatEntryPrices)
setCatEntryPrices
in interface
GetContractUnitPriceCmd
aCatEntryPrices
- the array of
CatEntryPricespublic void setCurrency(java.lang.String astrCurrency)
setCurrency
in interface
GetContractUnitPriceCmd
astrCurrency
- the currencypublic void setErrorMode(boolean aErrorMode)
setErrorMode
in interface
GetContractUnitPriceCmd
aErrorMode
- true if throw exceptionspublic void setMemberId(java.lang.Long anMemberId)
setMemberId
in interface
GetContractUnitPriceCmd
anMemberId
- the member IDpublic void setOfferIds(java.lang.Long[] aOfferIds)
setOfferIds
in interface
GetContractUnitPriceCmd
aOfferIds
- all offer IDspublic void setOrderItemAccessBean(OrderItemAccessBean aOrderItemAB)
setOrderItemAccessBean
in interface
GetContractSpecialPriceCmd
aOrderItemAB
- an order item access bean.public void setQuantity(QuantityAmount aQuantityAmount)
setQuantity
in interface
GetContractUnitPriceCmd
aQuantityAmount
- the quantitypublic void setStoreId(java.lang.Integer aStoreId)
setStoreId
in interface
GetContractUnitPriceCmd
aStoreId
- the store IDpublic void setTradingIds(java.lang.Long[] aTradingIds)
setTradingIds
in interface
GetContractUnitPriceCmd
aTradingIds
- an array of trading IDspublic void validateParameters() throws ECException
validateParameters
in interface
ECCommand
validateParameters
in class
AbstractECTargetableCommand
ECException