atg.commerce.pricing
Class DetailedItemPriceTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.logging.ApplicationLoggingImpl
          extended by atg.commerce.pricing.DetailedItemPriceTools
All Implemented Interfaces:
ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging

public class DetailedItemPriceTools
extends ApplicationLoggingImpl

This class provides various methods for manipulating DetailedItemPriceInfos. To use this class you should get it from PricingTools. To turn logging on for this component, turn logging on in PricingTools.

See Also:
Created: Tue Jul 24 10:37:24 2001

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
DetailedItemPriceTools(PricingTools pPricingTools)
          Constructs an instance of DetailedItemPriceTools
 
Method Summary
 void adjustDetailedItemPriceInfos(java.util.List pDetailedItemPriceInfos, double pUnitAdjustment, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, java.lang.String pAdjustmentDescription)
          This method will modify the price of each given DetailedItemPriceInfo by the given unit adjustment.
 void assignSalePriceToDetails(java.util.List pDetailedItemPriceInfos, double pUnitSalePrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, java.lang.String pAdjustmentDescription)
          This method will assign the given sales price to each of the given details.
 java.util.List createInitialDetailedItemPriceInfos(double pTotalPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, java.lang.String pAdjustmentDescription)
          Create the initial DetailedItemPriceInfos with the given price This method will create one DetailedItemPriceInfo for each ShippingGroupCommerceItemRelationship in the order.
 java.util.List createInitialDetailedItemPriceInfos(double pTotalPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, java.lang.String pAdjustmentDescription, atg.core.util.Range pRange)
          Create the initial DetailedItemPriceInfos with the given price for the given range This method will create one DetailedItemPriceInfo for each ShippingGroupCommerceItemRelationship in the order whose range falls within the given range.
 atg.core.util.Range createRange()
          Instantiates a new Range object based on the configured range type in PricingTools
 void distributeAmountAcrossDetails(java.util.List pShipItemRels, double pAmountOfContainer, double pAmountToDistribute, java.lang.String pDetailProperty)
          This method will distribute pAmountToDistribute across all teh detailedItemPriceInfos for each relationship in pShipItemRels.
 void distributeAmountAcrossDetails(java.util.List pShipItemRels, double pAmountOfContainer, double pAmountToDistribute, java.lang.String pDetailProperty, boolean pAccumulate)
          This method will distribute pAmountToDistribute across all teh detailedItemPriceInfos for each relationship in pShipItemRels.
