atg.commerce.catalog
Class CompareSkusFormHandler

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.catalog.CompareSkusFormHandler
All Implemented Interfaces:
DropletFormHandler, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

Deprecated. As of Dynamo 6, use ProductComparisonList and ProductListHander to create and manage product comparison lists.

public class CompareSkusFormHandler
extends GenericFormHandler

This form handler is used to compare two SKUs with each another. As a user is looking at a Product, they can decided to add all of its associated SKUs to a list of SKUs they may want to compare side by side. When they are ready to do a comparison, they select two of the SKUs from the list they have built up, and a table is displayed comparing the two SKUs. All handle methods in this form handler mirror a similar pattern. Each handleXXX process has an associated preXXX and postXXX method. So, for example, the handleCompareSkus has an associated preCompareSkus and postCompareSkus. These pre/post methods provide an easy way for a user to extend the functionality of this form handler.

See Also:
GenericFormHandler

Field Summary
static java.lang.String CLASS_VERSION
          Deprecated. Class version string
 
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
CompareSkusFormHandler()
          Deprecated. Empty Constructor.
 
Method Summary
 java.lang.String getAddToCompareListErrorURL()
          Deprecated. Returns property AddToCompareListErrorURL.
 java.lang.String getAddToCompareListSuccessURL()
          Deprecated. Returns property AddToCompareListSuccessURL.
 java.lang.String getCompareSkusErrorURL()
          Deprecated. This method returns property CompareSkusErrorURL.
 java.lang.String getCompareSkusSuccessURL()
          Deprecated. Returns property CompareSkusSuccessURL.
 java.util.List getProductCompareList()
          Deprecated. This method returns the list of Products the user wants to compare against.
 java.lang.String getProductToCompare()
          Deprecated. Gets the productId of the Product to add to Compare List.
 Repository getRepository()
          Deprecated. Gets the Repository the Products/SKUs are in.
 java.lang.String getSelectedIndex1()
          Deprecated. This method returns the index of the first item the user wants to compare.
 java.lang.String getSelectedIndex2()
          Deprecated. Returns the index of the second item the user wants to compare.
 java.util.List getSkuCompareList()
          Deprecated. This method returns the list of SKUs the user wants to compare against.
