com.softslate.commerce.customer.core
Class ActionUtils

java.lang.Object
  extended bycom.softslate.commerce.customer.core.ActionUtils

public class ActionUtils
extends java.lang.Object

Provides static methods that assist with actions in the Struts layer.

Author:
David Tobey

Field Summary
(package private) static org.apache.commons.logging.Log log
           
 
Constructor Summary
ActionUtils()
           
 
Method Summary
static java.lang.String parseGenericTemplate(BaseForm baseForm, java.lang.String template)
          Parses a string template with variables contained in a given BaseForm.
static 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.
static java.lang.StringBuffer replaceOrderItems(java.lang.StringBuffer source, java.util.Collection orderItems)
          Parses a StringBuffer, inserting order item data.
static 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.
static 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)
          Sends a multipart text and HTML email from the store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static org.apache.commons.logging.Log log
Constructor Detail

ActionUtils

public ActionUtils()
Method Detail

parseGenericTemplate

public static java.lang.String parseGenericTemplate(BaseForm baseForm,
                                                    java.lang.String template)
Parses a string template with variables contained in a given BaseForm. 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.

Parameters:
baseForm - Contains variables that will be used to replace the template's placeholders.
template - A String containing placeholders that this method will replace.
Returns:
The parsed template.

replaceValue

public static 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.

Parameters:
source - The StringBuffer being parsed.
value - The value the placeholder is being replaced with.
token - The placeholder being replaced.
Returns:
The parsed StringBuffer.

replaceOrderItems

public static java.lang.StringBuffer replaceOrderItems(java.lang.StringBuffer source,
                                                       java.util.Collection orderItems)
Parses a 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.

Parameters:
source - The StringBuffer being parsed.
orderItems - A Collection of OrderItem objects whose data is used to parse the source.
Returns:
The parsed StringBuffer.

parseLostPasswordTemplate

public static 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. 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.

Parameters:
customer - 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.
Returns:
The parsed template.

sendMultipartEmail

public static 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)
                               throws java.lang.Exception
Sends a multipart text and HTML email from the store. Used for sending order notifications, invoices, and lost password emails.

Parameters:
toEmails - 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.
Throws:
java.lang.Exception


Copyright © SoftSlate, Inc. 2003–2005