atg.commerce.pricing.priceLists
Class ConfigurableItemPriceListCalculator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.priceLists.ItemPriceCalculator
              extended by atg.commerce.pricing.priceLists.ConfigurableItemPriceListCalculator
All Implemented Interfaces:
ItemPricingCalculator, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class ConfigurableItemPriceListCalculator
extends ItemPriceCalculator

This calculator assumes the ItemListPriceCalculator has already run. That calculator will set the list price and the amount of the ItemPriceInfo based on the ConfigurableSku's price. This calculator will iterate through the subSku's and modify the list price and amount accordingly. For example: if the parentSku is $5, subSkuA is $2 and subSkuB is $1. If we buy 2 of this configurable sku, then coming into this calculator the listPrice will be $5 and the amount will be $10. After this calculator runs the listPrice will be $8 and the amount will be $16.

See Also:
ItemPriceInfo, ConfigurableCommerceItem

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
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
ConfigurableItemPriceListCalculator()
           
 
Method Summary
 double getConfigurableItemListPrice(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Get the list price of the parent item
 double getConfigurableItemPrice(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Get the current working price of the parent item
 java.lang.String getListPricePropertyName()
          the name of the property for the ListPrice
 PriceListManager getPriceListManager()
          Returns property priceListManager
 PricingTools getPricingTools()
          pricing tools to help with price calculation
 java.lang.String getProfilePriceListPropertyName()
          The name of the property in the profile that stores the price list.
 double getSubSkuPrice(CommerceItem pSubItem, CommerceItem pParentItem, RepositoryItem pPriceList, RepositoryItem pPrice)
          Get the current price for the given subsku
 boolean isNoPriceIsError()
          If this is true, and the price list is null or there is not price in the price list, then an error is thrown.
 boolean isUseDefaultPriceList()
          If true and ProfilePriceListPropertyName is null, then the value of PriceListManager.automaticallyUseDefaultPriceList determines if the default price list is used.
 void priceItem(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price a single item in a context.
 void setListPricePropertyName(java.lang.String pListPricePropertyName)
          the name of the property for the ListPrice
 void setNoPriceIsError(boolean pNoPriceIsError)
          If this is true, and the price list is null or there is not price in the price list, then an error is thrown.
 void setPriceListManager(PriceListManager pPriceListManager)
          Sets property priceListManager
 void setPricingTools(PricingTools pPricingTools)
          pricing tools to help with price calculation
 void setProfilePriceListPropertyName(java.lang.String pProfilePriceListPropertyName)
          The name of the property in the profile that stores the price list.
 void setUseDefaultPriceList(boolean pUseDefaultPriceList)
          If true and the profiles ProfilePriceListPropertyName is null, then the default price list from the PriceListManager is used.
 
Methods inherited from class atg.commerce.pricing.priceLists.ItemPriceCalculator
getDifferentPriceList, getLoggingIdentifier, getPricingScheme, getPricingSchemeNames, getPricingSchemePropertyName, priceEachItem, priceItems, setLoggingIdentifier, setPricingSchemeNames, setPricingSchemePropertyName
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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 java.lang.String CLASS_VERSION
Class version string

Constructor Detail

ConfigurableItemPriceListCalculator

public ConfigurableItemPriceListCalculator()
Method Detail

setPricingTools

public void setPricingTools(PricingTools pPricingTools)
pricing tools to help with price calculation

Parameters:
pPricingTools - new value to set

getPricingTools

public PricingTools getPricingTools()
pricing tools to help with price calculation

Returns:
property PricingTools

setListPricePropertyName

public void setListPricePropertyName(java.lang.String pListPricePropertyName)
the name of the property for the ListPrice

Parameters:
pListPricePropertyName - new value to set

getListPricePropertyName

public java.lang.String getListPricePropertyName()
the name of the property for the ListPrice

Returns:
property ListPricePropertyName

setProfilePriceListPropertyName

public void setProfilePriceListPropertyName(java.lang.String pProfilePriceListPropertyName)
The name of the property in the profile that stores the price list.

Overrides:
setProfilePriceListPropertyName in class ItemPriceCalculator
Parameters:
pProfilePriceListPropertyName - The new value to set

getProfilePriceListPropertyName

public java.lang.String getProfilePriceListPropertyName()
The name of the property in the profile that stores the price list.

Overrides:
getProfilePriceListPropertyName in class ItemPriceCalculator
Returns:
The name of the property in the profile

setUseDefaultPriceList

public void setUseDefaultPriceList(boolean pUseDefaultPriceList)
If true and the profiles ProfilePriceListPropertyName is null, then the default price list from the PriceListManager is used. If false, and ProfilePriceListPropertyName is null, then nothing happens. Defaults to true.

Overrides:
setUseDefaultPriceList in class ItemPriceCalculator
Parameters:
pUseDefaultPriceList - The new value to set

isUseDefaultPriceList

public boolean isUseDefaultPriceList()
If true and ProfilePriceListPropertyName is null, then the value of PriceListManager.automaticallyUseDefaultPriceList determines if the default price list is used. If false, then the default price list is never used. The default is true

Overrides:
isUseDefaultPriceList in class ItemPriceCalculator
Returns:
The value of useDefaultPriceList

setNoPriceIsError

public void setNoPriceIsError(boolean pNoPriceIsError)
If this is true, and the price list is null or there is not price in the price list, then an error is thrown. If this is false and the price list is null, then nothing happens. Default is true.

Overrides:
setNoPriceIsError in class ItemPriceCalculator
Parameters:
pNoIsError - The new value to set

isNoPriceIsError

public boolean isNoPriceIsError()
If this is true, and the price list is null or there is not price in the price list, then an error is thrown. If this is false and the price list is null, then nothing happens. Default is true.

Overrides:
isNoPriceIsError in class ItemPriceCalculator
Returns:
The value of noPriceIsError

getPriceListManager

public PriceListManager getPriceListManager()
Returns property priceListManager

Overrides:
getPriceListManager in class ItemPriceCalculator
Returns:
returns property priceListManager

setPriceListManager

public void setPriceListManager(PriceListManager pPriceListManager)
Sets property priceListManager

Overrides:
setPriceListManager in class ItemPriceCalculator
Parameters:
pPriceListManager - the value to set for property priceListManager

priceItem

public void priceItem(ItemPriceInfo pPriceQuote,
                      CommerceItem pItem,
                      RepositoryItem pPricingModel,
                      java.util.Locale pLocale,
                      RepositoryItem pProfile,
                      java.util.Map pExtraParameters)
               throws PricingException
Price a single item in a context. It will use the price list in the profile (most common usage) or the price list in the pExtraParameters map. In either case, it looks for profilePriceListPropertyName

Specified by:
priceItem in interface ItemPricingCalculator
Overrides:
priceItem in class ItemPriceCalculator
Parameters:
pPriceQuote - ItemPriceInfo representing the current price quote for the item
pItem - The item to price
pPricingModel - A RepositoryItem representing a PricingModel
pLocale - The user's locale
pProfile - The user's profile
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null You may override the price list in the profile by providing a price list (or price list id) in this map. Use profilePriceListPropertyName as the key
Throws:
PricingException

getConfigurableItemPrice

public double getConfigurableItemPrice(ItemPriceInfo pPriceQuote,
                                       CommerceItem pItem,
                                       RepositoryItem pPricingModel,
                                       java.util.Locale pLocale,
                                       RepositoryItem pProfile,
                                       java.util.Map pExtraParameters)
Get the current working price of the parent item

Parameters:
pPriceQuote - ItemPriceInfo representing the current price quote for the item
pItem - The item to price (currently ignored)
pPricingModel - A RepositoryItem representing a PricingModel (currently ignored)
pLocale - The user's locale (currently ignored)
pProfile - The user's profile (currently ignored)
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null (currently ignored)

getConfigurableItemListPrice

public double getConfigurableItemListPrice(ItemPriceInfo pPriceQuote,
                                           CommerceItem pItem,
                                           RepositoryItem pPricingModel,
                                           java.util.Locale pLocale,
                                           RepositoryItem pProfile,
                                           java.util.Map pExtraParameters)
Get the list price of the parent item

Parameters:
pPriceQuote - ItemPriceInfo representing the current price quote for the item
pItem - The item to price (currently ignored)
pPricingModel - A RepositoryItem representing a PricingModel (currently ignored)
pLocale - The user's locale (currently ignored)
pProfile - The user's profile (currently ignored)
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null (currently ignored)

getSubSkuPrice

public double getSubSkuPrice(CommerceItem pSubItem,
                             CommerceItem pParentItem,
                             RepositoryItem pPriceList,
                             RepositoryItem pPrice)
Get the current price for the given subsku

Parameters:
pSubItem - The CommerceItem object for the sub sku
pParentItem - The CommerceItem object for the parent sku
pPriceList - The price list used to get the price
pPrice - The price repository item for the sub sku
Returns:
The price using listPricePropertyName