atg.commerce.pricing
Class GWPPriceCalculator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.pricing.DiscountCalculatorService
              extended by atg.commerce.pricing.ItemDiscountCalculator
                  extended by atg.commerce.pricing.GWPPriceCalculator
All Implemented Interfaces:
ItemPricingCalculator, atg.commerce.pricing.PromotionProcessingComponent, atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class GWPPriceCalculator
extends ItemDiscountCalculator
implements atg.commerce.pricing.PromotionProcessingComponent

GWP prePromotionProcessing to make existing auto added and selected GWP quantity free before promotions are evaluated.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  GWPManager mGwpManager
           
protected  atg.commerce.promotion.GWPMarkerManager mGwpMarkerManager
           
 
Fields inherited from class atg.commerce.pricing.ItemDiscountCalculator
EXTRA_PARAM_QUALIFIERSERVICE
 
Fields inherited from class atg.commerce.pricing.DiscountCalculatorService
AMOUNT_INCREASE_TYPE, AMOUNT_OFF_TYPE, FIXED_PRICE_TYPE, ILLEGAL_TYPE, mPromotionTools, PERCENT_OFF_TYPE
 
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
GWPPriceCalculator()
           
 
Method Summary
 void applyExistingGWP(PricingContext pPricingContext, java.util.List<ItemPriceInfo> pPriceQuotes, java.util.Map pExtraParameters)
          Applies a zero fixed price adjustment to make any GWP quantity free on the item.
protected  long determineNextRangeMap(QualifiedItem pQualifiedItem, long pQuantity, PricingContext pPricingContext, java.util.Map pExtraParametersMap)
          Updates the given qualified item detail map to apply the given quantity of discount.
 GWPManager getGwpManager()
          Getter for the GWP marker manager
 atg.commerce.promotion.GWPMarkerManager getGwpMarkerManager()
          Getter for the GWP marker manager
 void invoke(java.util.Collection<RepositoryItem> pPricingModels, PricingContext pPricingContext, java.util.Map pExtraParameters)
          Apply the promotion engine component logic to call priceItems for this calculator.
 void priceItems(java.util.List pPriceQuotes, java.util.List pItems, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, Order pOrder, java.util.Map pExtraParameters)
          If called with a null pricing model then it applies a zero fixed price
adjustment to make any GWP quantity free on the item.
 void setGwpManager(GWPManager pGwpManager)
          Setter for the GWP marker manager
 void setGwpMarkerManager(atg.commerce.promotion.GWPMarkerManager pGwpMarkerManager)
          Setter for the GWP marker manager
 
Methods inherited from class atg.commerce.pricing.ItemDiscountCalculator
determineDiscountNumber, doStartService, findAdjustedPrice, findQualifyingItems, getAmountToDiscount, getPricingTools, getRangeComparator, priceDetailedItemPriceInfo, priceEachItem, priceItem, priceQualifyingItem, priceQualifyingItems, setPricingTools, setRangeComparator, updateDetailedPriceInfos, updateQualifyingDetails, updateQuantityAsQualifier, validateQualifierService
 
Methods inherited from class atg.commerce.pricing.DiscountCalculatorService
adjust, adjustAmount, getAdjuster, getDiscountType, getDiscountType, getPricingModelProperties, getPromotionTools, getQualifierService, getQualifierService, isNegativeAmountException, setNegativeAmountException, setPricingModelProperties, setPromotionTools, setQualifierService
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, 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, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
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

mGwpMarkerManager

protected atg.commerce.promotion.GWPMarkerManager mGwpMarkerManager

mGwpManager

protected GWPManager mGwpManager
Constructor Detail

GWPPriceCalculator

public GWPPriceCalculator()
Method Detail

getGwpMarkerManager

public atg.commerce.promotion.GWPMarkerManager getGwpMarkerManager()
Getter for the GWP marker manager

Returns:
GWPMarkerManager

setGwpMarkerManager

public void setGwpMarkerManager(atg.commerce.promotion.GWPMarkerManager pGwpMarkerManager)
Setter for the GWP marker manager

Parameters:
pItemMarkerManager - GWPMarkerManager

getGwpManager

public GWPManager getGwpManager()
Getter for the GWP marker manager

Returns:
GWPManager

setGwpManager

public void setGwpManager(GWPManager pGwpManager)
Setter for the GWP marker manager

Parameters:
pGwpManager - GwpManager

invoke

public void invoke(java.util.Collection<RepositoryItem> pPricingModels,
                   PricingContext pPricingContext,
                   java.util.Map pExtraParameters)
            throws PricingException
Apply the promotion engine component logic to call priceItems for this calculator.

Specified by:
invoke in interface atg.commerce.pricing.PromotionProcessingComponent
Parameters:
pPricingModels - Collection of PricingModel to process
pPricingContext - PricingContext
pExtraParameters - Map of extra parameters, may be null
Throws:
PricingException

priceItems

public void priceItems(java.util.List pPriceQuotes,
                       java.util.List pItems,
                       RepositoryItem pPricingModel,
                       java.util.Locale pLocale,
                       RepositoryItem pProfile,
                       Order pOrder,
                       java.util.Map pExtraParameters)
                throws PricingException
If called with a null pricing model then it applies a zero fixed price
adjustment to make any GWP quantity free on the item.
Only applies for automatic or selected GWP quantity.

It is expected that pricing model will be null if called as a pre-calculator.

Specified by:
priceItems in interface ItemPricingCalculator
Overrides:
priceItems in class ItemDiscountCalculator
Parameters:
pPriceQuotes - List of ItemPriceInfo with latest price details for the item
pItems - List of CommerceItem being priced
pPricingModel - RepositoryItem promotion, may be null
pLocale - Locale for pricing
pProfile - Profile for pricing
pOrder - Order for pricing
pExtraParameters - Optional Map of extra parameters
Throws:
PricingException - for problems during pricing

applyExistingGWP

public void applyExistingGWP(PricingContext pPricingContext,
                             java.util.List<ItemPriceInfo> pPriceQuotes,
                             java.util.Map pExtraParameters)
                      throws PricingException
Applies a zero fixed price adjustment to make any GWP quantity free on the item.
Only applies for automatic or selected GWP quantity.

Parameters:
pPricingContext - PricingContext for this pricing operation
pPriceQuotes - List of current ItemPriceInfo for items being priced
pExtraParameters - Optional Map of extra parameters
Throws:
PricingException - for problems during pricing

determineNextRangeMap

protected long determineNextRangeMap(QualifiedItem pQualifiedItem,
                                     long pQuantity,
                                     PricingContext pPricingContext,
                                     java.util.Map pExtraParametersMap)
                              throws PricingException
Updates the given qualified item detail map to apply the given quantity of discount.
Uses the Qualifier service to filter quantity not valid to be discounted.
Returns any discount quantity that could not be mapped.

Parameters:
pQualifiedItem - QualifiedItem containing the discount details
pQuantity - long quantity to discount
pPricingContext - PricingContext for this pricing operation
pExtraParametersMap - Optional Map of extra parameters
Returns:
quantity that was not available for discount
Throws:
PricingException