public abstract class AbstractGetPriceCmdImpl extends com.ibm.commerce.command.TaskCommandImpl implements GetContractUnitPriceCmd, GetProductContractUnitPriceCmd, GetContractSpecialPriceCmd
GetContractUnitPriceCmdImpl
.NAME
defaultCommandClassName, NAME
NAME
Constructor and Description |
---|
AbstractGetPriceCmdImpl()
Constructor for PriceRuleGetContractUnitPriceCmdImpl.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Long[] |
getApplicableTradingIds()
Returns the identifiers of the trading agreements that were used to
determine the prices for a catalog entry.
|
MonetaryAmount[] |
getApplicableTradingUnitPrices()
Returns the prices that were determined for each of the applied trading
agreements for a catalog entry.
|
MonetaryAmount |
getBasePrice()
Returns the best price of the input catalog entry before any currency
conversions.
|
CatEntryPrices[] |
getCatEntryPrices()
Returns the price related information for the input catalog entries.
|
com.ibm.commerce.order.objects.OfferAccessBean |
getOffer()
Returns the offer access bean that was used to determine the price.
|
java.lang.Long |
getOfferId()
Returns the identifier of the offer that was used to determine the price.
|
MonetaryAmount |
getPrice()
Returns the best price of the catalog entry in the requested currency.
|
java.lang.Integer |
getStoreId()
Returns the store that was set by the user, or from the command context
if the user did not set one.
|
java.lang.Long |
getTcId()
Returns the identifier of the term condition which was used to calculate
the best price.
|
java.lang.Long |
getTradingId()
Returns the identifier of the trading agreement which was used to
calculate the best price.
|
void |
reset()
Resets this command so that it is in its default state.
|
void |
setCatEntryId(java.lang.Long newCatEntryID)
Sets the identifier of the catalog entry whose price is to be calculated.
|
void |
setCatEntryPrices(CatEntryPrices[] newCatEntries)
Sets the information of one or more catalog entries whose prices are to
be calculated.
|
void |
setCurrency(java.lang.String newCurrency)
Sets the desired currency to be used for the output price.
|
void |
setErrorMode(boolean newThrowPriceExceptions)
Sets whether an exception will be thrown when the price cannot be found
for the input catalog entry.
|
void |
setMemberId(java.lang.Long newMemberID)
Sets the member identifier to be used for determining which trading
agreements are valid to use to calculate the price.
|
void |
setOfferIds(java.lang.Long[] newOfferIDs)
Sets the identifiers of the input offers to be used for price.
|
void |
setOrderItemAccessBean(com.ibm.commerce.order.objects.OrderItemAccessBean orderItemAccessBean)
Set an order item.
|
void |
setOrganizationId(java.lang.Long newOrganizationID)
Sets the organization identifier to be used in conjunction with the
member identifier for verifying and searching
for trading agreements. |
void |
setQuantity(QuantityAmount newQuantity)
Sets the quantity of the input catalog entry that is to be priced.
|
void |
setStoreId(java.lang.Integer newStoreID)
Sets the identifier of the store to be used for calculating the price.
|
void |
setTradingIds(java.lang.Long[] newTradingIDs)
Sets the identifiers of the input trading agreements.
|
void |
validateParameters()
Checks that there is a store ID, currency, and either a single mode
catalog entry or one or more batch mode catalog entries.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getUser, getUserId, isReadyToCallExecute, performExecute, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getUser, getUserId, performExecute, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
public AbstractGetPriceCmdImpl()
public java.lang.Long[] getApplicableTradingIds()
GetContractUnitPriceCmd
If this command is used in single mode, these identifiers will reflect the trading agreements that were specified for that catalog entry. If this command is used in batch mode, then these identifiers will reflect the trading agreements that were used for the first catalog entry in the input array.
getApplicableTradingIds
in interface GetContractSpecialPriceCmd
getApplicableTradingIds
in interface GetContractUnitPriceCmd
getApplicableTradingIds
in interface GetProductContractUnitPriceCmd
GetContractUnitPriceCmd.getPrice()
returns null.public MonetaryAmount[] getApplicableTradingUnitPrices()
GetContractUnitPriceCmd
GetContractUnitPriceCmd.getApplicableTradingIds()
.
If this command is used in single mode, these prices will reflect the prices that were found for the input catalog entry. If this command is used in batch mode, then these prices will reflect the prices that were used for the first catalog entry in the input array.
getApplicableTradingUnitPrices
in interface GetContractSpecialPriceCmd
getApplicableTradingUnitPrices
in interface GetContractUnitPriceCmd
getApplicableTradingUnitPrices
in interface GetProductContractUnitPriceCmd
GetContractUnitPriceCmd.getPrice()
returns null.public MonetaryAmount getBasePrice()
GetContractUnitPriceCmd
If this command is used in single mode, this price will be for the input catalog entry. If this command is used in batch mode, then this price will be for the first catalog entry in the input array.
getBasePrice
in interface GetContractSpecialPriceCmd
getBasePrice
in interface GetContractUnitPriceCmd
getBasePrice
in interface GetProductContractUnitPriceCmd
public CatEntryPrices[] getCatEntryPrices()
GetContractUnitPriceCmd
The following values reflect information about the best price for the catalog entry:
CatEntryPrices.getTradingId()
CatEntryPrices.getTcId()
CatEntryPrices.getOfferId()
CatEntryPrices.getOffer()
CatEntryPrices.getBasePrice()
CatEntryPrices.getUnitPrice()
The following values reflect information about all prices for the catalog entry:
CatEntryPrices.getAllTradingIds()
CatEntryPrices.getTradingTcIds()
CatEntryPrices.getOfferIds()
CatEntryPrices#getOffers()
CatEntryPrices.getTradingBasePrices()
CatEntryPrices.getTradingUnitPrices()
If this command is used in single mode, this array will contain one element corresponding to the input catalog entry. If this command is used in batch mode, then this array will contain the same catalog entry information, in the same order, as the input array.
In the latter case, the array itself is not guaranteed to be the same as the input array, and the elements are not guaranteed to be the same as those in the input array. However, for optimization purposes, they may be the same array and elements. In other words, users of this command should make no assumptions that the input array and elements are the same or different from the returned array.
getCatEntryPrices
in interface GetContractSpecialPriceCmd
getCatEntryPrices
in interface GetContractUnitPriceCmd
getCatEntryPrices
in interface GetProductContractUnitPriceCmd
GetContractUnitPriceCmd.setCatEntryPrices(com.ibm.commerce.price.commands.CatEntryPrices[])
for information on the input array.public com.ibm.commerce.order.objects.OfferAccessBean getOffer()
GetContractUnitPriceCmd
If this command is used in single mode, this offer will be for the input catalog entry. If this command is used in batch mode, then this offer will be for the first catalog entry in the input array.
getOffer
in interface GetContractSpecialPriceCmd
getOffer
in interface GetContractUnitPriceCmd
getOffer
in interface GetProductContractUnitPriceCmd
GetContractUnitPriceCmd.getPrice()
returns null.public java.lang.Long getOfferId()
GetContractUnitPriceCmd
If this command is used in single mode, this offer will be for the input catalog entry. If this command is used in batch mode, then this offer will be for the first catalog entry in the input array.
getOfferId
in interface GetContractSpecialPriceCmd
getOfferId
in interface GetContractUnitPriceCmd
getOfferId
in interface GetProductContractUnitPriceCmd
GetContractUnitPriceCmd.getPrice()
returns null.public MonetaryAmount getPrice()
GetContractUnitPriceCmd
If this command is used in single mode, this price will be for the input catalog entry. If this command is used in batch mode, then this price will be for the first catalog entry in the input array.
getPrice
in interface GetContractSpecialPriceCmd
getPrice
in interface GetContractUnitPriceCmd
getPrice
in interface GetProductContractUnitPriceCmd
error
mode
is set to true and no price was found.public java.lang.Integer getStoreId()
getStoreId
in interface com.ibm.commerce.command.ECCommand
getStoreId
in class com.ibm.commerce.command.AbstractECTargetableCommand
setStoreId(java.lang.Integer)
for details.public java.lang.Long getTcId()
GetContractUnitPriceCmd
If this command is used in single mode, this term condition will be for the input catalog entry. If this command is used in batch mode, then this term condition will be for the first catalog entry in the input array.
getTcId
in interface GetContractSpecialPriceCmd
getTcId
in interface GetContractUnitPriceCmd
getTcId
in interface GetProductContractUnitPriceCmd
GetContractUnitPriceCmd.getPrice()
returns null.public java.lang.Long getTradingId()
GetContractUnitPriceCmd
If this command is used in single mode, this trading agreement will be for the input catalog entry. If this command is used in batch mode, then this trading agreement will be for the first catalog entry in the input array.
getTradingId
in interface GetContractSpecialPriceCmd
getTradingId
in interface GetContractUnitPriceCmd
getTradingId
in interface GetProductContractUnitPriceCmd
GetContractUnitPriceCmd.getPrice()
returns null.public void reset()
GetContractUnitPriceCmd
The original definition of this method described in
com.ibm.websphere.command.Command.reset()
requires that this
method sets the output properties to the values they had before the
execute() method was run. The original definition also requires that
after calling this method, isReadyToCallExecute() method returns true.
In addition to the above, this command requires that input parameters must also be set to their original default values. For example, consider the following sequence of calls:
GetContractUnitPriceCmd cmd = ... cmd.setCatEntryId(id); cmd.reset(); cmd.setCatEntryPrices(catEntryPricesArray);After these calls are executed,
cmd
will behave as though
only setCatEntryPrices(CatEntryPrices[])
had been called.reset
in interface GetContractSpecialPriceCmd
reset
in interface GetContractUnitPriceCmd
reset
in interface GetProductContractUnitPriceCmd
reset
in class com.ibm.commerce.command.AbstractECTargetableCommand
public void setCatEntryId(java.lang.Long newCatEntryID)
GetContractUnitPriceCmd
GetContractUnitPriceCmd.setCatEntryPrices(CatEntryPrices[])
is called with a non-null
value, the catalog entries in that array will be used (which sets up this
command in batch mode) and will override the catalog entry set by this
method.
Either this method or GetContractUnitPriceCmd.setCatEntryPrices(CatEntryPrices[])
must
be called with non-null parameters before executing this command. The
default value is null.
setCatEntryId
in interface GetContractSpecialPriceCmd
setCatEntryId
in interface GetContractUnitPriceCmd
setCatEntryId
in interface GetProductContractUnitPriceCmd
newCatEntryID
- The identifier of the catalog entry whose price is to be
calculated. If null, single mode will not be enabled and
setting up batch mode by calling
GetContractUnitPriceCmd.setCatEntryPrices(CatEntryPrices[])
will be required.public void setCatEntryPrices(CatEntryPrices[] newCatEntries)
GetContractUnitPriceCmd
GetContractUnitPriceCmd.setCatEntryId(Long)
.
See GetContractUnitPriceCmd.setTradingIds(Long[])
for a description of how the trading
agreements in the CatEntryPrices
specified by this method
are used to determine price.
Either this method or GetContractUnitPriceCmd.setCatEntryId(Long)
must be called with
non-null parameters before executing this command. The default value is
null.
setCatEntryPrices
in interface GetContractSpecialPriceCmd
setCatEntryPrices
in interface GetContractUnitPriceCmd
newCatEntries
- The information of one or more catalog entries whose prices
are to be retrieved. If null, the value from
GetContractUnitPriceCmd.setCatEntryId(Long)
will be used. If empty, the
behavior of this command is undefined.public void setCurrency(java.lang.String newCurrency)
GetContractUnitPriceCmd
This input value is optional. The default value is obtained from another
source, such as
CurrencyManager#getCurrency(StoreAccessBean, String, Integer)
.
This currency will only be used in conjunction with
GetContractUnitPriceCmd.setCatEntryId(Long)
.
setCurrency
in interface GetContractSpecialPriceCmd
setCurrency
in interface GetContractUnitPriceCmd
setCurrency
in interface GetProductContractUnitPriceCmd
newCurrency
- The currency to look up the price. If null, the default value
will be used. If the supplied currency is empty or not
supported for the store, a default store currency will be
used.public void setErrorMode(boolean newThrowPriceExceptions)
GetContractUnitPriceCmd
This input value is optional. The default value is true.
setErrorMode
in interface GetContractSpecialPriceCmd
setErrorMode
in interface GetContractUnitPriceCmd
setErrorMode
in interface GetProductContractUnitPriceCmd
newThrowPriceExceptions
- True indicates an exception will be thrown when a price cannot
be found, false indicates exceptions will be ignored and
null
will be returned for the price instead.public void setMemberId(java.lang.Long newMemberID)
GetContractUnitPriceCmd
GetContractUnitPriceCmd.setTradingIds(Long[])
for details on how the trading agreements
are used.
This input value is optional. The default value is obtained from
CommandContext#getUserId()
.
setMemberId
in interface GetContractUnitPriceCmd
newMemberID
- The member identifier to be used to verify the input list of
trading agreements. If null, the default value will be used.public void setOfferIds(java.lang.Long[] newOfferIDs)
GetContractUnitPriceCmd
This input value is optional. The default value is the list of all
qualifying offers. These offers will only be used in conjunction with
GetContractUnitPriceCmd.setCatEntryId(Long)
.
setOfferIds
in interface GetContractSpecialPriceCmd
setOfferIds
in interface GetContractUnitPriceCmd
setOfferIds
in interface GetProductContractUnitPriceCmd
newOfferIDs
- The reference number of one or more offers that are to be used
for determining the price. If null or empty, then the "best"
of all qualifying offers will be used. Otherwise, the "best"
of the specified offers will be returned.public void setOrderItemAccessBean(com.ibm.commerce.order.objects.OrderItemAccessBean orderItemAccessBean)
GetContractSpecialPriceCmd
This value is never set or used, so implementors may safely do nothing.
setOrderItemAccessBean
in interface GetContractSpecialPriceCmd
orderItemAccessBean
- An order item access bean. May be null.public void setOrganizationId(java.lang.Long newOrganizationID)
GetContractUnitPriceCmd
member identifier
for verifying and searching
for trading agreements. This value will only be used when the member
identifier provided is different from the
CommandContext#getUserId()
.
This input value is optional. The default value is the
EntitlementContext#getActiveOrganizationId()
.
setOrganizationId
in interface GetContractUnitPriceCmd
newOrganizationID
- The organization identifier to be used in conjunction with the
member identifier to verify the input list of trading
agreements. If null, the default value will be used.public void setQuantity(QuantityAmount newQuantity)
GetContractUnitPriceCmd
For example, consider the table below:
Quantity range | Price per unit |
---|---|
1-5 | 10 USD |
6-10 | 9 USD |
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. See the CATENTSHIP
table for
more information. This behavior can be implemented by calling
RetrievePricesCmd
.
This input value is optional. The default value is the nominal quantity
for the catalog entry. This quantity will only be used in conjunction
with GetContractUnitPriceCmd.setCatEntryId(Long)
.
setQuantity
in interface GetContractSpecialPriceCmd
setQuantity
in interface GetContractUnitPriceCmd
setQuantity
in interface GetProductContractUnitPriceCmd
newQuantity
- The quantity amount of the catalog entry. If null, the nominal
quantity will be used as described above.public void setStoreId(java.lang.Integer newStoreID)
GetContractUnitPriceCmd
This input value is optional. The default value is
CommandContext#getStoreId()
.
setStoreId
in interface GetContractSpecialPriceCmd
setStoreId
in interface GetContractUnitPriceCmd
setStoreId
in interface GetProductContractUnitPriceCmd
newStoreID
- The reference number of a store to be used for calculating the
price. If null, the command context will be used to determine
the store.public void setTradingIds(java.lang.Long[] newTradingIDs)
GetContractUnitPriceCmd
Each member is entitled to a number of trading agreements (possibly
zero), depending on the member
and
store
. The trading agreements for each
catalog entry are provided in one of three ways (from highest to lowest
precedence):
GetContractUnitPriceCmd.setCatEntryPrices(CatEntryPrices[])
(each catalog entry can
have different trading agreements defined or none);
ContractCmdUtil#getCurrentTradingAgreements(CommandContext)
.
This input value is optional. The default value is null.
setTradingIds
in interface GetContractSpecialPriceCmd
setTradingIds
in interface GetContractUnitPriceCmd
setTradingIds
in interface GetProductContractUnitPriceCmd
newTradingIDs
- The identifiers of the trading agreements to be used to
determine the prices. If null or empty, the current or
entitled trading agreements will be used as described above.public void validateParameters() throws com.ibm.commerce.exception.ECException
validateParameters
in interface com.ibm.commerce.command.ECCommand
validateParameters
in class com.ibm.commerce.command.AbstractECTargetableCommand
com.ibm.commerce.exception.ECException
- If any of the required parameters is missing.