atg.commerce.order
Class OrderModifierFormHandler

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.OrderModifierFormHandler
All Implemented Interfaces:
atg.commerce.util.PipelineErrorHandler, DropletFormHandler, atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener
Direct Known Subclasses:
ShoppingCartFormHandler

public abstract class OrderModifierFormHandler
extends GenericFormHandler
implements atg.commerce.util.PipelineErrorHandler

This abstract class defines the FormHandling functionality necessary in order to manager Order modifications for existing or new orders.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static java.lang.String ERROR_MISSING_LOCK_MANAGER
           
protected static java.lang.String ERROR_MISSING_LOCK_PROFILE
           
protected static java.lang.String ERROR_MISSING_TRANSACTION_MANAGER
           
protected static java.lang.String MSG_CONCURRENT_UPDATE_ATTEMPT
           
protected static java.lang.String MSG_ERROR_ADDING_TO_ORDER
           
protected static java.lang.String MSG_ERROR_REMOVING_FROM_ORDER
           
protected static java.lang.String MSG_ERROR_REMOVING_RROM_ORDER
           
protected static java.lang.String MSG_NO_ITEM_FOUND
           
protected static java.lang.String MSG_NO_ITEMS_TO_ADD
           
protected static java.lang.String MSG_NO_ORDER_TO_MODIFY
           
protected static java.lang.String MSG_NO_SKU_WITH_ID
           
protected static java.lang.String MSG_QUANTITY_LESSTHAN_OR_EQUALTO_ZERO
           
protected static java.lang.String PARAM_TRANSACTION_CREATED
           
protected static java.lang.String 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
OrderModifierFormHandler()
          Constructs an instanceof OrderModifierFormHandler
 
