atg.commerce.promotion
Class PromotionServlet

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.servlet.pipeline.PipelineableServletImpl
                  extended by atg.servlet.pipeline.InsertableServletImpl
                      extended by atg.commerce.promotion.PromotionServlet
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, InsertableServlet, PipelineableServlet, java.util.EventListener, javax.servlet.Servlet

public class PromotionServlet
extends InsertableServletImpl

The PromotionServlet allows a promotion to be added to a users profile via a URL. It must be in the servlet pipeline for this to work. If it is in the servlet pipeline and enabled is true then the following example demonstrates how to use PromotionServlet:

 <a href="../../whatever.jhtml" encode="true"> 
   <param name="PROMO" value="promo10102"> 
   Click here to get 20% discount on shirts... 
 </a> 
 

Note: First, encode=true is required otherwise the parameter is added as a query parameter and not a url parameter and it won't work Second, value for the param tag is the promotion id in the /atg/commerce/pricing/Promotions repository for item descriptor(s) given in property promotionItemDescriptorNames.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  java.lang.String mPromotionParameter
           
 
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
PromotionServlet()
           
 
Method Summary
 java.lang.String getProfile()
          The profile that the promotion will be added to.
 java.lang.String[] getPromotionItemDescriptorNames()
          These are the names of the valid promotion item descriptors
 java.lang.String getPromotionParameter()
          This is the name of the request parameter than contains the promotion.
 Repository getPromotionRepository()
          This is the repository that contains the promotions
 PromotionTools getPromotionTools()
          This is a helper class for manipulating promotions
 boolean isEnabled()
          If enabled is true, then this servlet is "active" in that it will look for a PROMO parameter to add to the current profile.
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          The service method that looks for the PROMO parameter and adds it to the profile, before pass the request to the next servlet in the pipeline.
 void setEnabled(boolean pEnabled)
           
 void setProfile(java.lang.String pProfile)
           
 void setPromotionItemDescriptorNames(java.lang.String[] pPromotionItemDescriptorNames)
           
 void setPromotionParameter(java.lang.String pPromotionParameter)
           
 void setPromotionRepository(Repository pPromotionRepository)
           
 void setPromotionTools(PromotionTools pPromotionTools)
           
 
Methods inherited from class atg.servlet.pipeline.InsertableServletImpl
doStartService, getInsertAfterServlet, setInsertAfterServlet
 
Methods inherited from class atg.servlet.pipeline.PipelineableServletImpl
createAdminServlet, destroy, getAdminServlet, getNextServlet, getServletConfig, getServletInfo, init, isUsePathInfo, passRequest, passRequest, service, service, setNextServlet, setServletInfo, setUsePathInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, doStopService, getAbsoluteName, 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
 
Methods inherited from interface atg.servlet.pipeline.PipelineableServlet
getNextServlet, passRequest, setNextServlet
 
Methods inherited from interface javax.servlet.Servlet
destroy, getServletConfig, getServletInfo, init, service
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mPromotionParameter

protected java.lang.String mPromotionParameter
Constructor Detail

PromotionServlet

public PromotionServlet()
Method Detail

setProfile

public void setProfile(java.lang.String pProfile)

getProfile

public java.lang.String getProfile()
The profile that the promotion will be added to. By default this is the profile located at /atg/userprofiling/Profile


setPromotionParameter

public void setPromotionParameter(java.lang.String pPromotionParameter)

getPromotionParameter

public java.lang.String getPromotionParameter()
This is the name of the request parameter than contains the promotion. By default this is PROMO


setPromotionRepository

public void setPromotionRepository(Repository pPromotionRepository)

getPromotionRepository

public Repository getPromotionRepository()
This is the repository that contains the promotions


setPromotionItemDescriptorNames

public void setPromotionItemDescriptorNames(java.lang.String[] pPromotionItemDescriptorNames)

getPromotionItemDescriptorNames

public java.lang.String[] getPromotionItemDescriptorNames()
These are the names of the valid promotion item descriptors


setPromotionTools

public void setPromotionTools(PromotionTools pPromotionTools)

getPromotionTools

public PromotionTools getPromotionTools()
This is a helper class for manipulating promotions


setEnabled

public void setEnabled(boolean pEnabled)

isEnabled

public boolean isEnabled()
If enabled is true, then this servlet is "active" in that it will look for a PROMO parameter to add to the current profile.


service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws java.io.IOException,
                    javax.servlet.ServletException
The service method that looks for the PROMO parameter and adds it to the profile, before pass the request to the next servlet in the pipeline.

Overrides:
service in class PipelineableServletImpl
Throws:
java.io.IOException - if an error occurred while reading or writing the servlet request
javax.servlet.ServletException - if an error occurred while processing the servlet request