atg.commerce.pricing
Class PricingModelEvaluationSiteVetoer

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

public class PricingModelEvaluationSiteVetoer
extends GenericService
implements PricingModelEvaluationVetoer

Promotions site vetoer for pricing evaluation. Ensures that at pricing time only promotions that are valid for the current site are evaluated. The current site is taken from the extra parameters map if available otherwise the pricing context or failing that the current site context. The vetoer checks the current site against the promotion item's sites and siteGroups properties.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  java.lang.String mSiteConfigurationIdPropertyName
          Property for the String name of the site configuration id property name.
protected  java.lang.String mSiteGroupSitesPropertyName
          Property for the String name of the site group sites property name Defaults to 'sites'
 
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
PricingModelEvaluationSiteVetoer()
           
 
Method Summary
protected  boolean containsSiteId(java.lang.String pSiteId, java.util.Set pSites)
          Checks through the given set of site configuration items and returns true if any of them match the given id.
 java.lang.String getSiteConfigurationIdPropertyName()
           
 java.lang.String getSiteGroupSitesPropertyName()
           
 java.lang.Object prepareForVetoing(PricingEngineService pPricingEngine, PricingContext pPricingContext, java.util.Map pExtraParametersMap)
          Prepares the site vetoer for vetoing promotions.
 void setSiteConfigurationIdPropertyName(java.lang.String pSiteConfigurationIdPropertyName)
           
 void setSiteGroupSitesPropertyName(java.lang.String pSiteGroupSitesPropertyName)
           
 java.lang.String toString()
           
 java.lang.String vetoPromotion(PricingEngineService pPricingEngine, PricingContext pPricingContext, java.util.Map pExtraParametersMap, java.lang.Object pVetoParam)
          Allows the promotion in pPricingContext to be vetoed by site.
 
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, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mSiteGroupSitesPropertyName

protected java.lang.String mSiteGroupSitesPropertyName
Property for the String name of the site group sites property name Defaults to 'sites'


mSiteConfigurationIdPropertyName

protected java.lang.String mSiteConfigurationIdPropertyName
Property for the String name of the site configuration id property name. Defaults to 'id'

Constructor Detail

PricingModelEvaluationSiteVetoer

public PricingModelEvaluationSiteVetoer()
Method Detail

getSiteGroupSitesPropertyName

public java.lang.String getSiteGroupSitesPropertyName()

setSiteGroupSitesPropertyName

public void setSiteGroupSitesPropertyName(java.lang.String pSiteGroupSitesPropertyName)

getSiteConfigurationIdPropertyName

public java.lang.String getSiteConfigurationIdPropertyName()

setSiteConfigurationIdPropertyName

public void setSiteConfigurationIdPropertyName(java.lang.String pSiteConfigurationIdPropertyName)

prepareForVetoing

public java.lang.Object prepareForVetoing(PricingEngineService pPricingEngine,
                                          PricingContext pPricingContext,
                                          java.util.Map pExtraParametersMap)

Prepares the site vetoer for vetoing promotions.

This allows a vetoer to get the site id to veto against.

Specified by:
prepareForVetoing in interface PricingModelEvaluationVetoer
Parameters:
pPricingEngine - PricingEngineService that called this vetoer
pPricingContext - PricingContext for this pricing operation
pExtraParametersMap - Map of extra parameters if needed
Returns:
Object that will be passed into vetoPromotion or null if this vetoer should not be used.
See Also:
vetoPromotion(PricingEngineService, PricingContext, Map, Object)

vetoPromotion

public java.lang.String vetoPromotion(PricingEngineService pPricingEngine,
                                      PricingContext pPricingContext,
                                      java.util.Map pExtraParametersMap,
                                      java.lang.Object pVetoParam)

Allows the promotion in pPricingContext to be vetoed by site.

This vetoer uses the passed in pVetoParam site id to decide whether the promotion should be vetoed by comparing it against the promotion.sites and siteGroups properties.

Specified by:
vetoPromotion in interface PricingModelEvaluationVetoer
Parameters:
pPricingEngine - PricingEngineService that called this vetoer
pPricingContext - PricingContext including the promotion to be checked
pExtraParametersMap - Map of extra parameters if needed
pVetoParam - Object returned by prepareForVetoing method, guaranteed to not be null.
Returns:
null if the promotion should not be vetoed else a String describing why the promotion was vetoed.
See Also:
prepareForVetoing(PricingEngineService, PricingContext, Map)

containsSiteId

protected boolean containsSiteId(java.lang.String pSiteId,
                                 java.util.Set pSites)
Checks through the given set of site configuration items and returns true if any of them match the given id.

Parameters:
pSiteId - String id to match
pSites - Set of siteConfiguration repository items
Returns:
true if any sites match

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String describing this vetoer.