Method Summary
protected  void acquireTransactionLock()
          Attempt to acquire a local lock before creating a transaction that may modify the order, but only if useLocksAroundTransactions is set to true.
 CommerceItem addNewItemToOrder(Order pOrder, java.lang.String pCatalogRefId, java.lang.String pProductId, long pQuantity, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Adds the designated item to the given order.
 boolean afterSet(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Commit or roll back any transaction created in beforeSet, and release any lock that was acquired at the time.
 boolean beforeSet(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Create a transaction if necessary at the beginning of the form submission process, optionally obtaining a local lock to prevent multiple forms from creating transactions that may modify the same order.
 boolean checkFormRedirect(java.lang.String pSuccessURL, java.lang.String pFailureURL, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          If the transaction is marked as rollback, then redirect to the FailureURL, otherwise allow the super-class behavior to perform.
protected  void commitTransaction(javax.transaction.Transaction pTransaction)
          Commits the supplied transaction
 CommerceItem createCommerceItem(java.lang.String pCatalogRefId, java.lang.Object pCatalogRef, java.lang.String pProductId, java.lang.Object pProductRef, long pQuantity)
          With the given parameters create a new CommerceItem that will be added to the order.
protected  ClientLockManager defaultLocalLockManager(boolean pSetLocalLockManager)
          Get the default local lock manager to use if localLockManager has not been set.
protected  RepositoryItem defaultUserProfile(boolean pSetProfile)
          Get the default user profile to use if profile has not been set.
protected  javax.transaction.Transaction ensureTransaction()
          This method ensures that a transaction exists before returning.
 CommerceItem findCommerceItem(Order pOrder, java.lang.String pCatalogRefId)
          Deprecated. This method should no longer be used. Instead call Order.findCommerceItemsByCatalogRefId(String)
 java.lang.String formatUserMessage(java.lang.String pKey, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Utility method to format a message with no arguments using the Locale of the user
 java.lang.String formatUserMessage(java.lang.String pKey, java.lang.Object[] pParams, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Utility method to format a message with two arguments using our resource bundle.
 java.lang.String formatUserMessage(java.lang.String pKey, java.lang.Object pParam, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Utility method to format a message with one argument using the Locale of the user
 java.lang.String formatUserMessage(java.lang.String pKey, java.lang.Object pParam1, java.lang.Object pParam2, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Utility method to format a message with two arguments using our resource bundle.
 java.lang.String generatePropertyPath(java.lang.String pPropertyName)
          Returns a Nucleus property path which can be used in a DropletFormException
 Address getAddress()
          Returns an address bean to be used when modifying an address for a shipping or a billing group
 java.lang.String[] getCatalogRefIds()
          Returns property CatalogRefIds
 CatalogTools getCatalogTools()
          Returns property CatalogTools
 CreditCard getCreditCard()
          Returns credit card bean to use for modifying of billing groups
 javax.transaction.Transaction getCurrentTransaction()
          Returns property currentTransaction
 java.util.Locale getDefaultLocale()
          Returns property DefaultLocale.
 java.lang.String getGeneralFailureURL()
          Returns A Generic bean to store a failure URL into
 java.lang.String getGeneralSuccessURL()
          Returns A Geneneric bean to store a success URL into
 GiftCertificate getGiftCertificate()
          Returns gift certificate bean to use for modifying of billing grps
 HardgoodShippingGroup getHardgoodShippingGroup()
          Returns hardgood shipping group bean
 ClientLockManager getLocalLockManager()
          Deprecated. Use the TransactionLockFactory instead
 Order getOrder()
          Returns property Order
 SimpleOrderManager getOrderManager()
          Returns property OrderManager
 PaymentGroup getPaymentGroup()
          Returns payment group bean to use for modifiing payment groups
 PipelineManager getPipelineManager()
          Returns property PipelineManager
 java.lang.String getProductId()
          Returns property ProductId
 RepositoryItem getProfile()
          Returns property Profile
 long getQuantity()
          Returns property Quantity
 long getQuantity(java.lang.String pCatalogRefId, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Retrieve the quanity that should be used for the given item.
protected  java.util.ResourceBundle getResourceBundle()
          Returns the error message ResourceBundle
protected  java.lang.String getResourceBundleName()
          Returns the name of the error message ResourceBundle
 ShippingGroup getShippingGroup()
          Returns shipping group bean to use for modifying the shipping groups
 TransactionLockFactory getTransactionLockFactory()
          The transactionLockFactory is used to get the locks if useLocksArountTransactions is true
 javax.transaction.TransactionManager getTransactionManager()
          Returns property TransactionManager
 java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns the locale associated with the request.
 boolean handleAddItemToOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
           
 void handlePipelineError(java.lang.Object pError, java.lang.String pErrorKey)
          Add a pipeline error to the list of form exceptions.
 boolean handleRemoveItemFromOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
           
 boolean handleSetOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
           
 boolean isEnsureTransaction()
          Returns property EnsureTransaction
protected  boolean isStringEmpty(java.lang.String pString)
           
protected  boolean isTransactionCreated(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
           
protected  boolean isTransactionMarkedAsRollBack()
          Returns true if the transaction associated with the current thread is marked for rollback.
 boolean isUseLocksAroundTransactions()
          Deprecated. Use the TransactionLockFactory instead
 boolean isUseRequestLocale()
          Returns property UseRequestLocale
 void processException(java.lang.Exception pException, java.lang.String pMsgId, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Add a user error message to the form exceptions, and then display the exception in the logs
protected  boolean processPipelineErrors(PipelineResult pResult)
          Examine the pipeline result looking for any error messages, creates DropletExceptions and adds them as form exceptions
protected  void releaseTransactionLock()
          Attempt to release the local lock that was acquired before creating a transaction that may have modified the order, but only if useLocksAroundTransactions is set to true.
 boolean removeItemFromOrder(Order pOrder, java.lang.String pItemId, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This simply calls OrderManager's removeItemFromOrder method with the given order and item ID
protected  PipelineResult runProcess(java.lang.String pChainId, java.util.Map pParameters)
          Executes a Pipeline Chain.
protected  PipelineResult runProcess(java.lang.String pChainId, Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Executes a Pipeline Chain and places the supplies method parameters into a HashMap which is supplied to the chain to execute.
protected  PipelineResult runProcess(java.lang.String pChainId, Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pParameters, java.util.Map pExtraParameters)
          Executes a Pipeline Chain and places the supplies method parameters into a HashMap which is supplied to the chain to execute.
 void setAddress(Address pAddress)
          Sets an address bean to be used when modifying an address for a shipping or a billing group
 void setCatalogRefIds(java.lang.String[] pCatalogRefIds)
          Sets property CatalogRefIds
 void setCatalogTools(CatalogTools pCatalogTools)
          Sets property CatalogTools
 void setCreditCard(CreditCard pCreditCard)
          Sets credit card bean to use for modifying of billing groups
 void setCurrentTransaction(javax.transaction.Transaction pCurrentTransaction)
          Sets property currentTransaction
 void setDefaultLocale(java.util.Locale pDefaultLocale)
          Sets property DefaultLocale
 void setEnsureTransaction(boolean pEnsureTransaction)
          Sets property EnsureTransaction
 void setGeneralFailureURL(java.lang.String pGeneralFailureURL)
          Sets A Generic bean to store a failure URL into
 void setGeneralSuccessURL(java.lang.String pGeneralSuccessURL)
          Sets A Geneneric bean to store a success URL into
 void setGiftCertificate(GiftCertificate pGiftCertificate)
          Sets gift certificate bean to use for modifying of billing grps
 void setHardgoodShippingGroup(HardgoodShippingGroup pHardgoodShippingGroup)
          Sets hardgood shipping group bean
 void setLocalLockManager(ClientLockManager pLocalLockManager)
          Deprecated. Use the TransactionLockFactory instead
 void setOrder(Order pOrder)
          Sets property Order
 void setOrderManager(SimpleOrderManager pOrderManager)
          Sets property OrderManager
 void setPaymentGroup(PaymentGroup pPaymentGroup)
          Sets payment group bean to use for modifiing payment groups
 void setPipelineManager(PipelineManager pPipelineManager)
          Sets property PipelineManager
 void setProductId(java.lang.String pProductId)
          Sets property ProductId
 void setProfile(RepositoryItem pProfile)
          Sets property Profile
 void setQuantity(long pQuantity)
          Sets property Quantity
 void setShippingGroup(ShippingGroup pShippingGroup)
          Sets shipping group bean to use for modifying the shipping groups
protected  void setTransactionCreated(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
           
 void setTransactionLockFactory(TransactionLockFactory pTransactionLockFactory)
          The transactionLockFactory is used to get the locks if useLocksArountTransactions is true
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
          Sets property TransactionManager
protected  void setTransactionToRollbackOnly()
          Sets the transaction to rollback
 void setUseLocksAroundTransactions(boolean pUseLocksAroundTransactions)
          Deprecated. Use the TransactionLockFactory instead
 void setUseRequestLocale(boolean pUseRequestLocale)
          Sets property UseRequestLocale
protected  java.lang.String transactionLockName()
          Generate the lock name to use when acquiring and releasing locks in acquireTransactionLock and releaseTransactionLock.
protected  void unsetTransactionCreated(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
           
 
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, 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
 
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 java.lang.String CLASS_VERSION
Class version string


MSG_NO_ITEMS_TO_ADD

protected static final java.lang.String MSG_NO_ITEMS_TO_ADD
See Also:
Constant Field Values

MSG_QUANTITY_LESSTHAN_OR_EQUALTO_ZERO

protected static final java.lang.String MSG_QUANTITY_LESSTHAN_OR_EQUALTO_ZERO
See Also:
Constant Field Values

MSG_NO_ORDER_TO_MODIFY

protected static final java.lang.String MSG_NO_ORDER_TO_MODIFY
See Also:
Constant Field Values

MSG_NO_SKU_WITH_ID

protected static final java.lang.String MSG_NO_SKU_WITH_ID
See Also:
Constant Field Values

MSG_ERROR_ADDING_TO_ORDER

protected static final java.lang.String MSG_ERROR_ADDING_TO_ORDER
See Also:
Constant Field Values

MSG_ERROR_REMOVING_RROM_ORDER

protected static final java.lang.String MSG_ERROR_REMOVING_RROM_ORDER
See Also:
Constant Field Values

MSG_CONCURRENT_UPDATE_ATTEMPT

protected static final java.lang.String MSG_CONCURRENT_UPDATE_ATTEMPT
See Also:
Constant Field Values

MSG_ERROR_REMOVING_FROM_ORDER

protected static final java.lang.String MSG_ERROR_REMOVING_FROM_ORDER
See Also:
Constant Field Values

MSG_NO_ITEM_FOUND

protected static final java.lang.String MSG_NO_ITEM_FOUND
See Also:
Constant Field Values

PARAM_TRANSACTION_CREATED

protected static final java.lang.String PARAM_TRANSACTION_CREATED
See Also:
Constant Field Values

PARAM_VALUE_TRUE

protected static final java.lang.String PARAM_VALUE_TRUE
See Also:
Constant Field Values

ERROR_MISSING_LOCK_MANAGER

protected static final java.lang.String ERROR_MISSING_LOCK_MANAGER
See Also:
Constant Field Values

ERROR_MISSING_LOCK_PROFILE

protected static final java.lang.String ERROR_MISSING_LOCK_PROFILE
See Also:
Constant Field Values

ERROR_MISSING_TRANSACTION_MANAGER

protected static final java.lang.String ERROR_MISSING_TRANSACTION_MANAGER
See Also:
Constant Field Values
Constructor Detail

OrderModifierFormHandler

public OrderModifierFormHandler()
Constructs an instanceof OrderModifierFormHandler

Method Detail

setPipelineManager

public void setPipelineManager(PipelineManager pPipelineManager)
Sets property PipelineManager


getPipelineManager

public PipelineManager getPipelineManager()
Returns property PipelineManager


setOrderManager

public void setOrderManager(SimpleOrderManager pOrderManager)
Sets property OrderManager


getOrderManager

public SimpleOrderManager getOrderManager()
Returns property OrderManager


setCatalogTools

public void setCatalogTools(CatalogTools pCatalogTools)
Sets property CatalogTools


getCatalogTools

public CatalogTools getCatalogTools()
Returns property CatalogTools


setUseLocksAroundTransactions

public void setUseLocksAroundTransactions(boolean pUseLocksAroundTransactions)
Deprecated. Use the TransactionLockFactory instead

Specify whether to use a local lock manager to obtain a lock before starting transactions in beforeSet and to release the lock after committing transacations in afterSet.

If this property is set to true, locking will be used to prevent one user from trying to modify orders in multiple concurrent threads. This has a small performance impact as we obtain and release the lock, but minimizes the possibility of concurrent update exceptions if two threads try to modify the same order for the same user. The default value for useLocksAroundTransactions is true.


isUseLocksAroundTransactions

public boolean isUseLocksAroundTransactions()
Deprecated. Use the TransactionLockFactory instead

Inquire whether to use a local lock manager to obtain a lock before starting transactions in beforeSet, and to release the lock after committing transactions in afterSet.


setTransactionLockFactory

public void setTransactionLockFactory(TransactionLockFactory pTransactionLockFactory)
The transactionLockFactory is used to get the locks if useLocksArountTransactions is true


getTransactionLockFactory

public TransactionLockFactory getTransactionLockFactory()
The transactionLockFactory is used to get the locks if useLocksArountTransactions is true


setLocalLockManager

public void setLocalLockManager(ClientLockManager pLocalLockManager)
Deprecated. Use the TransactionLockFactory instead

Specify the lock manager to use if useLocksAroundTransactions is true.

See Also:
setUseLocksAroundTransactions(boolean)

getLocalLockManager

public ClientLockManager getLocalLockManager()
Deprecated. Use the TransactionLockFactory instead

Return the lock manager to use if useLocksAroundTransactions is true.

See Also:
setUseLocksAroundTransactions(boolean)

defaultLocalLockManager

protected ClientLockManager defaultLocalLockManager(boolean pSetLocalLockManager)
Get the default local lock manager to use if localLockManager has not been set. If pSetLocalLockManager is true, then also set localLockManager to the value returned so future calls to getLocalLockManager will succeed.


setOrder

public void setOrder(Order pOrder)
Sets property Order


getOrder

public Order getOrder()
Returns property Order


setProfile

public void setProfile(RepositoryItem pProfile)
Sets property Profile


getProfile

public RepositoryItem getProfile()
Returns property Profile


defaultUserProfile

protected RepositoryItem defaultUserProfile(boolean pSetProfile)
Get the default user profile to use if profile has not been set. If pSetProfile is true, then also set profile to the value returned so future calls to getProfile will succeed.


setCatalogRefIds

public void setCatalogRefIds(java.lang.String[] pCatalogRefIds)
Sets property CatalogRefIds


getCatalogRefIds

public java.lang.String[] getCatalogRefIds()
Returns property CatalogRefIds


setProductId

public void setProductId(java.lang.String pProductId)
Sets property ProductId


getProductId

public java.lang.String getProductId()
Returns property ProductId


setQuantity

public void setQuantity(long pQuantity)
Sets property Quantity


getQuantity

public long getQuantity()
Returns property Quantity


setAddress

public void setAddress(Address pAddress)
Sets an address bean to be used when modifying an address for a shipping or a billing group


getAddress

public Address getAddress()
Returns an address bean to be used when modifying an address for a shipping or a billing group


setPaymentGroup

public void setPaymentGroup(PaymentGroup pPaymentGroup)
Sets payment group bean to use for modifiing payment groups


getPaymentGroup

public PaymentGroup getPaymentGroup()
Returns payment group bean to use for modifiing payment groups


setCreditCard

public void setCreditCard(CreditCard pCreditCard)
Sets credit card bean to use for modifying of billing groups


getCreditCard

public CreditCard getCreditCard()
Returns credit card bean to use for modifying of billing groups


setGiftCertificate

public void setGiftCertificate(GiftCertificate pGiftCertificate)
Sets gift certificate bean to use for modifying of billing grps


getGiftCertificate

public GiftCertificate getGiftCertificate()
Returns gift certificate bean to use for modifying of billing grps


setHardgoodShippingGroup

public void setHardgoodShippingGroup(HardgoodShippingGroup pHardgoodShippingGroup)
Sets hardgood shipping group bean


getHardgoodShippingGroup

public HardgoodShippingGroup getHardgoodShippingGroup()
Returns hardgood shipping group bean


setShippingGroup

public void setShippingGroup(ShippingGroup pShippingGroup)
Sets shipping group bean to use for modifying the shipping groups


getShippingGroup

public ShippingGroup getShippingGroup()
Returns shipping group bean to use for modifying the shipping groups


setDefaultLocale

public void setDefaultLocale(java.util.Locale pDefaultLocale)
Sets property DefaultLocale


getDefaultLocale

public java.util.Locale getDefaultLocale()
Returns property DefaultLocale. If the property value is null, then JVM's default locale is returned.


setUseRequestLocale

public void setUseRequestLocale(boolean pUseRequestLocale)
Sets property UseRequestLocale


isUseRequestLocale

public boolean isUseRequestLocale()
Returns property UseRequestLocale


setGeneralSuccessURL

public void setGeneralSuccessURL(java.lang.String pGeneralSuccessURL)
Sets A Geneneric bean to store a success URL into


getGeneralSuccessURL

public java.lang.String getGeneralSuccessURL()
Returns A Geneneric bean to store a success URL into


setGeneralFailureURL

public void setGeneralFailureURL(java.lang.String pGeneralFailureURL)
Sets A Generic bean to store a failure URL into


getGeneralFailureURL

public java.lang.String getGeneralFailureURL()
Returns A Generic bean to store a failure URL into


getCurrentTransaction

public javax.transaction.Transaction getCurrentTransaction()
Returns property currentTransaction

Returns:
returns property currentTransaction

setCurrentTransaction

public void setCurrentTransaction(javax.transaction.Transaction pCurrentTransaction)
Sets property currentTransaction

Parameters:
pCurrentTransaction - the value to set for property currentTransaction

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets property TransactionManager


getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Returns property TransactionManager


setEnsureTransaction

public void setEnsureTransaction(boolean pEnsureTransaction)
Sets property EnsureTransaction


isEnsureTransaction

public boolean isEnsureTransaction()
Returns property EnsureTransaction


getResourceBundle

protected java.util.ResourceBundle getResourceBundle()
Returns the error message ResourceBundle


getResourceBundleName

protected java.lang.String getResourceBundleName()
Returns the name of the error message ResourceBundle


ensureTransaction

protected javax.transaction.Transaction ensureTransaction()
This method ensures that a transaction exists before returning. If there is no transaction, a new one is started and returned. In this case, you must call commitTransaction when the transaction completes.


commitTransaction

protected void commitTransaction(javax.transaction.Transaction pTransaction)
Commits the supplied transaction


setTransactionToRollbackOnly

protected void setTransactionToRollbackOnly()
                                     throws javax.transaction.SystemException
Sets the transaction to rollback

Throws:
javax.transaction.SystemException

isTransactionMarkedAsRollBack

protected boolean isTransactionMarkedAsRollBack()
Returns true if the transaction associated with the current thread is marked for rollback. This is useful if you do not want to perform some action (e.g. updating the order) if some other subservice already needs the transaction rolledback.


checkFormRedirect

public boolean checkFormRedirect(java.lang.String pSuccessURL,
                                 java.lang.String pFailureURL,
                                 DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
If the transaction is marked as rollback, then redirect to the FailureURL, otherwise allow the super-class behavior to perform.

Overrides:
checkFormRedirect in class GenericFormHandler
Parameters:
pNoErrorsURL - The URL to redirect to if there were no form errors. If a null value is passed in, no redirect occurs.
pErrorsURL - The URL to redirect to if form errors were found. If a null value is passed in, no redirect occurs.
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

handleRemoveItemFromOrder

public boolean handleRemoveItemFromOrder(DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
                                  throws javax.servlet.ServletException,
                                         java.io.IOException
Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

handleAddItemToOrder

public boolean handleAddItemToOrder(DynamoHttpServletRequest pRequest,
                                    DynamoHttpServletResponse pResponse)
                             throws javax.servlet.ServletException,
                                    java.io.IOException
Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

handleSetOrder

public boolean handleSetOrder(DynamoHttpServletRequest pRequest,
                              DynamoHttpServletResponse pResponse)
                       throws javax.servlet.ServletException,
                              java.io.IOException
Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

addNewItemToOrder

public CommerceItem addNewItemToOrder(Order pOrder,
                                      java.lang.String pCatalogRefId,
                                      java.lang.String pProductId,
                                      long pQuantity,
                                      DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException,
                                      CommerceException
Adds the designated item to the given order. First checks to see if the catalogRefId is valid. If it is, it creates a new commerce item with the information provided, and passes that item to OrderManager's addItemToOrder method.

Parameters:
pOrder - the order to add the item to
pCatalogRefId - the sku id of the commerce item to add
pProductId - the product id of the commerce item to add
pQuantity - the quantity of the item
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
the item created and added
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io
CommerceException

removeItemFromOrder

public boolean removeItemFromOrder(Order pOrder,
                                   java.lang.String pItemId,
                                   DynamoHttpServletRequest pRequest,
                                   DynamoHttpServletResponse pResponse)
                            throws javax.servlet.ServletException,
                                   java.io.IOException,
                                   CommerceException
This simply calls OrderManager's removeItemFromOrder method with the given order and item ID

Parameters:
pOrder - the order the item is to be removed from
pItemId - the ID of the commerce item to remove
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io
CommerceException

getQuantity

public long getQuantity(java.lang.String pCatalogRefId,
                        DynamoHttpServletRequest pRequest,
                        DynamoHttpServletResponse pResponse)
                 throws javax.servlet.ServletException,
                        java.io.IOException,
                        java.lang.NumberFormatException
Retrieve the quanity that should be used for the given item. This method assumes that parameters are passed from the HTML form where the names of the parameters are the catalogRefIds, and the values are the quantities. This method will find the parameter with the given catalogRefId as its name, and will return its value.

Parameters:
pCatalogRefId - the sku id of the item whose quantity we want
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException
java.io.IOException
java.lang.NumberFormatException

createCommerceItem

public CommerceItem createCommerceItem(java.lang.String pCatalogRefId,
                                       java.lang.Object pCatalogRef,
                                       java.lang.String pProductId,
                                       java.lang.Object pProductRef,
                                       long pQuantity)
                                throws CommerceException
With the given parameters create a new CommerceItem that will be added to the order.

Parameters:
pCatalogRefId - the sku id of the commerce item
pCatalogRef - the sku repository item
pProductId - the product id of the commerce item
pProductRef - the product repository item
pQuantity - the quantity of the commerce item
Throws:
CommerceException

findCommerceItem

public CommerceItem findCommerceItem(Order pOrder,
                                     java.lang.String pCatalogRefId)
                              throws CommerceException
Deprecated. This method should no longer be used. Instead call Order.findCommerceItemsByCatalogRefId(String)

Look for a CommerceItem within the order that has the same catalogRefId

Throws:
CommerceException

generatePropertyPath

public java.lang.String generatePropertyPath(java.lang.String pPropertyName)
Returns a Nucleus property path which can be used in a DropletFormException

Parameters:
pPropertyName - the name of the property

processException

public void processException(java.lang.Exception pException,
                             java.lang.String pMsgId,
                             DynamoHttpServletRequest pRequest,
                             DynamoHttpServletResponse pResponse)
                      throws javax.servlet.ServletException,
                             java.io.IOException
Add a user error message to the form exceptions, and then display the exception in the logs

Parameters:
pException - the exception
pMsgId - the ID of the message to add
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException
java.io.IOException

getUserLocale

public java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
Returns the locale associated with the request. The method first searches for a request paramater named locale. This value can be either a java.util.Locale object or a String which represents the locale. Next if the useRequestLocale property is true, then the locale of the request will be returned. Finally, if the locale cannot be determined, the the defaultLocale property is used.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Throws:
javax.servlet.ServletException
java.io.IOException

formatUserMessage

public java.lang.String formatUserMessage(java.lang.String pKey,
                                          DynamoHttpServletRequest pRequest,
                                          DynamoHttpServletResponse pResponse)
                                   throws javax.servlet.ServletException,
                                          java.io.IOException
Utility method to format a message with no arguments using the Locale of the user

Parameters:
pKey - the identifier for the message to retrieve out of the ResourceBundle
pRequest - the request object which can be used to extract the user's locale
pResponse - the servlet's response
Returns:
the formatted message
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
OrderUserMessage

formatUserMessage

public java.lang.String formatUserMessage(java.lang.String pKey,
                                          java.lang.Object pParam,
                                          DynamoHttpServletRequest pRequest,
                                          DynamoHttpServletResponse pResponse)
                                   throws javax.servlet.ServletException,
                                          java.io.IOException
Utility method to format a message with one argument using the Locale of the user

Parameters:
pKey - the identifier for the message to retrieve out of the ResourceBundle
pParam - the first (and only argument) in the message
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
the formatted message
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
OrderUserMessage

formatUserMessage

public java.lang.String formatUserMessage(java.lang.String pKey,
                                          java.lang.Object pParam1,
                                          java.lang.Object pParam2,
                                          DynamoHttpServletRequest pRequest,
                                          DynamoHttpServletResponse pResponse)
                                   throws javax.servlet.ServletException,
                                          java.io.IOException
Utility method to format a message with two arguments using our resource bundle.

Parameters:
pKey - the identifier for the message to retrieve out of the ResourceBundle
pParam1 - the first parameter in the message
pParam2 - the second parameter in the message
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
the formatted message
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
OrderUserMessage

acquireTransactionLock

protected void acquireTransactionLock()
                               throws DeadlockException
Attempt to acquire a local lock before creating a transaction that may modify the order, but only if useLocksAroundTransactions is set to true.

Throws:
DeadlockException

releaseTransactionLock

protected void releaseTransactionLock()
                               throws LockManagerException
Attempt to release the local lock that was acquired before creating a transaction that may have modified the order, but only if useLocksAroundTransactions is set to true.

Throws:
LockManagerException

transactionLockName

protected java.lang.String transactionLockName()
Generate the lock name to use when acquiring and releasing locks in acquireTransactionLock and releaseTransactionLock. By default this returns the repository id of the current user profile, generating an error message and returning null if no profile is available. Subclasses may override this behavior to choose a different locking strategy.

Returns:
The lock name to use when acquiring and releasing locks, or null if no lock name is available. In this case locking will be disabled for the current form submission.

beforeSet

public boolean beforeSet(DynamoHttpServletRequest pRequest,
                         DynamoHttpServletResponse pResponse)
                  throws DropletFormException
Create a transaction if necessary at the beginning of the form submission process, optionally obtaining a local lock to prevent multiple forms from creating transactions that may modify the same order.

Specified by:
beforeSet in interface DropletFormHandler
Overrides:
beforeSet in class GenericFormHandler
Returns:
true if form processing should continue, false if it should be aborted
Throws:
DropletFormException
See Also:
afterSet(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse), ensureTransaction(), setUseLocksAroundTransactions(boolean)

afterSet

public boolean afterSet(DynamoHttpServletRequest pRequest,
                        DynamoHttpServletResponse pResponse)
                 throws DropletFormException
Commit or roll back any transaction created in beforeSet, and release any lock that was acquired at the time.

Specified by:
afterSet in interface DropletFormHandler
Overrides:
afterSet in class GenericFormHandler
Returns:
true if request processing should continue and the requested URL should be served, false if it should be aborted. If false is returned, you typically have already completed the request with a redirect or by sending output to the output stream.
Throws:
DropletFormException
See Also:
beforeSet(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse), ensureTransaction(), setUseLocksAroundTransactions(boolean)

setTransactionCreated

protected void setTransactionCreated(DynamoHttpServletRequest pRequest,
                                     DynamoHttpServletResponse pResponse)

isTransactionCreated

protected boolean isTransactionCreated(DynamoHttpServletRequest pRequest,
                                       DynamoHttpServletResponse pResponse)

unsetTransactionCreated

protected void unsetTransactionCreated(DynamoHttpServletRequest pRequest,
                                       DynamoHttpServletResponse pResponse)

formatUserMessage

public java.lang.String formatUserMessage(java.lang.String pKey,
                                          java.lang.Object[] pParams,
                                          DynamoHttpServletRequest pRequest,
                                          DynamoHttpServletResponse pResponse)
                                   throws javax.servlet.ServletException,
                                          java.io.IOException
Utility method to format a message with two arguments using our resource bundle.

Parameters:
pKey - the identifier for the message to retrieve out of the ResourceBundle
pParams - a set of parameters to use in the formatting.
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
the formatted message
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
OrderUserMessage

isStringEmpty

protected boolean isStringEmpty(java.lang.String pString)

runProcess

protected PipelineResult runProcess(java.lang.String pChainId,
                                    Order pOrder,
                                    PricingModelHolder pPricingModels,
                                    java.util.Locale pLocale,
                                    RepositoryItem pProfile,
                                    java.util.Map pExtraParameters)
                             throws RunProcessException
Executes a Pipeline Chain and places the supplies method parameters into a HashMap which is supplied to the chain to execute.

Parameters:
pChainId - the pipeline chain to execute
pOrder - the order to reprice
pPricingModels - the set of all pricing models for the user (item, order, shipping, tax)
pLocale - the locale that the order should be priced within
pProfile - the user who owns the order
pExtraParameters - A Map of extra parameters to be used in the pricing
Throws:
RunProcessException

runProcess

protected PipelineResult runProcess(java.lang.String pChainId,
                                    Order pOrder,
                                    PricingModelHolder pPricingModels,
                                    java.util.Locale pLocale,
                                    RepositoryItem pProfile,
                                    java.util.Map pParameters,
                                    java.util.Map pExtraParameters)
                             throws RunProcessException
Executes a Pipeline Chain and places the supplies method parameters into a HashMap which is supplied to the chain to execute.

Parameters:
pChainId - the pipeline chain to execute
pOrder - the order to reprice
pPricingModels - the set of all pricing models for the user (item, order, shipping, tax)
pLocale - the locale that the order should be priced within
pProfile - the user who owns the order
pParameters - A Map of parameters to be used when calling the PipelineChain
pExtraParameters - A Map of extra parameters to be used in the pricing
Throws:
RunProcessException

runProcess

protected PipelineResult runProcess(java.lang.String pChainId,
                                    java.util.Map pParameters)
                             throws RunProcessException
Executes a Pipeline Chain.

Parameters:
pChainId - the pipeline chain to execute
pParameters - A Map of parameters to be passed to the chain during execution
Throws:
RunProcessException

processPipelineErrors

protected boolean processPipelineErrors(PipelineResult pResult)
Examine the pipeline result looking for any error messages, creates DropletExceptions and adds them as form exceptions

Returns:
true if errors were found

handlePipelineError

public void handlePipelineError(java.lang.Object pError,
                                java.lang.String pErrorKey)
Add a pipeline error to the list of form exceptions.

Specified by:
handlePipelineError in interface atg.commerce.util.PipelineErrorHandler
Parameters:
pError - the error reported by the pipeline.
pErrorKey - the key of the error, used for localization.