atg.commerce.pricing
Class PricingModelHolder

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.PricingModelHolder
All Implemented Interfaces:
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 PricingModelHolder
extends GenericService

A session-scoped component which is intended to hold all the active promotions (aka pricing models) of a user while they are using the web application. The pricing engine APIs define a method by which pricing models for a user can be collected. However it may be expense to perform this operation, therefore these collections are essentially a session cache of promotions. This service on startup will query each pricing engine to load the pricing models that the user should have. If during the life cycle of the session, new promotions are given to the user the initialization methods should be called on this component. When the initialization methods are invoked the pricing engines are asked to give the promotions again.

The PricingTools class understands how to utilize this class to perform order pricing. Each pricing engine only takes as a parameter the collection of pricing models that apply to it's style (e.g. order vs. item pricing). The PricingTools method which accept a PricingModelHolder will pull out each individual collection and pass them into the appropriate pricing engines.

It is not intended for developers to create an instance of this class, and to call into the PricingTools class. A class instance should only be instantiated as a session-scoped component, which can be resolved through the request. This is the pattern that the item pricing droplets use, if no pricing models are supplied as explicit parameters, then the PricingModelHolder is resolved from the request and the collection is fetched.


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
PricingModelHolder()
          Constructs an instanceof PricingModelHolder
 
Method Summary
 void doStartService()
          For each pricing engine load the default pricing models
 java.util.Collection getAllPromotions()
          Returns property AllPromotions
 ItemPricingEngine getItemPricingEngine()
          Returns property ItemPricingEngine
 java.util.Collection getItemPricingModels()
          Returns property ItemPricingModels
 OrderPricingEngine getOrderPricingEngine()
          Returns property OrderPricingEngine
 java.util.Collection getOrderPricingModels()
          Returns property OrderPricingModels
 RepositoryItem getProfile()
          Returns property Profile
 PromotionTools getPromotionTools()
          Returns property PromotionTools
 long getReinitializeTime()
          The number of milliseconds that are allowed to pass before the pricing models are reinitialized
 ShippingPricingEngine getShippingPricingEngine()
          Returns property ShippingPricingEngine
 java.util.Collection getShippingPricingModels()
          Returns property ShippingPricingModels
 TaxPricingEngine getTaxPricingEngine()
          Returns property TaxPricingEngine
 java.util.Collection getTaxPricingModels()
          Returns property TaxPricingModels
 void initializeAllPromotions()
          Reload all promotions
 void initializeItemPricingModels()
          Reload the pricing models for pricing items
 void initializeOrderPricingModels()
          Reload the pricing models for pricing the order (e.g.
 void initializePricingModels()
          Reload the all pricing models
 void initializeShippingPricingModels()
          Reload the pricing models for determining shipping costs
 void initializeTaxPricingModels()
          Reload the pricing models for calculating tax
 void setAllPromotions(java.util.Collection pAllPromotions)
          Sets property AllPromotions
 void setItemPricingEngine(ItemPricingEngine pItemPricingEngine)
          Sets property ItemPricingEngine
 void setItemPricingModels(java.util.Collection pItemPricingModels)
          Sets property ItemPricingModels
 void setOrderPricingEngine(OrderPricingEngine pOrderPricingEngine)
          Sets property OrderPricingEngine
 void setOrderPricingModels(java.util.Collection pOrderPricingModels)
          Sets property OrderPricingModels
 void setProfile(RepositoryItem pProfile)
          Sets property Profile
 void setPromotionTools(PromotionTools pPromotionTools)
          Sets property PromotionTools
 void setReinitializeTime(long pReinitializeTime)
           
 void setShippingPricingEngine(ShippingPricingEngine pShippingPricingEngine)
          Sets property ShippingPricingEngine
 void setShippingPricingModels(java.util.Collection pShippingPricingModels)
          Sets property ShippingPricingModels
 void setTaxPricingEngine(TaxPricingEngine pTaxPricingEngine)
          Sets property TaxPricingEngine
 void setTaxPricingModels(java.util.Collection pTaxPricingModels)
          Sets property TaxPricingModels
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, 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

PricingModelHolder

public PricingModelHolder()
Constructs an instanceof PricingModelHolder

Method Detail

setProfile

public void setProfile(RepositoryItem pProfile)
Sets property Profile


getProfile

public RepositoryItem getProfile()
Returns property Profile


setItemPricingEngine

public void setItemPricingEngine(ItemPricingEngine pItemPricingEngine)
Sets property ItemPricingEngine


getItemPricingEngine

public ItemPricingEngine getItemPricingEngine()
Returns property ItemPricingEngine


setOrderPricingEngine

public void setOrderPricingEngine(OrderPricingEngine pOrderPricingEngine)
Sets property OrderPricingEngine


getOrderPricingEngine

public OrderPricingEngine getOrderPricingEngine()
Returns property OrderPricingEngine


setTaxPricingEngine

public void setTaxPricingEngine(TaxPricingEngine pTaxPricingEngine)
Sets property TaxPricingEngine


getTaxPricingEngine

public TaxPricingEngine getTaxPricingEngine()
Returns property TaxPricingEngine


setShippingPricingEngine

public void setShippingPricingEngine(ShippingPricingEngine pShippingPricingEngine)
Sets property ShippingPricingEngine


getShippingPricingEngine

public ShippingPricingEngine getShippingPricingEngine()
Returns property ShippingPricingEngine


setItemPricingModels

public void setItemPricingModels(java.util.Collection pItemPricingModels)
Sets property ItemPricingModels


getItemPricingModels

public java.util.Collection getItemPricingModels()
Returns property ItemPricingModels


setOrderPricingModels

public void setOrderPricingModels(java.util.Collection pOrderPricingModels)
Sets property OrderPricingModels


getOrderPricingModels

public java.util.Collection getOrderPricingModels()
Returns property OrderPricingModels


setTaxPricingModels

public void setTaxPricingModels(java.util.Collection pTaxPricingModels)
Sets property TaxPricingModels


getTaxPricingModels

public java.util.Collection getTaxPricingModels()
Returns property TaxPricingModels


setShippingPricingModels

public void setShippingPricingModels(java.util.Collection pShippingPricingModels)
Sets property ShippingPricingModels


getShippingPricingModels

public java.util.Collection getShippingPricingModels()
Returns property ShippingPricingModels


setAllPromotions

public void setAllPromotions(java.util.Collection pAllPromotions)
Sets property AllPromotions


getAllPromotions

public java.util.Collection getAllPromotions()
Returns property AllPromotions


setPromotionTools

public void setPromotionTools(PromotionTools pPromotionTools)
Sets property PromotionTools


getPromotionTools

public PromotionTools getPromotionTools()
Returns property PromotionTools


setReinitializeTime

public void setReinitializeTime(long pReinitializeTime)

getReinitializeTime

public long getReinitializeTime()
The number of milliseconds that are allowed to pass before the pricing models are reinitialized


initializeItemPricingModels

public void initializeItemPricingModels()
Reload the pricing models for pricing items


initializeOrderPricingModels

public void initializeOrderPricingModels()
Reload the pricing models for pricing the order (e.g. subtotal)


initializeTaxPricingModels

public void initializeTaxPricingModels()
Reload the pricing models for calculating tax


initializeShippingPricingModels

public void initializeShippingPricingModels()
Reload the pricing models for determining shipping costs


initializeAllPromotions

public void initializeAllPromotions()
Reload all promotions


initializePricingModels

public void initializePricingModels()
Reload the all pricing models


doStartService

public void doStartService()
                    throws ServiceException
For each pricing engine load the default pricing models

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up