atg.projects.store.promotion
Class StoreGiftWithPurchaseFormHandler

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.droplet.EmptyFormHandler
              extended by atg.droplet.GenericFormHandler
                  extended by atg.commerce.order.purchase.PurchaseProcessFormHandler
                      extended by atg.commerce.promotion.GiftWithPurchaseFormHandler
                          extended by atg.projects.store.promotion.StoreGiftWithPurchaseFormHandler
All Implemented Interfaces:
atg.commerce.util.PipelineErrorHandler, atg.droplet.DropletFormHandler, atg.naming.AbsoluteNameable, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameContextParentable, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.Configured, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener

public class StoreGiftWithPurchaseFormHandler
extends atg.commerce.promotion.GiftWithPurchaseFormHandler

CRS extension of core commerce GiftWithPurchaseFormHandler


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  java.lang.String mAjaxMakeGiftSelectionErrorURL
           
protected  java.lang.String mAjaxMakeGiftSelectionSuccessURL
           
protected  java.lang.String mAjaxMakeGiftSelectionTimeoutURL
           
protected  StoreInventoryManager mInventoryManager
           
protected  StoreProfileTools mProfileTools
           
static java.lang.String MSG_ERROR_GIFT_OUT_OF_STOCK
           
static java.lang.String MSG_ERROR_SELECT_COLOR
           
static java.lang.String MSG_ERROR_SELECT_GIFT
           
static java.lang.String MSG_ERROR_SELECT_PRODUCT
           
static java.lang.String MSG_ERROR_SELECT_PRODUCT_AND_SKU
           
static java.lang.String MSG_ERROR_SELECT_SIZE
           
static java.lang.String MSG_ERROR_SELECT_SKU
           
static java.lang.String MSG_ERROR_SELECT_WOOD_FINISH
           
 
Fields inherited from class atg.commerce.promotion.GiftWithPurchaseFormHandler
mCommerceItemType, mCurrentSelectedItemId, mExtraParameters, mGiftHashCode, mGwpManager, mMakeGiftSelectionErrorURL, mMakeGiftSelectionSuccessURL, mProductId, mPromotionId, mQuantity, mRemoveAllSelectableQuantityErrorURL, mRemoveAllSelectableQuantitySuccessURL, mRemoveSelectableQuantityErrorURL, mRemoveSelectableQuantitySuccessURL, mReplaceFailedQuantity, mReplaceRemovedQuantity, mSelectableQuantityToRemove, MSG_ERROR_MAKE_GIFT_SELECTION, MSG_ERROR_REMOVE_SELECTABLE_QUANTITY, mShippingGroup, mSiteId, mSkuId
 
Fields inherited from class atg.commerce.order.purchase.PurchaseProcessFormHandler
LOCK_NAME_ATTRIBUTE_NAME, PARAM_TRANSACTION_CREATED, PARAM_VALUE_TRUE
 
