|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.softslate.commerce.customer.core.ActionUtilsImpl
public class ActionUtilsImpl
ActionUtilsImpl is the default implementation of the
ActionUtils interface for the application.
ActionUtils| Field Summary | |
|---|---|
(package private) static org.apache.commons.logging.Log |
adminAuditLog
|
(package private) static org.apache.commons.logging.Log |
customerAuditLog
|
(package private) static org.apache.commons.logging.Log |
log
|
| Constructor Summary | |
|---|---|
ActionUtilsImpl()
|
|
| Method Summary | |
|---|---|
void |
addInventoryMessages(java.util.Map results,
BaseForm baseForm)
Adds non-error messages to the request related to inventory. |
java.util.Map |
buildParameterMap(javax.servlet.http.HttpServletRequest request)
Creates a string-based Map based on all the request parameters. |
java.lang.String |
createTrackingNumberLink(java.lang.String trackingNumber)
Returns the URL link to look up a given tracking number's status, on either the UPS, USPS, or FedEx website. |
java.lang.String |
findCheckoutScreen(BaseForm baseForm)
Determines what checkout screen to direct the user to based on the status of the session and the store's database configuration. |
java.lang.String |
formatDate(java.lang.String dbDate,
java.util.Locale locale)
Given a String representing a date as stored in the
database, returns a more human-readable version suitable for display. |
java.lang.String |
generateCodeFromName(java.lang.String name)
|
java.lang.String |
getRequestParamsDebugMessage(javax.servlet.http.HttpServletRequest request)
Given a request object, converts all the incoming parameters to a string for debugging. |
java.util.Collection |
loadEstimatedShippingOptions(BaseForm baseForm)
Load a set of estimated shipping options for the current cart. |
java.lang.String |
makeFilenameNice(java.lang.String originalFileName)
Eliminates non-standard characters from a file name so it can be safely saved across various file systems. |
boolean |
onAdministratorPreRequestEnd(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Runs at the beggining of each request to the administrator interface, after system objects have been initialized. |
boolean |
onCustomerPreRequestEnd(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Runs at the beggining of each request to the customer interface, after system objects have been initialized. |
boolean |
onPreRequestEnd(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Runs at the beggining of each request, after system objects have been initialized. |
java.lang.String |
parseGenericTemplate(BaseForm baseForm,
java.lang.String template)
Parses a string template with variables contained in a given BaseForm. |
java.lang.String |
parseLostPasswordTemplate(Customer customer,
BaseForm baseForm,
java.lang.String template)
Parses a string template with variables contained in a given BaseForm and
Customer. |
java.lang.String |
parseLowStockTemplate(BaseForm baseForm,
java.util.Map lowStockEmail,
java.lang.String template)
Parses a string template with variables contained in a given BaseForm and a Map holding information about a
SKU. |
void |
processAuditLogging(javax.servlet.http.HttpServletRequest request)
Create log entries in the application's audit logs, containing all the key information about each request. |
java.lang.String |
processCartAddResults(java.util.Map results,
BaseForm baseForm)
Process the results of adding an item or items to the cart. |
void |
processSavedCartCookie(BaseForm baseForm,
java.util.Map parameters,
javax.servlet.http.HttpServletResponse response)
If the system settings permit it, add a persistent cookie to the user's browser identifying the cart so it can be loaded on a later visit. |
java.lang.String |
readFile(java.lang.String filename)
Reads a text file and returns its contents as a string. |
java.lang.StringBuffer |
replaceOrderItems(java.lang.StringBuffer source,
java.util.Collection orderItems,
java.lang.String currencyCode,
java.util.Locale locale,
BusinessObjectUtils utils)
Parses a StringBuffer, inserting order item data. |
java.lang.StringBuffer |
replaceValue(java.lang.StringBuffer source,
java.lang.String value,
java.lang.String token)
Replaces the given token, or placeholder, with the given value in the given StringBuffer. |
protected void |
saveErrors(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMessages errors)
|
boolean |
saveFile(java.lang.String filename,
java.io.InputStream file)
Saves an input stream as a file at a given location. |
protected void |
saveMessages(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMessages messages)
|
void |
sendLowStockEmails(java.util.Collection lowStockEmails,
BaseForm baseForm)
Sends low stock emails related to the item or items being added to the cart. |
void |
sendMultipartEmail(java.lang.String toEmails,
java.lang.String ccEmails,
java.lang.String bccEmails,
java.lang.String fromEmail,
java.lang.String smtpServer,
java.lang.String subject,
java.lang.String textMessage,
java.lang.String htmlMessage,
java.lang.String username,
java.lang.String password)
Sends a multipart text and HTML email from the store. |
void |
sendMultipartEmail(java.lang.String toEmails,
java.lang.String ccEmails,
java.lang.String bccEmails,
java.lang.String fromEmail,
java.lang.String smtpServer,
java.lang.String subject,
java.lang.String textMessage,
java.lang.String htmlMessage,
java.lang.String username,
java.lang.String password,
java.lang.String smtpPort,
java.lang.String characterEncoding)
Sends a multipart text and HTML email from the store. |
void |
sendMultipartEmail(java.lang.String toEmails,
java.lang.String ccEmails,
java.lang.String bccEmails,
java.lang.String fromEmail,
java.lang.String smtpServer,
java.lang.String subject,
java.lang.String textMessage,
java.lang.String htmlMessage,
java.lang.String username,
java.lang.String password,
java.lang.String smtpPort,
java.lang.String characterEncoding,
java.lang.String attachmentName,
byte[] attachment,
java.lang.String attachmentType)
Sends a multipart text and HTML email from the store. |
void |
sendMultipartEmail(java.lang.String toEmails,
java.lang.String ccEmails,
java.lang.String bccEmails,
java.lang.String fromEmail,
java.lang.String smtpServer,
java.lang.String subject,
java.lang.String textMessage,
java.lang.String htmlMessage,
java.lang.String username,
java.lang.String password,
java.lang.String smtpPort,
java.lang.String characterEncoding,
java.lang.String attachmentName,
byte[] attachment,
java.lang.String attachmentType,
java.util.Map<java.lang.String,java.lang.String> extraHeaders)
|
boolean |
validateBillingFields(BaseForm baseForm)
Validates the required billing address fields in the user's cart. |
boolean |
validateDeliveryFields(BaseForm baseForm)
Validates the required delivery address fields in the user's cart. |
boolean |
writeFile(java.lang.String filename,
java.lang.String fileContents)
Writes a text file to a given location. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static org.apache.commons.logging.Log log
static org.apache.commons.logging.Log customerAuditLog
static org.apache.commons.logging.Log adminAuditLog
| Constructor Detail |
|---|
public ActionUtilsImpl()
| Method Detail |
|---|
public java.lang.String parseGenericTemplate(BaseForm baseForm,
java.lang.String template)
ActionUtilsBaseForm. Used to parse email templates for dynamically
generated emails the store generates.
The string template may have a number of placeholders deliniated by "%%".
(E.g. "%%STORE_NAME%%"). This method replaces the placeholders with
values from the BaseForm, be they settings from the database
such as the store's name, or values from the current user's order.
Note that with the release of 2.0, order invoice emails are now generated
from JSP templates in the /WEB-INF/layouts/default/order
directory, rather than by using this method.
parseGenericTemplate in interface ActionUtilsbaseForm - Contains variables that will be used to replace the template's
placeholders.template - A String containing placeholders that this method
will replace.
public java.lang.StringBuffer replaceValue(java.lang.StringBuffer source,
java.lang.String value,
java.lang.String token)
StringBuffer.
source - The StringBuffer being parsed.value - The value the placeholder is being replaced with.token - The placeholder being replaced.
StringBuffer.
public java.lang.StringBuffer replaceOrderItems(java.lang.StringBuffer source,
java.util.Collection orderItems,
java.lang.String currencyCode,
java.util.Locale locale,
BusinessObjectUtils utils)
StringBuffer, inserting order item data. Loops
through the "%%START_ITEMS%%" and "%%END_ITEMS%%" placeholders, inserting
data from a given Collection of
OrderItem objects.
Used to parse the invoice email template upon order completion.
source - The StringBuffer being parsed.orderItems - A Collection of
OrderItem
objects whose data is used to parse the source.
StringBuffer.
public java.lang.String parseLostPasswordTemplate(Customer customer,
BaseForm baseForm,
java.lang.String template)
ActionUtilsBaseForm and
Customer. Used to
parse the lost password email template.
The string template may have a number of placeholders deliniated by "%%".
(E.g. "%%USERNAME%%"). This method replaces the placeholders with values
from the BaseForm and Customer, be they
settings from the database such as the store's name, or the current
customer's user name and password.
parseLostPasswordTemplate in interface ActionUtilscustomer - The current Customer whose lost password is being
emailed.baseForm - Contains variables that will be used to replace the template's
placeholders.template - The template for the lost password email, which is being
parsed.
public java.lang.String parseLowStockTemplate(BaseForm baseForm,
java.util.Map lowStockEmail,
java.lang.String template)
ActionUtilsBaseForm and a Map holding information about a
SKU. Used to parse the low stock email template.
parseLowStockTemplate in interface ActionUtilsbaseForm - Contains variables that will be used to replace the template's
placeholders.lowStockEmail - A Map containing information about a SKU that has
hit its low stock level.template - The template for the low stock email, which is being parsed.
public void sendMultipartEmail(java.lang.String toEmails,
java.lang.String ccEmails,
java.lang.String bccEmails,
java.lang.String fromEmail,
java.lang.String smtpServer,
java.lang.String subject,
java.lang.String textMessage,
java.lang.String htmlMessage,
java.lang.String username,
java.lang.String password)
throws java.lang.Exception
ActionUtils
sendMultipartEmail in interface ActionUtilstoEmails - A comma-separated list of email addresses the email is being
sent to.ccEmails - A comma-separated list of email addresses the email is being
copied to.bccEmails - A comma-separated list of email addresses the email is being
blind copied to.fromEmail - The email address used as the email's from address.smtpServer - The SMTP server to be used to send the email.subject - The subject used for the email.textMessage - The message for the text part of the email.htmlMessage - The message for the HTML part of the email.username - Username for SMTP authentication, or null if no authentication
is required.password - Password for SMTP authentication, or null if no authentication
is required.
java.lang.Exception
public void sendMultipartEmail(java.lang.String toEmails,
java.lang.String ccEmails,
java.lang.String bccEmails,
java.lang.String fromEmail,
java.lang.String smtpServer,
java.lang.String subject,
java.lang.String textMessage,
java.lang.String htmlMessage,
java.lang.String username,
java.lang.String password,
java.lang.String smtpPort,
java.lang.String characterEncoding)
throws java.lang.Exception
ActionUtils
sendMultipartEmail in interface ActionUtilstoEmails - A comma-separated list of email addresses the email is being
sent to.ccEmails - A comma-separated list of email addresses the email is being
copied to.bccEmails - A comma-separated list of email addresses the email is being
blind copied to.fromEmail - The email address used as the email's from address.smtpServer - The SMTP server to be used to send the email.subject - The subject used for the email.textMessage - The message for the text part of the email.htmlMessage - The message for the HTML part of the email.username - Username for SMTP authentication, or null if no authentication
is required.password - Password for SMTP authentication, or null if no authentication
is required.characterEncoding - Optional character encoding to be used for the email. If null
or empty, no particular encoding is specified.
java.lang.Exception
public void sendMultipartEmail(java.lang.String toEmails,
java.lang.String ccEmails,
java.lang.String bccEmails,
java.lang.String fromEmail,
java.lang.String smtpServer,
java.lang.String subject,
java.lang.String textMessage,
java.lang.String htmlMessage,
java.lang.String username,
java.lang.String password,
java.lang.String smtpPort,
java.lang.String characterEncoding,
java.lang.String attachmentName,
byte[] attachment,
java.lang.String attachmentType)
throws java.lang.Exception
ActionUtils
sendMultipartEmail in interface ActionUtilstoEmails - A comma-separated list of email addresses the email is being
sent to.ccEmails - A comma-separated list of email addresses the email is being
copied to.bccEmails - A comma-separated list of email addresses the email is being
blind copied to.fromEmail - The email address used as the email's from address.smtpServer - The SMTP server to be used to send the email.subject - The subject used for the email.textMessage - The message for the text part of the email.htmlMessage - The message for the HTML part of the email.username - Username for SMTP authentication, or null if no authentication
is required.password - Password for SMTP authentication, or null if no authentication
is required.characterEncoding - Optional character encoding to be used for the email. If null
or empty, no particular encoding is specified.attachmentName - Name of the attachment (report.xls)attachment - Byte array of data for simple attachmentsattachmentType - The mime type of the attachment (application/vnd.ms-excel)
java.lang.Exception
public void sendMultipartEmail(java.lang.String toEmails,
java.lang.String ccEmails,
java.lang.String bccEmails,
java.lang.String fromEmail,
java.lang.String smtpServer,
java.lang.String subject,
java.lang.String textMessage,
java.lang.String htmlMessage,
java.lang.String username,
java.lang.String password,
java.lang.String smtpPort,
java.lang.String characterEncoding,
java.lang.String attachmentName,
byte[] attachment,
java.lang.String attachmentType,
java.util.Map<java.lang.String,java.lang.String> extraHeaders)
throws java.lang.Exception
java.lang.Exception
public java.lang.String formatDate(java.lang.String dbDate,
java.util.Locale locale)
String representing a date as stored in the
database, returns a more human-readable version suitable for display.
(Specifically, uses this mask to format the date:
MMM d, yyyy HH:mm:ss.)
dbDate - The date as stored in the database.locale - The local to use to format the date.
public java.lang.String findCheckoutScreen(BaseForm baseForm)
throws java.lang.Exception
ActionUtils
The above screen names correspond to
ActionForwards defined in the
"/WEB-INF/conf/order/struts-config-order.xml" file.
findCheckoutScreen in interface ActionUtils
baseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
java.lang.Exception
public boolean validateBillingFields(BaseForm baseForm)
throws java.lang.Exception
ActionUtils
validateBillingFields in interface ActionUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
true if all the required billing fields are present
in the user's cart. false if not.
java.lang.Exception
public boolean validateDeliveryFields(BaseForm baseForm)
throws java.lang.Exception
ActionUtils
validateDeliveryFields in interface ActionUtilsbaseForm - The form class corresponding to the current request. Holds
various properties of the request to help action classes
communicate with the rest of the application.
true if all the required billing fields are present
in the user's cart. false if not.
java.lang.Exception
public java.lang.String makeFilenameNice(java.lang.String originalFileName)
throws java.lang.Exception
ActionUtils
makeFilenameNice in interface ActionUtilsjava.lang.Exception
public java.lang.String readFile(java.lang.String filename)
throws java.lang.Exception
ActionUtils
readFile in interface ActionUtilsjava.lang.Exception
public boolean writeFile(java.lang.String filename,
java.lang.String fileContents)
throws java.lang.Exception
ActionUtils
writeFile in interface ActionUtilsjava.lang.Exception
public boolean saveFile(java.lang.String filename,
java.io.InputStream file)
throws java.lang.Exception
ActionUtils
saveFile in interface ActionUtilsjava.lang.Exception
public boolean onPreRequestEnd(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
ActionUtils
onPreRequestEnd in interface ActionUtils
public boolean onCustomerPreRequestEnd(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
ActionUtils
onCustomerPreRequestEnd in interface ActionUtils
public boolean onAdministratorPreRequestEnd(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
ActionUtils
onAdministratorPreRequestEnd in interface ActionUtilspublic void processAuditLogging(javax.servlet.http.HttpServletRequest request)
ActionUtils
processAuditLogging in interface ActionUtils
public void processSavedCartCookie(BaseForm baseForm,
java.util.Map parameters,
javax.servlet.http.HttpServletResponse response)
ActionUtilsA cookie with the name "sscsctoken" and the value of the user's session id will be saved in the browser and recorded in the sscOrder database table's "savedCartToken" field.
processSavedCartCookie in interface ActionUtilsbaseForm - The instance of CartAddForm corresponding to the
request.parameters - The parameters of the add to cart request.response - The servlet's response object, used to save the cookie to the
browser.
public java.lang.String processCartAddResults(java.util.Map results,
BaseForm baseForm)
ActionUtils
In the case of an error, the attribute "errorProductCode" is set in the
request, corresponding to the product code of the first item being added
to the cart. If the submission came from a product page, this will tell
the ProductForm to populate the request with that product's
data, so the errors can be displayed on the product page.
Finally, this method calls the addInventoryMessages method,
to populate the request with (non-error) messages relating to inventory.
processCartAddResults in interface ActionUtilsresults - The Map of results returned by the call to the
execute method of this class.baseForm - The instance of CartAddForm corresponding to the
request.
ActionFoward that the execute method
will return.
public void addInventoryMessages(java.util.Map results,
BaseForm baseForm)
ActionUtils
addInventoryMessages in interface ActionUtilsresults - The Map of results returned by the call to the
execute method of this class.baseForm - The instance of CartAddForm corresponding to the
current request.
public void sendLowStockEmails(java.util.Collection lowStockEmails,
BaseForm baseForm)
ActionUtilssscSetting and (for specific products) in the
sscProductSetting database tables. Among the settings are
who receives the low-stock emails, what inventory level triggers the
emails, and a template for the subject and body of the emails.
sendLowStockEmails in interface ActionUtilslowStockEmails - A Collection of Maps containing information on what items have
reached their low stock levels. This Collection is returned by
the call to
CartProcessor.processAddItems(Map)
in the execute method.baseForm - The instance of CartAddForm corresponding to the
current request.public java.util.Collection loadEstimatedShippingOptions(BaseForm baseForm)
ActionUtils
loadEstimatedShippingOptions in interface ActionUtils
public java.util.Map buildParameterMap(javax.servlet.http.HttpServletRequest request)
throws java.lang.Exception
ActionUtils
buildParameterMap in interface ActionUtilsjava.lang.Exceptionpublic java.lang.String getRequestParamsDebugMessage(javax.servlet.http.HttpServletRequest request)
ActionUtils
getRequestParamsDebugMessage in interface ActionUtilsrequest - The current request object.
protected void saveErrors(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMessages errors)
protected void saveMessages(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMessages messages)
public java.lang.String generateCodeFromName(java.lang.String name)
generateCodeFromName in interface ActionUtilspublic java.lang.String createTrackingNumberLink(java.lang.String trackingNumber)
ActionUtils
createTrackingNumberLink in interface ActionUtils
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||