|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.commerce.command.AbstractECCommand | +--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.
Fields inherited from class com.ibm.commerce.command.AbstractECCommand |
commandContext |
Fields inherited from interface com.ibm.commerce.price.commands.GetContractUnitPriceCmd |
COPYRIGHT, NAME |
Fields inherited from interface com.ibm.commerce.command.ECCommand |
defaultCommandClassName |
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 |
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.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 |
public GetContractUnitPriceCmdImpl()
Method Detail |
protected void calculatePrices(java.lang.Integer storeId) throws ECException
public java.lang.Long[] getApplicableTradingIds()
getApplicableTradingIds
in interface GetContractUnitPriceCmd
public MonetaryAmount[] getApplicableTradingUnitPrices()
getApplicableTradingUnitPrices
in interface GetContractUnitPriceCmd
public MonetaryAmount getBasePrice()
getBasePrice
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
public CatEntryPrices[] getCatEntryPrices()
getCatEntryPrices
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
public OfferAccessBean getOffer()
getOffer
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
public java.lang.Long getOfferId()
getOfferId
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
public MonetaryAmount getPrice()
getPrice
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
public java.lang.Long getTcId()
getTcId
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
public java.lang.Long getTradingId()
getTradingId
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
public void performExecute() throws ECException
performExecute
in interface ECCommand
performExecute
in class AbstractECCommand
com.ibm.commerce.command.ECCommand
com.ibm.commerce.command.CommandException
- The superclass for all ECExceptions.public void reset()
reset
in class AbstractECCommand
protected java.util.Hashtable resolvePriceLists(BusinessPolicyAccessBean[] pricePolicyABs) throws ECException
pricePolicyABs
- the access beans of price business policies.
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).
ECApplicationException
- If no eligible trading agreements can be
obtained (ERR_NO_ELIGIBLE_TRADING).ECApplicationException
- If the specified trading agreement is not
valid (ERR_NO_VALID_TRADING).protected void retrievePrices() throws ECException
protected void selectPrices(java.lang.Integer storeId) throws ECException
public void setCatEntryId(java.lang.Long anCatEntryId)
setCatEntryId
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
anCatEntryId
- The reference number of a catalog entry whose price is to be
retrieved and calculated.public void setCatEntryPrices(CatEntryPrices[] aCatEntryPrices)
setCatEntryPrices
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
aCatEntryPrices
- The information of one or more catalog entries
whose prices are To be retrieved.public void setCurrency(java.lang.String astrCurrency)
setCurrency
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
astrCurrency
- The currency to look up 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).public void setErrorMode(boolean aErrorMode)
setErrorMode
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
aErrorMode
- The indicator to decide if an exception will be thrown when the
price cannot be found.
A true value (default) means throw exception.
A false value means do not throw exception and returns a null value pricepublic void setMemberId(java.lang.Long anMemberId)
setMemberId
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
anMemberId
- The member id to be used to verify the input list of trading
agreements, if provided. The input list of trading agreements, will be validated
against the eligible list which can be either obtained directly from the
Command Context or looked up by means of the member id if such id is
different from the one in the Command Context. If no trading agreement
is input, the member id will then be used to look up the list of trading
agreements.public void setOfferIds(java.lang.Long[] aOfferIds)
setOfferIds
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
aOfferIds
- The reference number of one or more offers that are Sto be used
for determining the price. If no offer ids are supplied, then the "best" of
all qualifying offers will be used. Otherwise, the "best" of the specified
offers will be returned.public void setOrderItemAccessBean(OrderItemAccessBean aOrderItemAB)
setOrderItemAccessBean
in interface GetContractSpecialPriceCmd
aOrderItemAB
- an order item access bean.public void setQuantity(QuantityAmount aQuantityAmount)
setQuantity
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
aQuantityAmount
- The quantity amount of the catalog entry.
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.public void setStoreId(java.lang.Integer aStoreId)
setStoreId
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
aStoreId
- The reference number of a store to be used for calculating the
price. If the store id is not specified then the store id of the command context
will be used.public void setTradingIds(java.lang.Long[] aTradingIds)
setTradingIds
in interface GetContractUnitPriceCmd
com.ibm.commerce.price.commands.GetContractUnitPriceCmd
aTradingIds
- The reference numbers of a list of trading agreements to be used
to determine the offers that will supply the prices and the adjustments to be applied
to the prices.public void validateParameters() throws ECException
validateParameters
in interface ECCommand
validateParameters
in class AbstractECCommand
com.ibm.commerce.command.ECCommand
ECException.
-
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |