public class AdmTestSiteEmails extends MainServlet implements FileUploadListener
Modifier and Type | Class and Description |
---|---|
protected class |
AdmTestSiteEmails.Context
Inner class used to store servlet context information.
|
FlashServlet.Stack
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
The class' serialization version id.
|
DISPLAY_MODE, SN_ADMINMODE, SN_CATEGORIES, SN_CATEGORIES_LISTONLY, SN_CATEGORIES_PATH, SN_CATEGORY, SN_CONTINUE_PAGEURL, SN_PRODUCTS, SN_PRODUCTS_INSTOCK, SN_PRODUCTS_NOSTOCK, SN_PRODUCTS_PAFILTERS, SN_PRODUCTS_PAGEHIST, SN_PRODUCTS_PAGENUM, SN_PRODUCTS_PAGEURL, SOURCE_CATALOG, SOURCE_FAVORITES, SOURCE_SEARCH, SOURCE_SHOPCART, SOURCE_SPECIAL
SN_CART, SN_LOGON_STATUS, SN_SECPROFILE, SN_USER, SN_USERSFI
BROWSER_IE, BROWSER_NN, BROWSER_XX, RESP_NULL, RESP_REDIRECTED, RQST_AJAX, RQST_NULL
Constructor and Description |
---|
AdmTestSiteEmails() |
Modifier and Type | Method and Description |
---|---|
protected void |
ajaxRequest(AdmTestSiteEmails.Context ctx)
Handles processing for an AJAX request.
|
protected void |
ajaxRequestUpdate(AdmTestSiteEmails.Context ctx)
Handles processing for an AJAX request for user update.
|
protected void |
ajaxRequestUserIds(AdmTestSiteEmails.Context ctx)
Handles processing for an AJAX request for user ids.
|
protected void |
ajaxRequestVersions(AdmTestSiteEmails.Context ctx)
Handles processing for an AJAX request for template versions.
|
protected void |
ajaxResponse(AdmTestSiteEmails.Context ctx,
java.lang.String respdata)
Handles sending a response for an AJAX request.
|
private boolean |
configuredFileExists(java.lang.String type,
java.lang.String extension)
Answers if a file exists for the given message type and file extension
based on configured values in properties.
|
protected MainServlet.Context |
createContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates the servlet context inner class.
|
protected boolean |
editFormFields(BaseServlet.Context baseCtx)
Edits the values from the html template's form fields.
|
private java.io.File |
getConfiguredFile(java.lang.String type,
java.lang.String extension)
Returns the file for the given message type and file extension based on
configured values in properties.
|
private java.util.ArrayList<java.lang.String> |
getConfiguredTypes()
Returns a collection of the configured message type property keys.
|
private org.apache.velocity.VelocityContext |
getMessageContent(AdmTestSiteEmails.Context ctx,
java.lang.String type)
Returns the content for a message type.
|
private void |
getMessageContentExtra(AdmTestSiteEmails.Context ctx,
java.lang.String type,
org.apache.velocity.VelocityContext content)
Retrieves and sets any extra content for a message type.
|
protected java.lang.String |
getNextURL(BaseServlet.Context baseCtx)
Returns the next URL (including parameters) to be processed when this
servlet's processing has been successfully completed (no edit errors, etc.).
|
private Customer |
getSampleBillto(AdmTestSiteEmails.Context ctx)
Returns a Customer object using values from the configured sample data
spreadsheet file.
|
private Order |
getSampleOrder(AdmTestSiteEmails.Context ctx)
Returns an ERP Order object using values from the configured sample data
spreadsheet file.
|
private RestockNotification |
getSampleRestock(AdmTestSiteEmails.Context ctx,
java.lang.String type)
Returns a Restock Notification object using values from the configured
sample data spreadsheet file.
|
private Shipper |
getSampleShipper(AdmTestSiteEmails.Context ctx)
Returns a Shipper object using values from the configured sample data
spreadsheet file.
|
protected java.lang.String |
getTemplateName(BaseServlet.Context baseCtx)
Returns the name of the html template file used by the servlet.
|
private java.util.ArrayList<java.lang.String> |
getTemplateVersions(java.lang.String tmpid,
java.lang.String dlvmeth)
Returns the versions for a template id and delivery method (email,sms,push)
from the Notification Framework.
|
private boolean |
isValidSendRequest(AdmTestSiteEmails.Context ctx)
Answers if a Send request is valid based on the known information at the
time the request is made.
|
protected void |
readParameters(BaseServlet.Context baseCtx,
boolean post)
Reads the parameters passed to the servlet via the http request object.
|
protected void |
resetFormFields(BaseServlet.Context baseCtx)
Resets the values for the html template's form fields.
|
private boolean |
sendConfiguredSample(AdmTestSiteEmails.Context ctx)
Sends a sample message for a configured file.
|
private boolean |
sendPlainTextSample(AdmTestSiteEmails.Context ctx)
Sends a sample message for a plain text message type.
|
private boolean |
sendSpecifiedSample(AdmTestSiteEmails.Context ctx,
boolean upload)
Sends a sample message for a specified file.
|
protected void |
setCookieValues(BaseServlet.Context baseCtx)
Adds one or more values to the http session cookies.
|
protected void |
setSessionValues(BaseServlet.Context baseCtx)
Adds one or more values to the http session object.
|
protected void |
setTemplateData(BaseServlet.Context baseCtx)
Sets the various data required by the html template.
|
protected void |
setTemplateDataNF(AdmTestSiteEmails.Context ctx)
Sets the various data required by the html template when the notification
framework is active.
|
protected boolean |
setTemplateError(AdmTestSiteEmails.Context ctx,
java.lang.String errName)
Sets the html template error fields for the given error name.
|
void |
uploadComplete(FileUploadEvent event)
Handles a file upload completion event.
|
confirmSession, getPreviousCategoryList, getPreviousCategoryPath, hasSubcategories, hasSubcategories, isOmitNoStock, isPreshopRequest, isUserHelpRequest, setTemplateCategoryPath, sortCategoryProductData, writePageImpl
confirmCart, confirmRequest, confirmRetail, confirmWholesale, createNewCart, createNewSessionImpl, getPageTitle, getServletPath, getUser, initTemplateDataImpl, isLogonRequest, requestComplete, requiresLogon, resetCart, resetCategories, resetProducts, setDefaultUser, setSessionCart, setSFIShoppingUser, useExistingSessionImpl, writeCookie
createNewSession, determineBrowser, doGet, doPost, getCookie, getInvokerName, getInvokerName, getInvokerParams, getInvokerParams, getInvokerPath, getInvokerPath, getInvokerURL, getPageParams, getRequestURL, getServletName, getServletName, getServletParams, getServletParams, getServletPath, getServletURL, getServletURL, getTemplateMessage, getTemplateMessage, getTemplateMessage, getTemplateMessage, getTemplateMessage, initTemplateData, isPrintable, isServerTomcat, log, qualifyURL, redirectURL, setP3PCompactPolicy, showSiteError, showSiteError, showSiteError, useExistingSession, writeCookie, writeTempCookie
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
private static final long serialVersionUID
protected boolean editFormFields(BaseServlet.Context baseCtx)
doPost
method.
Overrides editFormFields
in BaseServlet
.editFormFields
in class BaseServlet
baseCtx
- (Context) The current servlet context.true
if all the edits are successful,
otherwise false
.protected java.lang.String getNextURL(BaseServlet.Context baseCtx)
writeURL
method.
Overrides getNextURL
in BaseServlet
.getNextURL
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected java.lang.String getTemplateName(BaseServlet.Context baseCtx)
writePage
method.
Overrides getTemplateName
in BaseServlet
.getTemplateName
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void readParameters(BaseServlet.Context baseCtx, boolean post)
doGet
and doPost
method.
Overrides readParameters
in BaseServlet
.readParameters
in class BaseServlet
baseCtx
- (Context) The current servlet context.post
- (boolean) true
if the method is invoked from
doPost
, otherwise false
.protected void resetFormFields(BaseServlet.Context baseCtx)
doGet
and doPost
methods.
Overrides resetFormFields
in BaseServlet
.resetFormFields
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void setCookieValues(BaseServlet.Context baseCtx) throws java.io.IOException
writeURL
method. Calls should be made to writeCookie
for each cookie that needs to be set.
Overrides setCookieValues
in BaseServlet
.setCookieValues
in class BaseServlet
baseCtx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs when adding the
cookie to the response header.protected void setSessionValues(BaseServlet.Context baseCtx)
writeURL
method.
Overrides setSessionValues
in BaseServlet
.setSessionValues
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void setTemplateData(BaseServlet.Context baseCtx)
writePage
method.
Overrides setTemplateData
in BaseServlet
.setTemplateData
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void setTemplateDataNF(AdmTestSiteEmails.Context ctx)
setTemplateData
method.ctx
- (Context) The current servlet context.public void uploadComplete(FileUploadEvent event)
uploadComplete
in interface FileUploadListener
event
- (FileUploadEvent) The upload event to process.protected boolean setTemplateError(AdmTestSiteEmails.Context ctx, java.lang.String errName)
ctx
- (Context) The current servlet context.errName
- (String) The name of error that is to be set, used
to determine which message (or messages) to retrieve from the
message properties.false
.private boolean configuredFileExists(java.lang.String type, java.lang.String extension)
type
- (String) The message type to be checked.extension
- (String) The file extension to be checked.true
if a file exists for the given message
type and file extension, otherwise false
.private java.io.File getConfiguredFile(java.lang.String type, java.lang.String extension)
type
- (String) The message type for the configured file.extension
- (String) The file extension for the configured file.null
if the specified message type
has no configured file.private java.util.ArrayList<java.lang.String> getConfiguredTypes()
private org.apache.velocity.VelocityContext getMessageContent(AdmTestSiteEmails.Context ctx, java.lang.String type)
ctx
- (Context) The current servlet context.type
- (String) The type of message for the desired content.private void getMessageContentExtra(AdmTestSiteEmails.Context ctx, java.lang.String type, org.apache.velocity.VelocityContext content)
ctx
- (Context) The current servlet context.type
- (String) The type of message for the desired content.content
- (VelocityContext) The current message content.private Customer getSampleBillto(AdmTestSiteEmails.Context ctx)
ctx
- (Context) The current servlet context.private Order getSampleOrder(AdmTestSiteEmails.Context ctx)
ctx
- (Context) The current servlet context.private RestockNotification getSampleRestock(AdmTestSiteEmails.Context ctx, java.lang.String type)
ctx
- (Context) The current servlet context.type
- (String) The current message type being processed. Will
either be MailMessage.LOWSTOCK or MailMessage.RESTOCK.private Shipper getSampleShipper(AdmTestSiteEmails.Context ctx)
ctx
- (Context) The current servlet context.private java.util.ArrayList<java.lang.String> getTemplateVersions(java.lang.String tmpid, java.lang.String dlvmeth)
tmpid
- (String) The template id for the desired versions.dlvmeth
- (String) The delivery method for the desired versions.private boolean isValidSendRequest(AdmTestSiteEmails.Context ctx)
ctx
- (Context) The current servlet context.true
if the request is valid, otherwise
false
.private boolean sendConfiguredSample(AdmTestSiteEmails.Context ctx) throws java.lang.Exception
ctx
- (Context) The current servlet context.true
if the sample is successfully sent,
otherwise false
.java.lang.Exception
- - if an error occurs while attempting to
send the sample.private boolean sendSpecifiedSample(AdmTestSiteEmails.Context ctx, boolean upload) throws java.lang.Exception
ctx
- (Context) The current servlet context.upload
- (boolean) true
to perform the file upload
processing, otherwise false
to send the sample message.true
if the sample is successfully sent,
otherwise false
.java.lang.Exception
- - if an error occurs while attempting to
send the sample.private boolean sendPlainTextSample(AdmTestSiteEmails.Context ctx) throws java.lang.Exception
ctx
- (Context) The current servlet context.true
if the sample is successfully sent,
otherwise false
.java.lang.Exception
- - if an error occurs while attempting to
send the sample.protected void ajaxRequest(AdmTestSiteEmails.Context ctx)
ctx
- (Context) The current servlet context.protected void ajaxRequestUserIds(AdmTestSiteEmails.Context ctx)
THIS METHOD IS NEVER INVOKED. IT WAS ORGINALLY CREATED WHEN A DIFFERENT APPROACH TO DEFINING A USER ID FOR TESTING WAS PLANNED.
ctx
- (Context) The current servlet context.protected void ajaxRequestUpdate(AdmTestSiteEmails.Context ctx)
ctx
- (Context) The current servlet context.protected void ajaxRequestVersions(AdmTestSiteEmails.Context ctx)
ctx
- (Context) The current servlet context.protected void ajaxResponse(AdmTestSiteEmails.Context ctx, java.lang.String respdata)
ctx
- (Context) The current servlet context.respdata
- (String) The response data as a string.protected MainServlet.Context createContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
createContext
in MainServlet
.
Invoked by doPost
and doGet
methods.createContext
in class MainServlet
request
- (HttpServletRequest) The servlet's incoming request.response
- (HttpServletResponse) The servlet's outgoing response.