Fields inherited from class atg.droplet.GenericFormHandler
PARAM_DEFER_FORWARD_OR_REDIRECT, PARAM_USE_FORWARDS
 
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
StoreGiftWithPurchaseFormHandler()
           
 
Method Summary
 boolean checkFormRedirect(java.lang.String pSuccessURL, java.lang.String pFailureURL, atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
           If the request is a form submission from: A non-transient user who is not currently logged in. A transient user who is using a brand new session or if their shopping cart is empty. Redirect to a session expiration URL.
 java.lang.String getAjaxMakeGiftSelectionErrorURL()
           
 java.lang.String getAjaxMakeGiftSelectionSuccessURL()
           
 java.lang.String getAjaxMakeGiftSelectionTimeoutURL()
           
 StoreInventoryManager getInventoryManager()
           
 StoreProfileTools getProfileTools()
           
 java.util.Map getRequiredSkuAttributes()
           
 java.lang.String getSkuType()
           
 boolean handleMakeGiftSelection(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Check if this is an AJAX request first and update success/error URLs
 void preMakeGiftSelection(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Set valid SKU ID based on selected Product
 void setAjaxMakeGiftSelectionErrorURL(java.lang.String pAjaxMakeGiftSelectionErrorURL)
           
 void setAjaxMakeGiftSelectionSuccessURL(java.lang.String pAjaxMakeGiftSelectionSuccessURL)
           
 void setAjaxMakeGiftSelectionTimeoutURL(java.lang.String pAjaxMakeGiftSelectionTimeoutURL)
           
 void setInventoryManager(StoreInventoryManager pInventoryManager)
           
 void setProfileTools(StoreProfileTools pProfileTools)
           
 void setRequiredSkuAttributes(java.util.Map pRequiredSkuAttributes)
           
 void setSkuType(java.lang.String pSkuType)
           
protected  void validateAjaxSelection(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Validate selection has been made via AJAX and choose appropriate selection based on missed SKU attributes.
 
Methods inherited from class atg.commerce.promotion.GiftWithPurchaseFormHandler
getCatalogKey, getCommerceItemType, getCurrentSelectedItemId, getExtraParameters, getGiftHashCode, getGwpManager, getMakeGiftSelectionErrorURL, getMakeGiftSelectionSuccessURL, getPricingContext, getProductId, getPromotionId, getQuantity, getRemoveAllSelectableQuantityErrorURL, getRemoveAllSelectableQuantitySuccessURL, getRemoveSelectableQuantityErrorURL, getRemoveSelectableQuantitySuccessURL, getReplaceFailedQuantity, getReplaceRemovedQuantity, getSelectableQuantityToRemove, getShippingGroup, getSiteId, getSkuId, handleRemoveAllSelectableQuantity, handleRemoveSelectableQuantity, makeGiftSelection, postMakeGiftSelection, postRemoveAllSelectableQuantity, postRemoveSelectableQuantity, preRemoveAllSelectableQuantity, preRemoveSelectableQuantity, removeAllSelectableQuantity, removeSelectableQuantity, setCommerceItemType, setCurrentSelectedItemId, setExtraParameters, setGiftHashCode, setGwpManager, setMakeGiftSelectionErrorURL, setMakeGiftSelectionSuccessURL, setProductId, setPromotionId, setQuantity, setRemoveAllSelectableQuantityErrorURL, setRemoveAllSelectableQuantitySuccessURL, setRemoveSelectableQuantityErrorURL, setRemoveSelectableQuantitySuccessURL, setReplaceFailedQuantity, setReplaceRemovedQuantity, setSelectableQuantityToRemove, setShippingGroup, setSiteId, setSkuId, updateOrder
 
Methods inherited from class atg.commerce.order.purchase.PurchaseProcessFormHandler
acquireTransactionLock, acquireTransactionLock, afterSet, beforeSet, commitTransaction, copyConfiguration, createRepriceParameterMap, defaultLocalLockManager, defaultUserProfile, doStartService, ensureTransaction, formatUserMessage, formatUserMessage, formatUserMessage, formatUserMessage, generatePropertyPath, getClaimableManager, getCommerceIdentifierPaymentInfoContainer, getCommerceItemManager, getCommerceItemShippingInfoContainer, getCommerceProfileTools, getCommercePropertyManager, getConfiguration, getCurrentTransaction, getDefaultLocale, getGiftlistManager, getHandlingInstructionManager, getLocalLockManager, getOrder, getOrderManager, getPaymentGroupManager, getPaymentGroupMapContainer, getPipelineManager, getPriceList, getPriceListId, getPriceListManager, getProfile, getProfileRepository, getPurchaseProcessHelper, getRepeatingRequestMonitor, getRepriceOrderChainId, getResourceBundle, getResourceBundle, getResourceBundleName, getSessionExpirationURL, getShippingGroupManager, getShippingGroupMapContainer, getShoppingCart, getTransactionManager, getUserLocale, getUserLocale, getUserPricingModels, handlePipelineError, isEnsureTransaction, isFormSubmission, isTransactionCreated, isTransactionMarkedAsRollBack, isUseLocksAroundTransactions, isUseRequestLocale, processException, processPipelineErrors, releaseTransactionLock, releaseTransactionLock, runProcess, runProcess, runProcess, runProcessRepriceOrder, runProcessRepriceOrder, runRepricingProcess, setClaimableManager, setCommerceIdentifierPaymentInfoContainer, setCommerceItemManager, setCommerceItemShippingInfoContainer, setCommerceProfileTools, setCommercePropertyManager, setConfiguration, setCurrentTransaction, setDefaultLocale, setEnsureTransaction, setGiftlistManager, setHandlingInstructionManager, setLocalLockManager, setOrder, setOrderManager, setPaymentGroupManager, setPaymentGroupMapContainer, setPipelineManager, setPriceListId, setPriceListManager, setProfile, setProfileRepository, setPurchaseProcessHelper, setRepeatingRequestMonitor, setRepriceOrderChainId, setSessionExpirationURL, setShippingGroupManager, setShippingGroupMapContainer, setShoppingCart, setTransactionCreated, setTransactionManager, setTransactionToRollbackOnly, setUseLocksAroundTransactions, setUseRequestLocale, setUserLocale, setUserPricingModels, transactionLockName, unsetTransactionCreated
 
Methods inherited from class atg.droplet.GenericFormHandler
addFormException, addUncheckedFormException, 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
 
Methods inherited from class atg.droplet.EmptyFormHandler
afterGet, beforeGet
 
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

MSG_ERROR_GIFT_OUT_OF_STOCK

public static final java.lang.String MSG_ERROR_GIFT_OUT_OF_STOCK
See Also:
Constant Field Values

MSG_ERROR_SELECT_PRODUCT

public static final java.lang.String MSG_ERROR_SELECT_PRODUCT
See Also:
Constant Field Values

MSG_ERROR_SELECT_SKU

public static final java.lang.String MSG_ERROR_SELECT_SKU
See Also:
Constant Field Values

MSG_ERROR_SELECT_GIFT

public static final java.lang.String MSG_ERROR_SELECT_GIFT
See Also:
Constant Field Values

MSG_ERROR_SELECT_PRODUCT_AND_SKU

public static final java.lang.String MSG_ERROR_SELECT_PRODUCT_AND_SKU
See Also:
Constant Field Values

MSG_ERROR_SELECT_COLOR

public static final java.lang.String MSG_ERROR_SELECT_COLOR
See Also:
Constant Field Values

MSG_ERROR_SELECT_SIZE

public static final java.lang.String MSG_ERROR_SELECT_SIZE
See Also:
Constant Field Values

MSG_ERROR_SELECT_WOOD_FINISH

public static final java.lang.String MSG_ERROR_SELECT_WOOD_FINISH
See Also:
Constant Field Values

mAjaxMakeGiftSelectionSuccessURL

protected java.lang.String mAjaxMakeGiftSelectionSuccessURL

mAjaxMakeGiftSelectionErrorURL

protected java.lang.String mAjaxMakeGiftSelectionErrorURL

mAjaxMakeGiftSelectionTimeoutURL

protected java.lang.String mAjaxMakeGiftSelectionTimeoutURL

mInventoryManager

protected StoreInventoryManager mInventoryManager

mProfileTools

protected StoreProfileTools mProfileTools
Constructor Detail

StoreGiftWithPurchaseFormHandler

public StoreGiftWithPurchaseFormHandler()
Method Detail

getRequiredSkuAttributes

public java.util.Map getRequiredSkuAttributes()
Returns:
map of required SKU attributes

setRequiredSkuAttributes

public void setRequiredSkuAttributes(java.util.Map pRequiredSkuAttributes)
Parameters:
pRequiredSkuAttributes - set map of attributes

getSkuType

public java.lang.String getSkuType()

setSkuType

public void setSkuType(java.lang.String pSkuType)

getAjaxMakeGiftSelectionSuccessURL

public java.lang.String getAjaxMakeGiftSelectionSuccessURL()

setAjaxMakeGiftSelectionSuccessURL

public void setAjaxMakeGiftSelectionSuccessURL(java.lang.String pAjaxMakeGiftSelectionSuccessURL)

getAjaxMakeGiftSelectionErrorURL

public java.lang.String getAjaxMakeGiftSelectionErrorURL()

setAjaxMakeGiftSelectionErrorURL

public void setAjaxMakeGiftSelectionErrorURL(java.lang.String pAjaxMakeGiftSelectionErrorURL)

getAjaxMakeGiftSelectionTimeoutURL

public java.lang.String getAjaxMakeGiftSelectionTimeoutURL()
Returns:
The URL that holds the json session timeout object data.

setAjaxMakeGiftSelectionTimeoutURL

public void setAjaxMakeGiftSelectionTimeoutURL(java.lang.String pAjaxMakeGiftSelectionTimeoutURL)
Parameters:
pAjaxMakeGiftSelectionTimeoutURL - The URL that holds the json session timeout object data.

getInventoryManager

public StoreInventoryManager getInventoryManager()
Returns:
the inventoryManager.

setInventoryManager

public void setInventoryManager(StoreInventoryManager pInventoryManager)
Parameters:
pInventoryManager - - the inventoryManager to set.

getProfileTools

public StoreProfileTools getProfileTools()
Returns:
The profile tools utility class.

setProfileTools

public void setProfileTools(StoreProfileTools pProfileTools)
Parameters:
pProfileTools - The profile tools utility class.

preMakeGiftSelection

public void preMakeGiftSelection(atg.servlet.DynamoHttpServletRequest pRequest,
                                 atg.servlet.DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
Set valid SKU ID based on selected Product

Overrides:
preMakeGiftSelection in class atg.commerce.promotion.GiftWithPurchaseFormHandler
Throws:
javax.servlet.ServletException
java.io.IOException

handleMakeGiftSelection

public boolean handleMakeGiftSelection(atg.servlet.DynamoHttpServletRequest pRequest,
                                       atg.servlet.DynamoHttpServletResponse pResponse)
                                throws javax.servlet.ServletException,
                                       java.io.IOException
Check if this is an AJAX request first and update success/error URLs

Overrides:
handleMakeGiftSelection in class atg.commerce.promotion.GiftWithPurchaseFormHandler
Throws:
javax.servlet.ServletException
java.io.IOException

validateAjaxSelection

protected void validateAjaxSelection(atg.servlet.DynamoHttpServletRequest pRequest,
                                     atg.servlet.DynamoHttpServletResponse pResponse)
                              throws javax.servlet.ServletException,
                                     java.io.IOException
Validate selection has been made via AJAX and choose appropriate selection based on missed SKU attributes.

Parameters:
pRequest -
pResponse -
Throws:
javax.servlet.ServletException
java.io.IOException

checkFormRedirect

public boolean checkFormRedirect(java.lang.String pSuccessURL,
                                 java.lang.String pFailureURL,
                                 atg.servlet.DynamoHttpServletRequest pRequest,
                                 atg.servlet.DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException

If the request is a form submission from:

Redirect to a session expiration URL. Otherwise allow the super-class to determine redirect URL.

Overrides:
checkFormRedirect in class atg.commerce.order.purchase.PurchaseProcessFormHandler
Parameters:
pSuccessURL - a String value
pFailureURL - a String value
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
If redirect (for whatever reason) to a new page occurred, return false. If NO redirect occurred, return true.
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io