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.

Version:
$Id: //hosting-blueprint/B2CBlueprint/version/10.2.1/EStore/src/atg/projects/store/promotion/StoreGiftWithPurchaseFormHandler.java#2 $$Change: 788983 $
Author:
ATG

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  java.lang.String mAjaxMakeGiftSelectionErrorURL
          property: ajaxMakeGiftSelectionErrorURL
protected  java.lang.String mAjaxMakeGiftSelectionSuccessURL
          property: ajaxMakeGiftSelectionSuccessURL
protected  java.lang.String mAjaxMakeGiftSelectionTimeoutURL
          property: ajaxMakeGiftSelectionTimeoutURL
protected  StoreInventoryManager mInventoryManager
          property: inventoryManager
protected  StoreProfileTools mProfileTools
          property: profileTools
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
           
static java.lang.String MSG_ERROR_SELECTED_SKU_IS_INVALID
           
static java.lang.String SKU_PARAMETER
           
 
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()
           
 atg.repository.MutableRepository getCatalogRepository()
           
 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 setCatalogRepository(atg.repository.MutableRepository pCatalogRepository)
           
 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, isConcurrentUpdate, 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_SELECTED_SKU_IS_INVALID

public static final java.lang.String MSG_ERROR_SELECTED_SKU_IS_INVALID
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

SKU_PARAMETER

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

mAjaxMakeGiftSelectionSuccessURL

protected java.lang.String mAjaxMakeGiftSelectionSuccessURL
property: ajaxMakeGiftSelectionSuccessURL


mAjaxMakeGiftSelectionErrorURL

protected java.lang.String mAjaxMakeGiftSelectionErrorURL
property: ajaxMakeGiftSelectionErrorURL


mAjaxMakeGiftSelectionTimeoutURL

protected java.lang.String mAjaxMakeGiftSelectionTimeoutURL
property: ajaxMakeGiftSelectionTimeoutURL


mInventoryManager

protected StoreInventoryManager mInventoryManager
property: inventoryManager


mProfileTools

protected StoreProfileTools mProfileTools
property: profileTools

Constructor Detail

StoreGiftWithPurchaseFormHandler

public StoreGiftWithPurchaseFormHandler()
Method Detail

getRequiredSkuAttributes

public java.util.Map getRequiredSkuAttributes()
Returns:
a map of attributes user need to specify to define SKU, for example for clothing SKU it is color and size.

setRequiredSkuAttributes

public void setRequiredSkuAttributes(java.util.Map pRequiredSkuAttributes)
Parameters:
pRequiredSkuAttributes - - a map of attributes user need to specify to define SKU, for example for clothing SKU it is color and size.

getSkuType

public java.lang.String getSkuType()
Returns:
the SKU type.

setSkuType

public void setSkuType(java.lang.String pSkuType)
Parameters:
pSkuType - - the SKU type.

getAjaxMakeGiftSelectionSuccessURL

public java.lang.String getAjaxMakeGiftSelectionSuccessURL()
Returns:
the AJAX gift selection success URL.

setAjaxMakeGiftSelectionSuccessURL

public void setAjaxMakeGiftSelectionSuccessURL(java.lang.String pAjaxMakeGiftSelectionSuccessURL)
Parameters:
pAjaxMakeGiftSelectionSuccessURL - - the AJAX gift selection success URL.

getAjaxMakeGiftSelectionErrorURL

public java.lang.String getAjaxMakeGiftSelectionErrorURL()
Returns:
the AJAX gift selection error URL.

setAjaxMakeGiftSelectionErrorURL

public void setAjaxMakeGiftSelectionErrorURL(java.lang.String pAjaxMakeGiftSelectionErrorURL)
Parameters:
pAjaxMakeGiftSelectionErrorURL - - the AJAX gift selection error URL.

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.

getProfileTools

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

setProfileTools

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

getCatalogRepository

public atg.repository.MutableRepository getCatalogRepository()
Returns:
the value of the catalogRepository field.

setCatalogRepository

public void setCatalogRepository(atg.repository.MutableRepository pCatalogRepository)
Parameters:
pCatalogRepository - - the value of the catalogRepository: field.

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
Parameters:
pRequest - - the HTTP request parameter.
pResponse - - the HTTP response parameter.
Throws:
javax.servlet.ServletException - if servlet error occurs.
java.io.IOException - if there was an error with servlet io.

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 - - the HTTP request parameter.
pResponse - - the HTTP response parameter.
Throws:
javax.servlet.ServletException - if servlet error occurs.
java.io.IOException - if there was an error with servlet io.

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.