protected  java.util.List getDetailsToReceiveDiscountShare(ItemPriceInfo pItemPriceInfo, atg.core.util.Range pRange)
          This will return the price details in an item price info that will be marked as receiving a share of the order discount.
 PricingTools getPricingTools()
          The PricingTools object
 boolean isLoggingDebug()
          This method returns whether or not an debug log event should be broadcast.
 boolean isLoggingError()
          This method returns whether or not an error log event should be broadcast.
 boolean isLoggingInfo()
          This method returns whether or not an info log event should be broadcast.
 boolean isLoggingWarning()
          This method returns whether or not an warning log event should be broadcast.
 void logDebug(java.lang.String pMessage)
          Logs an debug event with the specified message
 void logDebug(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an debug event with the specified message and Throwable
 void logDebug(java.lang.Throwable pThrowable)
          Logs an debug event with the specified Throwable
 void logError(java.lang.String pMessage)
          Logs an error event with the specified message
 void logError(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an error event with the specified message and Throwable
 void logError(java.lang.Throwable pThrowable)
          Logs an error event with the specified Throwable
 void logInfo(java.lang.String pMessage)
          Logs an info event with the specified message
 void logInfo(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an info event with the specified message and Throwable
 void logInfo(java.lang.Throwable pThrowable)
          Logs an info event with the specified Throwable
 void logWarning(java.lang.String pMessage)
          Logs an warning event with the specified message
 void logWarning(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an warning event with the specified message and Throwable
 void logWarning(java.lang.Throwable pThrowable)
          Logs an warning event with the specified Throwable
 void setPricingTools(PricingTools pPricingTools)
           
 java.util.List splitDetailsAccordingToRanges(DetailedItemPriceInfo pDetail, java.util.List pRanges)
          Create a detail with the same information as the given detail, 1 for each range.
 
Methods inherited from class atg.nucleus.logging.ApplicationLoggingImpl
addGlobalLogListeners, addLogListener, getLoggingForVlogging, getLoggingIdentifer, getLoggingIdentifier, getLogListenerCount, getLogListeners, initializeFromServiceEvent, isAutoInitListeners, isLoggingTrace, logTrace, logTrace, logTrace, removeLogListener, sendLogEvent, setAutoInitListeners, setLoggingDebug, setLoggingError, setLoggingIdentifier, setLoggingInfo, setLoggingTrace, setLoggingWarning
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values
Constructor Detail

DetailedItemPriceTools

public DetailedItemPriceTools(PricingTools pPricingTools)
Constructs an instance of DetailedItemPriceTools

Method Detail

setPricingTools

public void setPricingTools(PricingTools pPricingTools)

getPricingTools

public PricingTools getPricingTools()
The PricingTools object


createInitialDetailedItemPriceInfos

public java.util.List createInitialDetailedItemPriceInfos(double pTotalPrice,
                                                          ItemPriceInfo pPriceQuote,
                                                          CommerceItem pItem,
                                                          RepositoryItem pPricingModel,
                                                          java.util.Locale pLocale,
                                                          RepositoryItem pProfile,
                                                          java.util.Map pExtraParameters,
                                                          java.lang.String pAdjustmentDescription)
                                                   throws PricingException
Create the initial DetailedItemPriceInfos with the given price This method will create one DetailedItemPriceInfo for each ShippingGroupCommerceItemRelationship in the order. This means that the items that a particular DetailedItemPriceInfo refers to will all be in the same shipping group. It does this by using the detail's range, and the shipItemRel's range.

Parameters:
pTotalPrice - The total price that the new DetailedItemPriceInfos must account for
pPriceQuote - The current working price of pItem.
pItem - The item that is currently being priced.
pPricingModel - the discount that will be set in the PricingAdjustment (usually null)
pProfile - the person for whom the items are to be discounted (currently ignored)
pLocale - the locale in which the items are to be discounted (currently ignored)
pExtraParameters - any extra information that this method might need to set the prices of a number of the qualifying item (currently ignored)
pAdjustmentDescription - This is the adjustment description used when creating all new PricingAdjustments
Returns:
The list of newly created details
Throws:
PricingException

createInitialDetailedItemPriceInfos

public java.util.List createInitialDetailedItemPriceInfos(double pTotalPrice,
                                                          ItemPriceInfo pPriceQuote,
                                                          CommerceItem pItem,
                                                          RepositoryItem pPricingModel,
                                                          java.util.Locale pLocale,
                                                          RepositoryItem pProfile,
                                                          java.util.Map pExtraParameters,
                                                          java.lang.String pAdjustmentDescription,
                                                          atg.core.util.Range pRange)
                                                   throws PricingException
Create the initial DetailedItemPriceInfos with the given price for the given range This method will create one DetailedItemPriceInfo for each ShippingGroupCommerceItemRelationship in the order whose range falls within the given range. If a shippingGroupCommerceItemRelationship has a range of (0,4) and pRange is (0,1) then a DetailedItemPriceInfo for range (0,1) is created. This means that the items that a particular DetailedItemPriceInfo refers to will all be in the same shipping group. It does this by using the detail's range, and the shipItemRel's range.

Parameters:
pTotalPrice - The total price that the new DetailedItemPriceInfos must account for
pPriceQuote - The current working price of pItem.
pItem - The item that is currently being priced.
pPricingModel - the discount that will be set in the PricingAdjustment (usually null)
pProfile - the person for whom the items are to be discounted (currently ignored)
pLocale - the locale in which the items are to be discounted (currently ignored)
pExtraParameters - any extra information that this method might need to set the prices of a number of the qualifying item (currently ignored)
pAdjustmentDescription - This is the adjustment description used when creating all new PricingAdjustments
Returns:
The list of newly created details
Throws:
PricingException

assignSalePriceToDetails

public void assignSalePriceToDetails(java.util.List pDetailedItemPriceInfos,
                                     double pUnitSalePrice,
                                     ItemPriceInfo pPriceQuote,
                                     CommerceItem pItem,
                                     RepositoryItem pPricingModel,
                                     java.util.Locale pLocale,
                                     RepositoryItem pProfile,
                                     java.util.Map pExtraParameters,
                                     java.lang.String pAdjustmentDescription)
                              throws PricingException
This method will assign the given sales price to each of the given details. No new details are created. This will change the amount property of each detail as well as add a new PricingAdjustment for the entire quantity of the detail, with the given adjustment description.

Parameters:
pDetailedItemPriceInfos - The list of DetailedItemPriceInfo objects that should be adjusted
pUnitSalePrice - The sale price for 1 of the given item. The total adjustment for each detail is this amount times the quantity of the detail
pPriceQuote - The current working price of pItem. This is also ignored.
pItem - The item that contains the details. This is ignored in the default implementation
pPricingModel - the discount that will be set in the PricingAdjustment (usually null)
pProfile - the person for whom the items are to be discounted (currently ignored)
pLocale - the locale in which the items are to be discounted (currently ignored)
pExtraParameters - any extra information that this method might need to set the prices of a number of the qualifying item
pAdjustmentDescription - This is the adjustment description used when creating all new PricingAdjustments
Throws:
PricingException

adjustDetailedItemPriceInfos

public void adjustDetailedItemPriceInfos(java.util.List pDetailedItemPriceInfos,
                                         double pUnitAdjustment,
                                         ItemPriceInfo pPriceQuote,
                                         CommerceItem pItem,
                                         RepositoryItem pPricingModel,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters,
                                         java.lang.String pAdjustmentDescription)
                                  throws PricingException
This method will modify the price of each given DetailedItemPriceInfo by the given unit adjustment. It will update the "amount" as well as add a new PricingAdjustment.

Parameters:
pDetailedItemPriceInfos - The list of details that will be adjusted
pUnitAdjustment - The adjustment made to the unit price (Total adjustment will be this amount times the quantity of the detail)
pPricingModel - the discount that will be set in the PricingAdjustment (usually null)
pProfile - the person for whom the items are to be discounted (currently ignored)
pLocale - the locale in which the items are to be discounted (currently ignored)
pExtraParameters - any extra information that this method might need to set the prices of a number of the qualifying item
pAdjustmentDescription - This is the adjustment description used when creating all new PricingAdjustments
Throws:
PricingException

splitDetailsAccordingToRanges

public java.util.List splitDetailsAccordingToRanges(DetailedItemPriceInfo pDetail,
                                                    java.util.List pRanges)
Create a detail with the same information as the given detail, 1 for each range. For example, if the Ranges are (0-1),(2-5), and (8-10) and you pass in a detail with quantity 9 (the quantity of the given detail must much the sum of the sizes of the ranges) then this method will create two new DetailedItemPriceInfos, set each property to match the given detail and adjust the quantity and range of all three to match the given ranges. The list of all three ranges is then returned. This is used by the ItemDiscountCalculator

Parameters:
pDetail - The original DetailedItemPriceInfo to split apart
pRanges - The list of Ranges that should have a DetailedItemPriceInfo. The size of these must equal the quantity of pDetail
Returns:
A list of all the details (the one passed in, and any new ones)

distributeAmountAcrossDetails

public void distributeAmountAcrossDetails(java.util.List pShipItemRels,
                                          double pAmountOfContainer,
                                          double pAmountToDistribute,
                                          java.lang.String pDetailProperty)
                                   throws PricingException
This method will distribute pAmountToDistribute across all teh detailedItemPriceInfos for each relationship in pShipItemRels. The amount applied to each detail is proportional to the amount of the detail compared to the pAmountOfContainer (for example, the amount of the shipping group containing the relationships.)

Parameters:
pShipItemRels - The list of relationships whose details will be updated
pAmountOfContainer - If the relationships are in a specific shipping group, this is the amount of the shipping group. If the relationships are all the relationships in an order, then this would be the order amount.
pAmountToDistribute - The amount that will be distributed across the details.
pDetailProperty - The name of the property that will be updated. Old values will be ignored.
Throws:
PricingException

distributeAmountAcrossDetails

public void distributeAmountAcrossDetails(java.util.List pShipItemRels,
                                          double pAmountOfContainer,
                                          double pAmountToDistribute,
                                          java.lang.String pDetailProperty,
                                          boolean pAccumulate)
                                   throws PricingException
This method will distribute pAmountToDistribute across all teh detailedItemPriceInfos for each relationship in pShipItemRels. The amount applied to each detail is proportional to the amount of the detail compared to the pAmountOfContainer (for example, the amount of the shipping group containing the relationships.)

Parameters:
pShipItemRels - The list of relationships whose details will be updated
pAmountOfContainer - If the relationships are in a specific shipping group, this is the amount of the shipping group. If the relationships are all the relationships in an order, then this would be the order amount.
pAmountToDistribute - The amount that will be distributed across the details.
pDetailProperty - The name of the property that will be updated.
pAccumulate - If true, then the new value will be added to any existing value.
Throws:
PricingException

getDetailsToReceiveDiscountShare

protected java.util.List getDetailsToReceiveDiscountShare(ItemPriceInfo pItemPriceInfo,
                                                          atg.core.util.Range pRange)
This will return the price details in an item price info that will be marked as receiving a share of the order discount. This will be all price details with a non-zero amount.

Parameters:
pItemPriceInfo - The item price info
pRange - Optional. Limits the results to the details for this range.
Returns:
The list of items to be marked for receiving a share of the order discount

isLoggingInfo

public boolean isLoggingInfo()
This method returns whether or not an info log event should be broadcast.

Specified by:
isLoggingInfo in interface ApplicationLogging
Overrides:
isLoggingInfo in class ApplicationLoggingImpl
Returns:
boolean true if info log events should be logged
false if info log events should not be logged

isLoggingWarning

public boolean isLoggingWarning()
This method returns whether or not an warning log event should be broadcast.

Specified by:
isLoggingWarning in interface ApplicationLogging
Overrides:
isLoggingWarning in class ApplicationLoggingImpl
Returns:
boolean true if warning log events should be logged
false if warning log events should not be logged

isLoggingError

public boolean isLoggingError()
This method returns whether or not an error log event should be broadcast.

Specified by:
isLoggingError in interface ApplicationLogging
Overrides:
isLoggingError in class ApplicationLoggingImpl
Returns:
boolean true if error log events should be logged
false if error log events should not be logged

isLoggingDebug

public boolean isLoggingDebug()
This method returns whether or not an debug log event should be broadcast.

Specified by:
isLoggingDebug in interface ApplicationLogging
Overrides:
isLoggingDebug in class ApplicationLoggingImpl
Returns:
boolean true if debug log events should be logged
false if debug log events should not be logged

logInfo

public void logInfo(java.lang.String pMessage)
Logs an info event with the specified message

Specified by:
logInfo in interface ApplicationLogging
Overrides:
logInfo in class ApplicationLoggingImpl

logInfo

public void logInfo(java.lang.Throwable pThrowable)
Logs an info event with the specified Throwable

Specified by:
logInfo in interface ApplicationLogging
Overrides:
logInfo in class ApplicationLoggingImpl

logInfo

public void logInfo(java.lang.String pMessage,
                    java.lang.Throwable pThrowable)
Logs an info event with the specified message and Throwable

Specified by:
logInfo in interface ApplicationLogging
Overrides:
logInfo in class ApplicationLoggingImpl

logWarning

public void logWarning(java.lang.String pMessage)
Logs an warning event with the specified message

Specified by:
logWarning in interface ApplicationLogging
Overrides:
logWarning in class ApplicationLoggingImpl

logWarning

public void logWarning(java.lang.Throwable pThrowable)
Logs an warning event with the specified Throwable

Specified by:
logWarning in interface ApplicationLogging
Overrides:
logWarning in class ApplicationLoggingImpl

logWarning

public void logWarning(java.lang.String pMessage,
                       java.lang.Throwable pThrowable)
Logs an warning event with the specified message and Throwable

Specified by:
logWarning in interface ApplicationLogging
Overrides:
logWarning in class ApplicationLoggingImpl

logError

public void logError(java.lang.String pMessage)
Logs an error event with the specified message

Specified by:
logError in interface ApplicationLogging
Overrides:
logError in class ApplicationLoggingImpl

logError

public void logError(java.lang.Throwable pThrowable)
Logs an error event with the specified Throwable

Specified by:
logError in interface ApplicationLogging
Overrides:
logError in class ApplicationLoggingImpl

logError

public void logError(java.lang.String pMessage,
                     java.lang.Throwable pThrowable)
Logs an error event with the specified message and Throwable

Specified by:
logError in interface ApplicationLogging
Overrides:
logError in class ApplicationLoggingImpl

logDebug

public void logDebug(java.lang.String pMessage)
Logs an debug event with the specified message

Specified by:
logDebug in interface ApplicationLogging
Overrides:
logDebug in class ApplicationLoggingImpl

logDebug

public void logDebug(java.lang.Throwable pThrowable)
Logs an debug event with the specified Throwable

Specified by:
logDebug in interface ApplicationLogging
Overrides:
logDebug in class ApplicationLoggingImpl

logDebug

public void logDebug(java.lang.String pMessage,
                     java.lang.Throwable pThrowable)
Logs an debug event with the specified message and Throwable

Specified by:
logDebug in interface ApplicationLogging
Overrides:
logDebug in class ApplicationLoggingImpl

createRange

public atg.core.util.Range createRange()
Instantiates a new Range object based on the configured range type in PricingTools

Returns:
Range object