atg.portal.admin
Class PortalGenericFormHandler

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.droplet.TransactionalFormHandler
                      extended by atg.portal.admin.PortalGenericFormHandler
All Implemented Interfaces:
DropletFormHandler, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener
Direct Known Subclasses:
ColorPaletteFormHandler, CommunityFormHandler, FolderFormHandler, GearConfigFormHandler, GearDefinitionFormHandler, GearTemplateFormHandler, PageFormHandler, PageTemplateFormHandler, StyleFormHandler

public class PortalGenericFormHandler
extends TransactionalFormHandler

This is the portal extension of the Generic Form Handler. It provides APIs to process exception and information messages for portal form handlers. The GenericFormHandler does not provide informational messages to be displayed by forms. This handler adds a boolean property and a List to store all success messages. Extending formHandlers may use the processSuccess() API to store messages in the List which can be displayed in a ForEach droplet.

See Also:
GenericFormHandler

Field Summary
static java.lang.String CLASS_VERSION
           
 
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
PortalGenericFormHandler()
           
 
Method Summary
 void addFormException(DropletException exc)
          Overrides the addFormException method to capture any exceptions added by the super classes.
 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.util.Locale getDefaultLocale()
          Returns property DefaultLocale.
 atg.portal.admin.I18nMessageProcessor getFailureMessageProcessor()
          Returns the form message processor used for notifying the user about failures.
 java.lang.String getFailureURL()
          Returns property FailureURL
 boolean getFormError()
          Deprecated.  
 boolean getFormInfo()
          Deprecated.  
 java.util.List getFormMessages()
          Returns a list of localized messages.
 java.util.Locale getLocale()
          Returns property mLocale
 GearMessagePublisher getPublisher()
           
 atg.portal.admin.I18nMessageProcessor getSuccessMessageProcessor()
          Returns the form message processor used for notifying the user about successes.
 java.lang.String getSuccessURL()
          Returns property SuccessURL
 java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns the locale associated with the request.
 boolean handleResetFormExceptions(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Clears out all form exceptions
 void handleResetFormMessages(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deprecated.  
 boolean handleSetLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          set the user locale to the locale property of this form handler.
 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
 void processException(java.lang.Exception pException, java.lang.String pMsgId, java.lang.String pParam, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Add a user error message to the form exceptions, and then display the exception in the logs
 void processException(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
 void processException(java.lang.String pMsgId, java.lang.String pParam, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Add a user error message to the form exceptions, and then display the exception in the logs
 void processSuccess(java.lang.String pMsgId, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Add an information message to the formMessages to be displayed by the form and sets formInfo to true.
 void processSuccess(java.lang.String pMsgId, java.lang.String pParam, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Add an information message to the formMessages to be displayed by the form and sets formInfo to true.
 void processSuccess(java.lang.String pMsgId, java.lang.String pParam1, java.lang.String pParam2, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Add an information message to the formMessages to be displayed by the form and sets formInfo to true.
 void resetFormMessages()
          Deprecated.  
 void sendAlertMessage(PortalMessage pMessage)
          Send an an alert message using the Publisher
 void setDefaultLocale(java.util.Locale pDefaultLocale)
          Sets property DefaultLocale
 void setFailureMessageProcessor(atg.portal.admin.I18nMessageProcessor pMessageProcessor)
          Changes the form message processor used for notifying the user about failures.
 void setFailureURL(java.lang.String pFailureURL)
          Sets property FailureURL
 void setPublisher(GearMessagePublisher pPublisher)
           
 void setSuccessMessageProcessor(atg.portal.admin.I18nMessageProcessor pMessageProcessor)
          Changes the form message processor used for notifying the user about successes.
 void setSuccessURL(java.lang.String pSuccessURL)
          Sets property SuccessURL
 void setUseRequestLocale(boolean pUseRequestLocale)
          Sets property UseRequestLocale
 
Methods inherited from class atg.droplet.TransactionalFormHandler
afterSet, beforeSet, checkFormRedirect, commitTransaction, getTransactionDemarcation, isEnsureTransaction, isRollbackTransaction, isRollbackTransactionOnUnhandledException, isTransactionMarkedAsRollback, setEnsureTransaction, setRollbackTransaction, setRollbackTransactionOnUnhandledException, setTransactionDemarcation
 
Methods inherited from class atg.droplet.GenericFormHandler
addUncheckedFormException, createFormSubmissionMessage, getCancelURL, getCheckForValidSession, 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, 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
Constructor Detail

PortalGenericFormHandler

public PortalGenericFormHandler()
Method Detail

getFailureMessageProcessor

public atg.portal.admin.I18nMessageProcessor getFailureMessageProcessor()
Returns the form message processor used for notifying the user about failures.


setFailureMessageProcessor

public void setFailureMessageProcessor(atg.portal.admin.I18nMessageProcessor pMessageProcessor)
Changes the form message processor used for notifying the user about failures.


getSuccessMessageProcessor

public atg.portal.admin.I18nMessageProcessor getSuccessMessageProcessor()
Returns the form message processor used for notifying the user about successes.


setSuccessMessageProcessor

public void setSuccessMessageProcessor(atg.portal.admin.I18nMessageProcessor pMessageProcessor)
Changes the form message processor used for notifying the user about successes.


setDefaultLocale

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

Parameters:
pDefaultLocale - the default locale for the current customer.

getDefaultLocale

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

Returns:
The value of the property DefaultLocale.

setUseRequestLocale

public void setUseRequestLocale(boolean pUseRequestLocale)
Sets property UseRequestLocale

Parameters:
pUseRequestLocale - boolean to specify whether to use request locale.

isUseRequestLocale

public boolean isUseRequestLocale()
Returns property UseRequestLocale

Returns:
The value of the property UseRequestLocale.

getLocale

public java.util.Locale getLocale()
Returns property mLocale

Returns:
The value of property Locale.

setSuccessURL

public void setSuccessURL(java.lang.String pSuccessURL)
Sets property SuccessURL

Parameters:
pSuccessURL - The property to store the value of SuccessURL.

getSuccessURL

public java.lang.String getSuccessURL()
Returns property SuccessURL

Returns:
The value of property SuccessURL.

setFailureURL

public void setFailureURL(java.lang.String pFailureURL)
Sets property FailureURL

Parameters:
pFailureURL - The property to store the value of FailureURL

getFailureURL

public java.lang.String getFailureURL()
Returns property FailureURL

Returns:
The value of property FailureURL.

setPublisher

public void setPublisher(GearMessagePublisher pPublisher)

getPublisher

public GearMessagePublisher getPublisher()

sendAlertMessage

public void sendAlertMessage(PortalMessage pMessage)
                      throws javax.jms.JMSException
Send an an alert message using the Publisher

Parameters:
pMessage -
Throws:
javax.jms.JMSException

processException

public void processException(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:
pMsgId - the message id
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

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 to process
pMsgId - the message id
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

processException

public void processException(java.lang.String pMsgId,
                             java.lang.String pParam,
                             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:
pMsgId - the message id
pParam - an optional parameter to format in the error message
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

processException

public void processException(java.lang.Exception pException,
                             java.lang.String pMsgId,
                             java.lang.String pParam,
                             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 to process
pMsgId - the message id
pParam - an optional parameter to format in the error message
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

processSuccess

public void processSuccess(java.lang.String pMsgId,
                           java.lang.String pParam1,
                           java.lang.String pParam2,
                           DynamoHttpServletRequest pRequest,
                           DynamoHttpServletResponse pResponse)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Add an information message to the formMessages to be displayed by the form and sets formInfo to true.

Parameters:
pMsgId - the message id
pParam1 - first param
pParam2 - second param
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

processSuccess

public void processSuccess(java.lang.String pMsgId,
                           java.lang.String pParam,
                           DynamoHttpServletRequest pRequest,
                           DynamoHttpServletResponse pResponse)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Add an information message to the formMessages to be displayed by the form and sets formInfo to true.

Parameters:
pMsgId - the message id
pParam - optional param
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

processSuccess

public void processSuccess(java.lang.String pMsgId,
                           DynamoHttpServletRequest pRequest,
                           DynamoHttpServletResponse pResponse)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Add an information message to the formMessages to be displayed by the form and sets formInfo to true.

Parameters:
pMsgId - the message id
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

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 - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

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 - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io
See Also:
AdminUserMessage

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 - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io
See Also:
AdminUserMessage

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 - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io
See Also:
AdminUserMessage

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 - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io
See Also:
AdminUserMessage

resetFormMessages

public void resetFormMessages()
Deprecated. 

This clears the success messages. It exists only for backwards compatibility. You should use the MessageProcessor interface instead.

See Also:
MessageProcessor

handleResetFormMessages

public void handleResetFormMessages(DynamoHttpServletRequest pRequest,
                                    DynamoHttpServletResponse pResponse)
                             throws javax.servlet.ServletException,
                                    java.io.IOException
Deprecated. 

This clears the success messages. It exists only for backwards compatibility. You should use the MessageProcessor interface instead.

Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
MessageProcessor

getFormInfo

public boolean getFormInfo()
Deprecated. 

Returns true if there are any pending form messages. This exists for backwards compatibility; you should use the MessageProcessor interface instead.

See Also:
MessageProcessor

getFormMessages

public java.util.List getFormMessages()
Returns a list of localized messages. This exists for backwards compatibility; you should use the MessageProcessor interface to extract messages instead.


handleResetFormExceptions

public boolean handleResetFormExceptions(DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
                                  throws javax.servlet.ServletException,
                                         java.io.IOException
Clears out all form exceptions

Throws:
javax.servlet.ServletException
java.io.IOException

handleSetLocale

public boolean handleSetLocale(DynamoHttpServletRequest pRequest,
                               DynamoHttpServletResponse pResponse)
                        throws java.io.IOException,
                               javax.servlet.ServletException
set the user locale to the locale property of this form handler.

Throws:
java.io.IOException
javax.servlet.ServletException

addFormException

public void addFormException(DropletException exc)
Overrides the addFormException method to capture any exceptions added by the super classes.

Overrides:
addFormException in class GenericFormHandler

getFormError

public boolean getFormError()
Deprecated. 

Returns true if there are any pending form error messages. This exists for backwards compatibility; you should use the MessageProcessor interface instead.

Overrides:
getFormError in class GenericFormHandler
See Also:
MessageProcessor