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:
ItemPriceSourceHandler, ItemPricingCalculator, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, 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
 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.
 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 setProfilePriceListPropertyName(java.lang.String pProfilePriceListPropertyName)
          The name of the property in the profile that stores the price list.
 
Methods inherited from class atg.commerce.pricing.priceLists.ItemPriceCalculator
getDifferentPriceList, getItemPriceSource, getLoggingIdentifier, getNoPriceCalculator, getPriceListManager, getPricingScheme, getPricingSchemeNames, getPricingSchemePropertyName, getPricingTools, isUseDefaultPriceList, populateItemPriceSource, priceEachItem, priceItems, setLoggingIdentifier, setNoPriceCalculator, setPriceListManager, setPricingSchemeNames, setPricingSchemePropertyName, setPricingTools, setUseDefaultPriceList, shouldConsumeSource
 
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, reResolveThis, 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

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

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

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
See Also:
ItemPriceCalculator.getItemPriceSource(ItemPriceInfo, CommerceItem, RepositoryItem, Locale, RepositoryItem, Map), ItemPriceCalculator.shouldConsumeSource(ItemPriceSource)

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