public class PriceCalculationHelper
extends java.lang.Object
PriceCalculationHelper
Class provides utility methods for
performing the price calculation.Modifier and Type | Field and Description |
---|---|
static java.math.BigDecimal |
BIG_DECIMAL_ZERO
String of big decimal "0"
|
static java.lang.String |
CONFIGURATOR_BOM_XML_ATTRIBUTE_PRICELOCK
The
Price attribute in the ConfiguratorBOM XML generated from Sterling Dynamic Kit Configurator. |
static java.lang.String |
CONFIGURATOR_BOM_XML_ATTRIBUTE_PRICELOCK_DEFAULTVALUE
The default price lock of the component and dynamickit in the ConfiguratorBOM XML.
|
static java.lang.String |
CONFIGURATOR_BOM_XML_ATTRIBUTE_SKU
The
SKU attribute in the ConfiguratorBOM XML generated from Sterling Dynamic Kit Configurator. |
static java.lang.String |
CONFIGURATOR_BOM_XML_ELEMENT_LINE_ITEM
The
LineItem element name in the ConfiguratorBOM XML generated from Sterling Dynamic Kit Configurator. |
static java.lang.String |
CONFIGURATOR_BOM_XML_NODE_CONFIGURATOR_BOM |
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.lang.Double |
DOUBLE_ZERO
String of "0" for double type
|
static java.lang.String |
ERRTASK_NAME
String of RetrievePriceErrorView
|
static java.lang.Integer |
INTEGER_ZERO
String of "0" for integer type
|
static java.lang.Long |
LONG_ZERO
String of "0" for Long type
|
static java.lang.Object |
NULL
String of object NULL
|
Constructor and Description |
---|
PriceCalculationHelper()
PriceCalculationHelper constructor comment.
|
Modifier and Type | Method and Description |
---|---|
void |
createPriceBusinessPolicy(java.lang.String aPriceListName,
java.lang.Long aPriceListOwner,
java.lang.Integer aStoreEntityId,
java.lang.String aPolicyName)
Creates a price business policy.
|
void |
deletePriceBusinessPolicy(java.lang.String aPriceListId,
java.lang.Integer aStoreEntityId)
Deletes a price business policy.
|
java.lang.Long[] |
findAllMasterCatalogPriceLists(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB)
Retrieves the price lists associated with master catalog (Fast Method).
|
java.lang.String |
genMarkers(int num)
Generates parameter markers for the IN search predicate.
|
java.lang.Long[] |
getAllMasterCatalogPriceLists(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB)
Retrieves the price lists associated with master catalog (Alternative Method).
|
java.util.Hashtable |
getAllPolicyPriceLists(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB)
Retrieves the price list business policies.
|
java.util.Hashtable |
getAllPolicyPriceProperties(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB)
Retrieves the price list business policy properties.
|
java.util.Vector |
getAllStandardPriceListAccessBeans()
Retrieves the standard price list access beans.
|
java.util.Vector |
getAllStandardPriceLists()
Retrieves the ids of standard price list.
|
MonetaryAmount |
getDynamicKitConfigurationPriceWithPredefinedConfiguration(java.lang.String aCurrency,
java.lang.Long tradingId,
com.ibm.commerce.order.objects.OrderItemAccessBean oiab,
java.lang.Long dynamicKitCatalogEntryId,
java.lang.Long dynamicKitPredefinedConfigurationId,
MonetaryAmount predefinedConfigurationPrice,
com.ibm.commerce.command.CommandContext commandContext)
Returns the cost of the dynamic kit configuration represented by the
passed OrderItemAccessBean, oiab using the starting point represented by
startPointOfferAccessBean.
|
MonetaryAmount |
getDynamicKitPrice(java.lang.String aCurrency,
com.ibm.commerce.command.CommandContext aCommandContext,
java.lang.String astrConfigurationId,
com.ibm.commerce.order.objects.OrderItemAccessBean aabOrderItem)
get dynamic kit price
|
MonetaryAmount |
getDynamicKitPrice(java.lang.String aCurrency,
com.ibm.commerce.command.CommandContext aCommandContext,
java.lang.String astrConfigurationId,
com.ibm.commerce.order.objects.OrderItemAccessBean aabOrderItem,
java.util.Vector avecOrderItemComponents)
get dynamic kit price
|
MonetaryAmount |
getDynamicKitPrice(java.lang.String aCurrency,
com.ibm.commerce.command.CommandContext aCommandContext,
java.lang.String astrConfigurationId,
com.ibm.commerce.order.objects.OrderItemAccessBean aabOrderItem,
java.util.Vector avecOrderItemComponents,
java.lang.Long[] tradingIds)
Calls getDynamicKitPrice(aCurrency, aCommandContext, astrConfigurationId, aabOrderItem, avecOrderItemComponents, tradingIds, true) to find the dynamic kit price using starting points.
|
MonetaryAmount |
getDynamicKitPrice(java.lang.String aCurrency,
com.ibm.commerce.command.CommandContext aCommandContext,
java.lang.String astrConfigurationId,
com.ibm.commerce.order.objects.OrderItemAccessBean aabOrderItem,
java.util.Vector avecOrderItemComponents,
java.lang.Long[] tradingIds,
boolean useStartingPoint,
java.lang.Long dynamicKitPredefinedConfigurationId)
get dynamic kit price
|
java.lang.String |
getInPredicate(java.lang.Object[] objects)
Composes the IN search predicate.
|
static PriceCalculationHelper |
getInstance()
Get PriceCalculationHelper instance
|
java.lang.Long |
getMemberIdFromPrcPolicyProperties(com.ibm.commerce.datatype.TypedProperty aparam)
Get member Id from properties retrieved from price policy
|
com.ibm.commerce.order.objects.OfferPriceAccessBean |
getNominalCost(java.lang.Long aCatEntryID,
java.lang.Long aTpcID,
java.lang.Integer aStoreID)
Retrieve the nominal cost in the form of OfferPriceAccessBean for the input data:
i) a given catalog entry ID (mandatory),
ii) the nominal cost pricelist ID (optional),
iii) the store ID (mandatory).
|
java.util.List |
getNominalCostOfferABs(java.lang.Long aCatEntryID,
java.lang.Long aTpcID,
java.lang.Integer aStoreID)
Retrieve the nominal cost in the form of OfferAccessBean for the input data:
i) a given catalog entry ID (mandatory),
ii) the nominal cost pricelist ID (optional),
iii) the store ID (mandatory).
|
java.lang.Long |
getNominalCostPriceList(java.lang.Integer aStoreID)
Retrieve the nominal cost pricelist ID for a given store (there is one and only one pricelist).
|
java.lang.String |
getPolicyPriceList(java.lang.String aPolicyProperties)
Retrieves the price list associated with a policy.
|
java.lang.String |
getPolicyProductSet(java.lang.String aPolicyProperties)
Retrieves the product set associated with a policy.
|
java.lang.String |
getPriceListType(java.lang.String properties)
Determine the type of the pricelist based on the value of PROPERTIES attribute of a policy entity.
|
PricedDynamicKitPredefinedConfiguration |
getStartingOfferAndPriceOfPredefinedConfigurationFromTradingAgreement(java.lang.Long tradingId,
java.lang.Long dynamicKitCatalogEntryId,
java.lang.Long dynamicKitPredefinedConfigurationId,
java.lang.Double quantity,
java.lang.String currency,
com.ibm.commerce.common.objects.StoreAccessBean storeAB)
Returns the starting price of a predefined configuration of a dynamic kit.
|
void |
handlePriceNotFoundException(ItemPriceInfo aItemPriceInfo,
java.lang.String aCurrency,
java.lang.String aClassName)
Handles the price not found exception.
|
boolean |
isBestPrice(QualifyingOfferInfo offerInfo,
java.math.BigDecimal aPriceValue)
Compares two prices for the best.
|
boolean |
isHybridPriceLock(java.lang.String configXML) |
boolean |
processOfferPricesVector(QualifyingOfferInfo offerInfo,
java.util.Vector offerPricesVector,
java.lang.String requestedCurrency,
com.ibm.commerce.order.objects.OfferAccessBean offer,
com.ibm.commerce.common.objects.StoreAccessBean storeAB)
Process the prices for a specific offer.
|
void |
setPriceListProductSetId(java.lang.String aPriceListId,
java.lang.String aProductSetId)
Sets the product set id in the price list.
|
MonetaryAmount |
setRoundCustomizedPrice(MonetaryAmount aPrice,
com.ibm.commerce.common.objects.StoreAccessBean aStoreAB)
Rounds up the input price.
|
public static final java.math.BigDecimal BIG_DECIMAL_ZERO
public static final java.lang.String CONFIGURATOR_BOM_XML_ATTRIBUTE_PRICELOCK
Price
attribute in the ConfiguratorBOM XML generated from Sterling Dynamic Kit Configurator.public static final java.lang.String CONFIGURATOR_BOM_XML_ATTRIBUTE_PRICELOCK_DEFAULTVALUE
public static final java.lang.String CONFIGURATOR_BOM_XML_ATTRIBUTE_SKU
SKU
attribute in the ConfiguratorBOM XML generated from Sterling Dynamic Kit Configurator.public static final java.lang.String CONFIGURATOR_BOM_XML_ELEMENT_LINE_ITEM
LineItem
element name in the ConfiguratorBOM XML generated from Sterling Dynamic Kit Configurator.public static final java.lang.String CONFIGURATOR_BOM_XML_NODE_CONFIGURATOR_BOM
public static final java.lang.String COPYRIGHT
public static final java.lang.Double DOUBLE_ZERO
public static final java.lang.String ERRTASK_NAME
public static final java.lang.Integer INTEGER_ZERO
public static final java.lang.Long LONG_ZERO
public static final java.lang.Object NULL
public PriceCalculationHelper()
public void createPriceBusinessPolicy(java.lang.String aPriceListName, java.lang.Long aPriceListOwner, java.lang.Integer aStoreEntityId, java.lang.String aPolicyName) throws com.ibm.commerce.exception.ECException, java.sql.SQLException
aPriceListName
- the name of the price list for the policy.aPriceListOwner
- the owner id of the price list.aStoreEntityId
- the id the store.aPolicyName
- the name for the policy.com.ibm.commerce.exception.ECException
java.sql.SQLException
public void deletePriceBusinessPolicy(java.lang.String aPriceListId, java.lang.Integer aStoreEntityId) throws com.ibm.commerce.exception.ECException
aPriceListId
- the id of the price list.aStoreEntityId
- the id the store.com.ibm.commerce.exception.ECException
public java.lang.Long[] findAllMasterCatalogPriceLists(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB) throws com.ibm.commerce.exception.ECException
aStoreAB
- the access bean of the store which owns the master catalog.
com.ibm.commerce.exception.ECException
public java.lang.String genMarkers(int num)
objects
- public java.lang.Long[] getAllMasterCatalogPriceLists(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB) throws com.ibm.commerce.exception.ECException
aStoreAB
- the access bean of the store which owns the master catalog.
com.ibm.commerce.exception.ECException
public java.util.Hashtable getAllPolicyPriceLists(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB) throws com.ibm.commerce.exception.ECException
aStoreAB
- the access bean of the store which owns the policies.
com.ibm.commerce.exception.ECException
public java.util.Hashtable getAllPolicyPriceProperties(com.ibm.commerce.common.objects.StoreAccessBean aStoreAB) throws com.ibm.commerce.exception.ECException
aStoreAB
- the access bean of the store which owns the policies.
com.ibm.commerce.exception.ECException
public java.util.Vector getAllStandardPriceListAccessBeans() throws com.ibm.commerce.exception.ECException
aStoreAB
- the access bean of the store which owns the standard price lists.
com.ibm.commerce.exception.ECException
public java.util.Vector getAllStandardPriceLists() throws com.ibm.commerce.exception.ECException
aStoreAB
- the access bean of the store which owns the standard price lists.
com.ibm.commerce.exception.ECException
public MonetaryAmount getDynamicKitConfigurationPriceWithPredefinedConfiguration(java.lang.String aCurrency, java.lang.Long tradingId, com.ibm.commerce.order.objects.OrderItemAccessBean oiab, java.lang.Long dynamicKitCatalogEntryId, java.lang.Long dynamicKitPredefinedConfigurationId, MonetaryAmount predefinedConfigurationPrice, com.ibm.commerce.command.CommandContext commandContext) throws java.lang.Exception
aCurrency
- The currency under which to return the cost.tradingId
- The ID of the contract to use in retrieving individual
dynamic kit component prices.oiab
- The OrderItemAccessBean that represents the dynamic kit
configuration for which to calculate cost.dynamicKitCatalogEntryId
- The ID of the dynamic kit being priced.dynamicKitPredefinedConfigurationId
- The ID of the predefined
configuration used to calculate the dynamic kit configuration's cost.predefinedConfigurationPrice
- The MonetaryAmount object used to
represent the price of the predefined configuration.commandContext
- The command context under which to run pricing
commands.java.lang.Exception
- Thrown whenever the cost cannot be determined.public MonetaryAmount getDynamicKitPrice(java.lang.String aCurrency, com.ibm.commerce.command.CommandContext aCommandContext, java.lang.String astrConfigurationId, com.ibm.commerce.order.objects.OrderItemAccessBean aabOrderItem) throws com.ibm.commerce.exception.ECException
aCurrency
- the currencyaCommandContext
- the command context for this classastrConfigrationId
- the configuration IDaabOrderItem
- the orderItem accessbeancom.ibm.commerce.exception.ECException
public MonetaryAmount getDynamicKitPrice(java.lang.String aCurrency, com.ibm.commerce.command.CommandContext aCommandContext, java.lang.String astrConfigurationId, com.ibm.commerce.order.objects.OrderItemAccessBean aabOrderItem, java.util.Vector avecOrderItemComponents) throws com.ibm.commerce.exception.ECException
aCurrency
- the currencyaCommandContext
- the command context for this classastrConfigrationId
- the configuration IDaabOrderItem
- the orderItem accessbeanavecOrderItemComponents
- a vector of orderItemscom.ibm.commerce.exception.ECException
public MonetaryAmount getDynamicKitPrice(java.lang.String aCurrency, com.ibm.commerce.command.CommandContext aCommandContext, java.lang.String astrConfigurationId, com.ibm.commerce.order.objects.OrderItemAccessBean aabOrderItem, java.util.Vector avecOrderItemComponents, java.lang.Long[] tradingIds) throws com.ibm.commerce.exception.ECException
aCurrency
- the currencyaCommandContext
- the command context for this classastrConfigrationId
- the configuration IDaabOrderItem
- the orderItem accessbeanavecOrderItemComponents
- a vector of orderItemstradingIds
- a Long array of passed in trading ids.com.ibm.commerce.exception.ECException
public MonetaryAmount getDynamicKitPrice(java.lang.String aCurrency, com.ibm.commerce.command.CommandContext aCommandContext, java.lang.String astrConfigurationId, com.ibm.commerce.order.objects.OrderItemAccessBean aabOrderItem, java.util.Vector avecOrderItemComponents, java.lang.Long[] tradingIds, boolean useStartingPoint, java.lang.Long dynamicKitPredefinedConfigurationId) throws com.ibm.commerce.exception.ECException
aCurrency
- the currencyaCommandContext
- the command context for this classastrConfigrationId
- the confifuration IDaabOrderItem
- the orderItem accessbeanavecOrderItemComponents
- a vector of orderItemstradingIds
- a Long array of passed in trading ids.useStartingPoint
- a boolean used to control if starting points are to be used in determining pricedynamicKitPredefinedConfigurationAccessBean
- an access bean to the predefined configuration to use for pricing the dynamic kitcom.ibm.commerce.exception.ECException
public java.lang.String getInPredicate(java.lang.Object[] objects)
objects
- public static PriceCalculationHelper getInstance()
public java.lang.Long getMemberIdFromPrcPolicyProperties(com.ibm.commerce.datatype.TypedProperty aparam) throws com.ibm.commerce.exception.ECException
aparam
- the TypedPropertycom.ibm.commerce.exception.ECException
public com.ibm.commerce.order.objects.OfferPriceAccessBean getNominalCost(java.lang.Long aCatEntryID, java.lang.Long aTpcID, java.lang.Integer aStoreID) throws com.ibm.commerce.exception.ECException
aCatEntryID
- A catalog entry IDaTpcID
- A nominal cost pricelist IDaStoreID
- A store IDcom.ibm.commerce.exception.ECException
- if encountering RemoteException, or NamingException, or CreateException, or
there are multiple offerPrices (since one entry has at most one nominal cost)public java.util.List getNominalCostOfferABs(java.lang.Long aCatEntryID, java.lang.Long aTpcID, java.lang.Integer aStoreID) throws com.ibm.commerce.exception.ECException
aCatEntryID
- A catalog entry IDaTpcID
- A nominal cost pricelist IDaStoreID
- A store IDcom.ibm.commerce.exception.ECException
- if encountering RemoteException, or NamingException, or CreateExceptionpublic java.lang.Long getNominalCostPriceList(java.lang.Integer aStoreID) throws com.ibm.commerce.exception.ECException
aStoreID
- com.ibm.commerce.exception.ECException
- throw ECApplicationException if there is no nominal cost pricelist or
there are multiple nominal cost pricelists.public java.lang.String getPolicyPriceList(java.lang.String aPolicyProperties) throws com.ibm.commerce.exception.ECException
aPolicyProperties
- the properties defined in the policy.
com.ibm.commerce.exception.ECException
public java.lang.String getPolicyProductSet(java.lang.String aPolicyProperties) throws com.ibm.commerce.exception.ECException
aPolicyProperties
- the properties defined in the policy.
com.ibm.commerce.exception.ECException
public java.lang.String getPriceListType(java.lang.String properties)
properties
- public PricedDynamicKitPredefinedConfiguration getStartingOfferAndPriceOfPredefinedConfigurationFromTradingAgreement(java.lang.Long tradingId, java.lang.Long dynamicKitCatalogEntryId, java.lang.Long dynamicKitPredefinedConfigurationId, java.lang.Double quantity, java.lang.String currency, com.ibm.commerce.common.objects.StoreAccessBean storeAB) throws com.ibm.commerce.exception.ECException
tradingId
- The ID of the contract under which to retrieve predefined
configuration prices.dynamicKitCatalogEntryId
- The ID of the dynamic kit to which the
predefined configuration is related.dynamicKitPredefinedConfigurationId
- The ID of the predefined
configuration for which to lookup a price.quantity
- The number of this predefined configuration to be priced.currency
- The currency under which to price.storeAB
- A StoreAccessBean object representing the store in which
the predefined configuration is available.com.ibm.commerce.exception.ECException
- Thrown when a problem is encountered retrieving prices
or converting currencies.public void handlePriceNotFoundException(ItemPriceInfo aItemPriceInfo, java.lang.String aCurrency, java.lang.String aClassName) throws com.ibm.commerce.exception.ECException
aItemPriceInfo
- the item pricing info for a catalog entry.aCurrency
- the currency for the catalog entry.aClassName
- the name of the Class that detects the exception.com.ibm.commerce.exception.ECException
public boolean isBestPrice(QualifyingOfferInfo offerInfo, java.math.BigDecimal aPriceValue)
offerInfo
- the offer info containing the price for comparison.aPriceValue
- the second price for comparison.
public boolean isHybridPriceLock(java.lang.String configXML) throws com.ibm.commerce.exception.ECApplicationException
configXML
- The configuration xmlcom.ibm.commerce.exception.ECApplicationException
public boolean processOfferPricesVector(QualifyingOfferInfo offerInfo, java.util.Vector offerPricesVector, java.lang.String requestedCurrency, com.ibm.commerce.order.objects.OfferAccessBean offer, com.ibm.commerce.common.objects.StoreAccessBean storeAB) throws com.ibm.commerce.exception.ECException
offerInfo
- a qualified offer info.offerPricesVector
- a vector of prices for an offer.requestedCurrency
- the shopper's requested currency.offer
- offer access beanstoreAB
- the store access bean.com.ibm.commerce.exception.ECException
public void setPriceListProductSetId(java.lang.String aPriceListId, java.lang.String aProductSetId) throws com.ibm.commerce.exception.ECException
aPriceListId
- the price list IDaProductSetId
- the product set IDcom.ibm.commerce.exception.ECException
public MonetaryAmount setRoundCustomizedPrice(MonetaryAmount aPrice, com.ibm.commerce.common.objects.StoreAccessBean aStoreAB) throws com.ibm.commerce.exception.ECSystemException
aPrice
- the price monetary amount.aCatEntryId
- The input catalog entry.
com.ibm.commerce.exception.ECSystemException