protected  java.util.Locale getUsersLocale(DynamoHttpServletRequest pRequest)
          Deprecated. Returns either the Locale from the Request object (if it isn't NULL), or the Locale from the JVM.
 boolean handleAddToCompareList(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deprecated. This method is called when the user adds a Product (and all associated SKUs) to the Compare Lists.
 boolean handleCompareSkus(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deprecated. This method is called when the user goes to compare 2 selected SKUs with each other.
 void postAddToCompareList(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deprecated. This method provides an easy way for users to extend the functionality of the handleAddToCompareList method.
 void postCompareSkus(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deprecated. This method provides an easy way for users to extend the functionality of the handleCompareSkus method.
 void preAddToCompareList(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deprecated. This method provides an easy way for users to extend the functionality of the handleAddToCompareList method.
 void preCompareSkus(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deprecated. This method provides an easy way for users to extend the functionality of the handleCompareSkus method.
 void processError(java.lang.Exception pException, java.lang.String pResourceLookupKey, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deprecated. This method is called by this form handler whenever an error is found.
 void setAddToCompareListErrorURL(java.lang.String pAddToCompareListErrorURL)
          Deprecated. Sets property AddToCompareListErrorURL.
 void setAddToCompareListSuccessURL(java.lang.String pAddToCompareListSuccessURL)
          Deprecated. Sets the property AddToCompareListSuccessURL.
 void setCompareSkusErrorURL(java.lang.String pCompareSkusErrorURL)
          Deprecated. Sets property CompareSkusErrorURL.
 void setCompareSkusSuccessURL(java.lang.String pCompareSkusSuccessURL)
          Deprecated. Sets property CompareSkusSuccessURL.
 void setProductCompareList(java.util.List pProductCompareList)
          Deprecated. Sets the list of Products the user wants to compare against.
 void setProductToCompare(java.lang.String productId)
          Deprecated. Sets the productId of the Product to add to the Compare Lists.
 void setRepository(Repository pRepository)
          Deprecated. Sets the Repository the Products/SKUs are in.
 void setSelectedIndex1(java.lang.String newVal)
          Deprecated. Sets the index of the first item the user wants to compare.
 void setSelectedIndex2(java.lang.String newVal)
          Deprecated. Sets the index of the second item the user wants to compare.
 void setSkuCompareList(java.util.List pSkuCompareList)
          Deprecated. Sets the list of SKUs the user wants to compare against.
 
Methods inherited from class atg.droplet.GenericFormHandler
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
 
Methods inherited from class atg.droplet.EmptyFormHandler
afterGet, beforeGet
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Deprecated. 
Class version string

Constructor Detail

CompareSkusFormHandler

public CompareSkusFormHandler()
Deprecated. 
Empty Constructor.

Method Detail

setRepository

public void setRepository(Repository pRepository)
Deprecated. 
Sets the Repository the Products/SKUs are in. This property is typically set initially in this FormHandler's properties file.

Parameters:
pRepository - The repository containing the Products and SKUs the user will be comparing.

getRepository

public Repository getRepository()
Deprecated. 
Gets the Repository the Products/SKUs are in.

Returns:
The repository containing the Products and SKUs the user will be comparing.

setProductCompareList

public void setProductCompareList(java.util.List pProductCompareList)
Deprecated. 
Sets the list of Products the user wants to compare against. This list contains Product RepositoryItems. NOTE: This list will most likely contain duplicates. If the Product has x number of SKUs, the Product will be added to the ProductCompareList x times so that the length of the ProductCompareList and the SkuCompareList is always the same. So, given a specific List Index x, you can fetch the xth element from either the ProductCompareList or the SkuCompareList, and the values in the xth element will correspond with each other.

Parameters:
pProductCompareList - A list of Products the user is comparing (contains duplicates).

getProductCompareList

public java.util.List getProductCompareList()
Deprecated. 
This method returns the list of Products the user wants to compare against. This list contains Product RepositoryItems. NOTE: This list will most likely contain duplicates. If the Product has x number of SKUs, the Product will be added to the ProductCompareList x times so that the length of the ProductCompareList and the SkuCompareList is always the same. So, given a specific List Index, it is possible to retrieve the correct Product AND SKU.

Returns:
Returns a list of Products the user is comparing (contains duplicates).

setSkuCompareList

public void setSkuCompareList(java.util.List pSkuCompareList)
Deprecated. 
Sets the list of SKUs the user wants to compare against. This list contains SKU RepositoryItems. This list will not typically contain duplicates.

Parameters:
pSkuCompareList - A list of SKUs the user is comparing.

getSkuCompareList

public java.util.List getSkuCompareList()
Deprecated. 
This method returns the list of SKUs the user wants to compare against. This list contains SKU RepositoryItems. This list will not typically contain duplicates.

Returns:
Returns a list of SKUs the user is comparing.

setSelectedIndex1

public void setSelectedIndex1(java.lang.String newVal)
Deprecated. 
Sets the index of the first item the user wants to compare. This value is used as an index into the ProductCompareList or SkuCompareList.

Parameters:
newVal - The new value to set the SelectedIndex1 property to. Should be between 0 and the length of the SkuCompareList/ProductCompareList.

getSelectedIndex1

public java.lang.String getSelectedIndex1()
Deprecated. 
This method returns the index of the first item the user wants to compare. This value is used as an index into the ProductCompareList or SkuCompareList.

Returns:
Returns the Index into the SkuCompareList or ProductCompareList of the first SKU the user wants to compare.

setSelectedIndex2

public void setSelectedIndex2(java.lang.String newVal)
Deprecated. 
Sets the index of the second item the user wants to compare. This value is used as an index into the ProductCompareList or SkuCompareList.

Parameters:
newVal - The new value to set the SelectedIndex2 property to. Should be between 0 and the length of the SkuCompareList/ProductCompareList.

getSelectedIndex2

public java.lang.String getSelectedIndex2()
Deprecated. 
Returns the index of the second item the user wants to compare. This value is used as an index into the ProductCompareList or SkuCompareList.

Returns:
Returns the Index into the SkuCompareList or ProductCompareList of the 2nd SKU the user wants to compare.

setProductToCompare

public void setProductToCompare(java.lang.String productId)
Deprecated. 
Sets the productId of the Product to add to the Compare Lists. This property contains the productId represented as a string. The Product/SKUs don't get added to the Compare Lists until the handleAddItemToCompareList method gets invoked.

Parameters:
productId - The Id of the Product whose SKUs the user wants added to the Compare Lists.

getProductToCompare

public java.lang.String getProductToCompare()
Deprecated. 
Gets the productId of the Product to add to Compare List.

Returns:
Returns the Id (as a string) or the Product the user wants to compare.

setAddToCompareListSuccessURL

public void setAddToCompareListSuccessURL(java.lang.String pAddToCompareListSuccessURL)
Deprecated. 
Sets the property AddToCompareListSuccessURL. This property is normally set on a jhtml page. It indicates which page we should redirect to if NO errors occur when the user pushes the button which adds a specific Product (and its SKUs) to the Compare Lists.

Parameters:
pAddToCompareListSuccessURL - The URL (as a string) of the page to redirect to if the handleAddToCompareList method succeeds without error.

getAddToCompareListSuccessURL

public java.lang.String getAddToCompareListSuccessURL()
Deprecated. 
Returns property AddToCompareListSuccessURL. It indicates which page (ie URL) we should redirect to if NO errors occur when the user pushes the button which adds a specific Product (and its SKUs) to the Compare Lists. No redirect occurs if the current URL is the same as this URL.

Returns:
The URL (as a string) of the page to redirect to if the handleAddToCompareList method succeeds without error.

setAddToCompareListErrorURL

public void setAddToCompareListErrorURL(java.lang.String pAddToCompareListErrorURL)
Deprecated. 
Sets property AddToCompareListErrorURL. This property is normally set on a jhtml page. It indicates which page we should redirect to if ERRORS occur when the user pushes the button which adds a specific Product (and its SKUs) to the Compare Lists.

Parameters:
pAddToCompareListErrorURL - The URL (as a string) of the page to redirect to if the handleAddToCompareList method generates an error.

getAddToCompareListErrorURL

public java.lang.String getAddToCompareListErrorURL()
Deprecated. 
Returns property AddToCompareListErrorURL. It indicates which page we should redirect to if ERORRS occur when the user pushes the button which adds a specific Product (and its SKUs) to the Compare Lists. No redirect occurs if the current URL is the same as this URL.

Returns:
The URL (as a string) of the page to redirect to if the handleAddToCompareList method generates an error.

preAddToCompareList

public void preAddToCompareList(DynamoHttpServletRequest pRequest,
                                DynamoHttpServletResponse pResponse)
                         throws javax.servlet.ServletException,
                                java.io.IOException
Deprecated. 
This method provides an easy way for users to extend the functionality of the handleAddToCompareList method. The preAddToCompareList code will be executed at the start of the handleAddToCompareList method. This default implementation does nothing.

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

postAddToCompareList

public void postAddToCompareList(DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
Deprecated. 
This method provides an easy way for users to extend the functionality of the handleAddToCompareList method. The postAddToCompareList code will be executed at the end of the handleAddToCompareList method. This default implementation does nothing.

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

handleAddToCompareList

public boolean handleAddToCompareList(DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
Deprecated. 
This method is called when the user adds a Product (and all associated SKUs) to the Compare Lists. If the Product has x number of SKUs, the Product will be added to the ProductCompareList x times so that the length of the ProductCompareList and the SkuCompareList is always the same. So, given a specific List Index, it is possible to retrieve the correct Product and SKU. This is necessary if the side-by-side comparison chart needs to exhibit both Product attributes and SKU attributes. Before adding the Skus for a Product to the compare lists, the code checks if the Product was already added before. If it was, the Skus are not added again, and the method returns a successful status. If the method succeeds, it redirects to the AddToCompareListSuccessURL (if different from the current URL). If the method doesn't succeed, it redirects to the AddToCompareListErrorURL (if different from the current URL). If the success or failure URLs are the same as the current URL, no redirect takes place.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
true if processing was successful, false otherwise.
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

setCompareSkusSuccessURL

public void setCompareSkusSuccessURL(java.lang.String pCompareSkusSuccessURL)
Deprecated. 
Sets property CompareSkusSuccessURL. This property is normally set on a jhtml page. It indicates which page we should redirect to if NO errors occur when the user pushes the COMPARE button on a page which compares SKUs.

Parameters:
pCompareSkusSuccessURL - The URL (as a string) of the page to redirect to if the handleCompareSkus method succeeds with no errors.

getCompareSkusSuccessURL

public java.lang.String getCompareSkusSuccessURL()
Deprecated. 
Returns property CompareSkusSuccessURL. It indicates which page we should redirect to if NO errors occur when the user pushes the COMPARE button on a page which compares SKUs.

Returns:
The URL (as a string) of the page to redirect to if the handleCompareSkus method generates no errors and succeeds.

setCompareSkusErrorURL

public void setCompareSkusErrorURL(java.lang.String pCompareSkusErrorURL)
Deprecated. 
Sets property CompareSkusErrorURL. This property is normally set on a jhtml page. It indicates which page we should redirect to if errors occur when the user pushes the COMPARE button on a page which compares SKUs.

Parameters:
pCompareSkusErrorURL - The URL (as a string) of the page to redirect to if the handleCompareSkus method generates errors.

getCompareSkusErrorURL

public java.lang.String getCompareSkusErrorURL()
Deprecated. 
This method returns property CompareSkusErrorURL. It indicates which page we should redirect to if errors occur when the user pushes the COMPARE button on a page which compares SKUs.

Returns:
The URL (as a string) of the page to redirect to if the handleCompareSkus method generates an ERROR.

preCompareSkus

public void preCompareSkus(DynamoHttpServletRequest pRequest,
                           DynamoHttpServletResponse pResponse)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Deprecated. 
This method provides an easy way for users to extend the functionality of the handleCompareSkus method. The preCompareSkus code will be executed at the start of the handleCompareSkus method. This default implementation does nothing.

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

postCompareSkus

public void postCompareSkus(DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Deprecated. 
This method provides an easy way for users to extend the functionality of the handleCompareSkus method. The postCompareSkus code will be executed at the end of the handleCompareSkus method. This default implementation does nothing.

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

handleCompareSkus

public boolean handleCompareSkus(DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
Deprecated. 
This method is called when the user goes to compare 2 selected SKUs with each other. This method is invoked when the user pushes the COMPARE button after they have selected two items they want to compare. This method assumes that the SelectedIndex1 and SelectedIndex2 properties were filled in before this method is called. Redirects to getCompareSkusSuccessURL() if all goes well. Redirects to getCompareSkusErrorURL() if any errors are found.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
true if processing was successful, false otherwise.
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

getUsersLocale

protected java.util.Locale getUsersLocale(DynamoHttpServletRequest pRequest)
Deprecated. 
Returns either the Locale from the Request object (if it isn't NULL), or the Locale from the JVM.

Parameters:
pRequest - the servlet's request
Returns:
Either the Locale from the Request object, or the Locale from the JVM.

processError

public void processError(java.lang.Exception pException,
                         java.lang.String pResourceLookupKey,
                         DynamoHttpServletRequest pRequest,
                         DynamoHttpServletResponse pResponse)
                  throws javax.servlet.ServletException,
                         java.io.IOException
Deprecated. 
This method is called by this form handler whenever an error is found. It first looks-up the error in the associated Resource Bundle (taking into account the user's locale), and then adds the localized error as a form exception. It also logs the error if isLoggingError is enabled. Any errors which are dealt with by this form handler should be added to the UserResourceLookup.java file, and the UserResources.properties file.

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