public class CouponFormHandler extends GenericFormHandler
The handleClaimCoupon method is responsible for actually doing the work and obtaining the promotion.
PromotionTools
,
ClaimableTools
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
PARAM_DEFER_FORWARD_OR_REDIRECT, PARAM_USE_FORWARDS
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
CouponFormHandler()
Empty Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkPromotionType(RepositoryItem pPromotion)
Checks to see if the type of the promotion is valid.
|
protected void |
claimCoupon(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Claim the coupon.
|
ClaimableManager |
getClaimableManager()
Return the ClaimableManager property.
|
ClaimableTools |
getClaimableTools()
Return the ClaimableTools property.
|
java.lang.String |
getClaimCouponErrorURL()
Return the claimCouponErrorURL property.
|
java.lang.String |
getClaimCouponSuccessURL()
Return the claimCouponSuccessURL property.
|
java.lang.String |
getCouponClaimCode()
Return the couponClaimCode property.
|
Profile |
getProfile()
Return the Profile property.
|
PromotionTools |
getPromotionTools()
Return the PromotionTools property.
|
protected java.util.ResourceBundle |
getResourceBundle()
Returns the error message ResourceBundle
|
protected java.util.ResourceBundle |
getResourceBundle(java.util.Locale pLocale)
This method returns ResourceBundle object for specified locale.
|
protected java.lang.String |
getResourceBundleName()
Returns the name of the error message ResourceBundle
|
javax.transaction.TransactionManager |
getTransactionManager()
Return the TransactionManager property.
|
java.lang.String |
getTransactionType()
Return the TransactionType property.
|
protected java.util.Locale |
getUserLocale(DynamoHttpServletRequest pRequest)
Obtain the users locale by examining the request object first and then
getting the default Locale object.
|
java.lang.String[] |
getValidCouponItemTypes()
The list of acceptable item types for promotions when claiming a
coupon.
|
boolean |
handleClaimCoupon(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Method that is invoked to claim a coupon.
|
protected void |
processError(java.lang.String pErrorCodeId,
java.lang.Exception e,
DynamoHttpServletRequest pRequest)
If an error occurs, this method will obtain the correct Msg resource
string based upon the users locale from the getUserLocale method.
|
void |
setClaimableManager(ClaimableManager pClaimableManager)
Set the ClaimableManager property.
|
void |
setClaimableTools(ClaimableTools pClaimableTools)
Set the ClaimableTools property.
|
void |
setClaimCouponErrorURL(java.lang.String pClaimCouponErrorURL)
Set the claimCouponErrorURL property.
|
void |
setClaimCouponSuccessURL(java.lang.String pClaimCouponSuccessURL)
Set the claimCouponSuccessURL property.
|
void |
setCouponClaimCode(java.lang.String pCouponClaimCode)
Set the couponClaimCode property.
|
void |
setProfile(Profile pProfile)
Set the Profile property.
|
void |
setPromotionTools(PromotionTools pPromotionTools)
Set the PromotionTools property.
|
void |
setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Set the TransactionManager property.
|
void |
setTransactionType(java.lang.String pTransactionType)
Set the TransactionType property.
|
void |
setValidCouponItemTypes(java.lang.String[] pValidCouponItemTypes) |
addFormException, addUncheckedFormException, afterSet, beforeSet, checkFormRedirect, createFormSubmissionMessage, getCancelURL, getCheckForValidSession, getFormError, getFormExceptions, getFormName, getMessagePort, getMessageSource, getMessageType, getPropertyExceptions, getSendMessages, getUncheckedFormExceptions, handleCancel, handleFormException, handleUncheckedFormException, hasUncheckedFormExceptions, isDeferForwardsAndRedirects, isRestorableForm, isUseForwards, isValidSession, redirectOrForward, resetFormExceptions, setCancelURL, setCheckForValidSession, setDeferForwardsAndRedirects, setFormName, setMessagePort, setMessageSource, setMessageType, setRestorableForm, setSendMessages, setUseForwards
afterGet, beforeGet
addLogListener, createAdminServlet, doStartService, 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
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
public javax.transaction.TransactionManager getTransactionManager()
public void setTransactionType(java.lang.String pTransactionType)
public java.lang.String getTransactionType()
public void setClaimableTools(ClaimableTools pClaimableTools)
public ClaimableTools getClaimableTools()
public void setClaimCouponSuccessURL(java.lang.String pClaimCouponSuccessURL)
public java.lang.String getClaimCouponSuccessURL()
public void setClaimCouponErrorURL(java.lang.String pClaimCouponErrorURL)
public java.lang.String getClaimCouponErrorURL()
public void setCouponClaimCode(java.lang.String pCouponClaimCode)
public java.lang.String getCouponClaimCode()
public void setProfile(Profile pProfile)
public Profile getProfile()
public void setPromotionTools(PromotionTools pPromotionTools)
public PromotionTools getPromotionTools()
public void setClaimableManager(ClaimableManager pClaimableManager)
public ClaimableManager getClaimableManager()
public void setValidCouponItemTypes(java.lang.String[] pValidCouponItemTypes)
public java.lang.String[] getValidCouponItemTypes()
handleClaimCoupon
protected java.util.ResourceBundle getResourceBundle()
protected java.util.ResourceBundle getResourceBundle(java.util.Locale pLocale)
pLocale
- The locale used to retrieve the resource bundle. If null
then the default resource bundle is returned.protected java.lang.String getResourceBundleName()
protected void claimCoupon(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws ClaimableException
pRequest
- a value of type 'DynamoHttpServletRequest'pResponse
- a value of type 'DynamoHttpServletResponse'ClaimableException
public boolean handleClaimCoupon(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
pRequest
- a value of type 'DynamoHttpServletRequest'pResponse
- a value of type 'DynamoHttpServletResponse'javax.servlet.ServletException
- if an error occursjava.io.IOException
- if an error occursprotected void processError(java.lang.String pErrorCodeId, java.lang.Exception e, DynamoHttpServletRequest pRequest) throws javax.servlet.ServletException, java.io.IOException
pErrorCodeId
- the error key that is used to obtain the error stringjavax.servlet.ServletException
java.io.IOException
protected java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest) throws javax.servlet.ServletException, java.io.IOException
pRequest
- a value of type 'DynamoHttpServletRequest'javax.servlet.ServletException
- if an error occursjava.io.IOException
- if an error occurspublic boolean checkPromotionType(RepositoryItem pPromotion)
validCouponItemTypes
pPromotion
- validCouponItemTypes
list.