com.ibm.commerce.price.commands
Class PriceCalculationHelper

java.lang.Object
  |
  +--com.ibm.commerce.price.commands.PriceCalculationHelper

public class PriceCalculationHelper
extends java.lang.Object

This PriceCalculationHelper Class provides utility methods for performing the price calculation.


Field Summary
static java.math.BigDecimal BIG_DECIMAL_ZERO
           
static java.lang.Double DOUBLE_ZERO
           
static java.lang.String ERRTASK_NAME
           
static java.lang.Integer INTEGER_ZERO
           
static java.lang.Long LONG_ZERO
           
static java.lang.Object NULL
           
 
Constructor Summary
PriceCalculationHelper()
          PriceCalculationHelper constructor comment.
 
Method Summary
 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(StoreAccessBean aStoreAB)
          Retrieves the price lists associated with master catalog (Fast Method).
 java.lang.Long[] getAllMasterCatalogPriceLists(StoreAccessBean aStoreAB)
          Retrieves the price lists associated with master catalog (Alternative Method).
 java.util.Hashtable getAllPolicyPriceLists(StoreAccessBean aStoreAB)
          Retrieves the price list business policies.
 java.util.Hashtable getAllPolicyPriceProperties(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 getDynamicKitPrice(java.lang.String aCurrency, CommandContext aCommandContext, java.lang.String astrConfigurationId, OrderItemAccessBean aabOrderItem)
           
 MonetaryAmount getDynamicKitPrice(java.lang.String aCurrency, CommandContext aCommandContext, java.lang.String astrConfigurationId, OrderItemAccessBean aabOrderItem, java.util.Vector avecOrderItemComponents)
           
 java.lang.String getInPredicate(java.lang.Object[] objects)
          Composes the IN search predicate.
static PriceCalculationHelper getInstance()
           
 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.
 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 processOfferPricesVector(QualifyingOfferInfo offerInfo, java.util.Vector offerPricesVector, java.lang.String requestedCurrency, OfferAccessBean offer, 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, StoreAccessBean aStoreAB)
          Rounds up the input price.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIG_DECIMAL_ZERO

public static final java.math.BigDecimal BIG_DECIMAL_ZERO

DOUBLE_ZERO

public static final java.lang.Double DOUBLE_ZERO

ERRTASK_NAME

public static final java.lang.String ERRTASK_NAME

INTEGER_ZERO

public static final java.lang.Integer INTEGER_ZERO

LONG_ZERO

public static final java.lang.Long LONG_ZERO

NULL

public static final java.lang.Object NULL
Constructor Detail

PriceCalculationHelper

public PriceCalculationHelper()
PriceCalculationHelper constructor comment.
Method Detail

createPriceBusinessPolicy

public void createPriceBusinessPolicy(java.lang.String aPriceListName,
                                      java.lang.Long aPriceListOwner,
                                      java.lang.Integer aStoreEntityId,
                                      java.lang.String aPolicyName)
                               throws ECException,
                                      java.sql.SQLException
Creates a price business policy.

Parameters:
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.

deletePriceBusinessPolicy

public void deletePriceBusinessPolicy(java.lang.String aPriceListId,
                                      java.lang.Integer aStoreEntityId)
                               throws ECException
Deletes a price business policy.

Parameters:
aPriceListId - the id of the price list.
aStoreEntityId - the id the store.

findAllMasterCatalogPriceLists

public java.lang.Long[] findAllMasterCatalogPriceLists(StoreAccessBean aStoreAB)
                                                throws ECException
Retrieves the price lists associated with master catalog (Fast Method).

Parameters:
aStoreAB - the access bean of the store which owns the master catalog.

Returns:
A list of price list ids for the master catalogs.

getAllMasterCatalogPriceLists

public java.lang.Long[] getAllMasterCatalogPriceLists(StoreAccessBean aStoreAB)
                                               throws ECException
Retrieves the price lists associated with master catalog (Alternative Method).

Parameters:
aStoreAB - the access bean of the store which owns the master catalog.

Returns:
A list of price list ids for the master catalogs.

getAllPolicyPriceLists

public java.util.Hashtable getAllPolicyPriceLists(StoreAccessBean aStoreAB)
                                           throws ECException
Retrieves the price list business policies.

Parameters:
aStoreAB - the access bean of the store which owns the policies.

Returns:
A list of price list policies.

getAllPolicyPriceProperties

public java.util.Hashtable getAllPolicyPriceProperties(StoreAccessBean aStoreAB)
                                                throws ECException
Retrieves the price list business policy properties.

Parameters:
aStoreAB - the access bean of the store which owns the policies.

Returns:
A list of price list policy properties.

getAllStandardPriceListAccessBeans

public java.util.Vector getAllStandardPriceListAccessBeans()
                                                    throws ECException
Retrieves the standard price list access beans.

Parameters:
aStoreAB - the access bean of the store which owns the standard price lists.

Returns:
A list of standard price list access beans.

getAllStandardPriceLists

public java.util.Vector getAllStandardPriceLists()
                                          throws ECException
Retrieves the ids of standard price list.

Parameters:
aStoreAB - the access bean of the store which owns the standard price lists.

Returns:
A list of standard price list ids.

getDynamicKitPrice

public MonetaryAmount getDynamicKitPrice(java.lang.String aCurrency,
                                         CommandContext aCommandContext,
                                         java.lang.String astrConfigurationId,
                                         OrderItemAccessBean aabOrderItem)
                                  throws ECException

getDynamicKitPrice

public MonetaryAmount getDynamicKitPrice(java.lang.String aCurrency,
                                         CommandContext aCommandContext,
                                         java.lang.String astrConfigurationId,
                                         OrderItemAccessBean aabOrderItem,
                                         java.util.Vector avecOrderItemComponents)
                                  throws ECException

getInPredicate

public java.lang.String getInPredicate(java.lang.Object[] objects)
Composes the IN search predicate.

getInstance

public static PriceCalculationHelper getInstance()

getPolicyPriceList

public java.lang.String getPolicyPriceList(java.lang.String aPolicyProperties)
                                    throws ECException
Retrieves the price list associated with a policy.

Parameters:
aPolicyProperties - the properties defined in the policy.

Returns:
The id of the price list associated with the policy.

getPolicyProductSet

public java.lang.String getPolicyProductSet(java.lang.String aPolicyProperties)
                                     throws ECException
Retrieves the product set associated with a policy.

Parameters:
aPolicyProperties - the properties defined in the policy.

Returns:
The id of the product set associated with the policy.

handlePriceNotFoundException

public void handlePriceNotFoundException(ItemPriceInfo aItemPriceInfo,
                                         java.lang.String aCurrency,
                                         java.lang.String aClassName)
                                  throws ECException
Handles the price not found exception.

Parameters:
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.

isBestPrice

public boolean isBestPrice(QualifyingOfferInfo offerInfo,
                           java.math.BigDecimal aPriceValue)
Compares two prices for the best.

Parameters:
offerInfo - the offer info containing the price for comparison.
aPriceValue - the second price for comparison.

Returns:
true if second price is lower; false otherwise.

processOfferPricesVector

public boolean processOfferPricesVector(QualifyingOfferInfo offerInfo,
                                        java.util.Vector offerPricesVector,
                                        java.lang.String requestedCurrency,
                                        OfferAccessBean offer,
                                        StoreAccessBean storeAB)
                                 throws ECException
Process the prices for a specific offer. It is assumed that there is no price for the shopper's requested currency and therefore all prices are converted to the requested currency and the lowest one is chosen.
Parameters:
offerInfo - a qualified offer info.
offerPricesVector - a vector of prices for an offer.
requestedCurrency - the shopper's requested currency.
storeAB - the store access bean.
Returns:
whether there was a successful conversion from any of the prices to the requested currency (and its the best yet).

setPriceListProductSetId

public void setPriceListProductSetId(java.lang.String aPriceListId,
                                     java.lang.String aProductSetId)
                              throws ECException
Sets the product set id in the price list.

setRoundCustomizedPrice

public MonetaryAmount setRoundCustomizedPrice(MonetaryAmount aPrice,
                                              StoreAccessBean aStoreAB)
                                       throws ECSystemException
Rounds up the input price.

Parameters:
aPrice - the price monetary amount.
aCatEntryId - The input catalog entry.

Returns:
The rounded up quantity amount for the catalog entry.