| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmagoffin.matt.ma2.aop.AbstractMailTemplateInterceptor
magoffin.matt.ma2.aop.UserEmailInterceptor
public class UserEmailInterceptor
Handle emailing user emails.
This interceptor requires the intercepted method to have a 
 User object as a parameter, from 
 which the email will be sent to. If the method also has a 
 BizContext parameter, the interceptor
 will look for a WebBizContext.URL_BASE
 attribute to prepend to the confirmUrl.
 
The confirmUrl field is used to construct a URL to 
 include in the merged email body. The value of this field can contain
 any variables available in the email body merge model object (except
 itself, of course). Note that due to possible unattended variable 
 processing of variables derived from property files, the variables
 in this field may be specified with $[var] instead
 of the normal ${var} syntax.
The mail merge model will be set up with the following attributes:
User object intercepted from 
   the method parameter.user and result
   attributes with the confirmUrl field.See the AbstractMailTemplateInterceptor
 class for more information about the email fields (like subject).
The configurable properties of this class are:
| Field Summary | |
|---|---|
| static java.lang.String | CONFIRM_URL_KEYThe model key for the confirmation URL. | 
| static java.lang.String | RESULT_KEYThe model key for the result object. | 
| static java.lang.String | USER_KEYThe model key for the User object. | 
| Fields inherited from class magoffin.matt.ma2.aop.AbstractMailTemplateInterceptor | 
|---|
| log | 
| Constructor Summary | |
|---|---|
| UserEmailInterceptor() | |
| Method Summary | |
|---|---|
|  java.lang.String | getConfirmUrl() | 
| protected  java.util.Map<java.lang.String,java.lang.Object> | getInitialModel(org.aopalliance.intercept.MethodInvocation invocation)Get an initial Map object to use for the model data for the mail merge. | 
| protected  java.util.Locale | getLocale(org.aopalliance.intercept.MethodInvocation invocation,
          java.util.Map<java.lang.String,java.lang.Object> model,
          java.lang.Object result)Get the locale for the email message. | 
| protected  org.springframework.mail.SimpleMailMessage | postProcessModel(org.aopalliance.intercept.MethodInvocation invocation,
                 java.util.Map<java.lang.String,java.lang.Object> model,
                 java.lang.Object result)Get a SimpleMailMessage object based on the result of the method invocation. | 
|  void | setConfirmUrl(java.lang.String confirmUrl) | 
| Methods inherited from class magoffin.matt.ma2.aop.AbstractMailTemplateInterceptor | 
|---|
| getMailMergeSupport, invoke, setMailMergeSupport | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final java.lang.String USER_KEY
public static final java.lang.String RESULT_KEY
public static final java.lang.String CONFIRM_URL_KEY
| Constructor Detail | 
|---|
public UserEmailInterceptor()
| Method Detail | 
|---|
protected java.util.Map<java.lang.String,java.lang.Object> getInitialModel(org.aopalliance.intercept.MethodInvocation invocation)
AbstractMailTemplateInterceptor
getInitialModel in class AbstractMailTemplateInterceptorinvocation - the current method invocation
protected org.springframework.mail.SimpleMailMessage postProcessModel(org.aopalliance.intercept.MethodInvocation invocation,
                                                                      java.util.Map<java.lang.String,java.lang.Object> model,
                                                                      java.lang.Object result)
AbstractMailTemplateInterceptorYou can use the MailMergeHelper instance's 
 MailMergeHelper.getMessageTemplate() method to obtain a mail message
 template, and use the 
 SimpleMailMessage.SimpleMailMessage(org.springframework.mail.SimpleMailMessage)
 copy constructor to create the SimpleMailMessage to return here. Most likely the 
 only property you'll need to set on the result if the to property.
postProcessModel in class AbstractMailTemplateInterceptorinvocation - the current method invocationmodel - the model Mapresult - the method invocation result object
to property
protected java.util.Locale getLocale(org.aopalliance.intercept.MethodInvocation invocation,
                                     java.util.Map<java.lang.String,java.lang.Object> model,
                                     java.lang.Object result)
AbstractMailTemplateInterceptorThis implementation simply returns Locale.getDefault(). Extending 
 implementations can use the invocation and invocation result to provide 
 a custom Locale as deisred.
getLocale in class AbstractMailTemplateInterceptorinvocation - the current method invocationmodel - the modelresult - the resut of the current modthod invocation
public java.lang.String getConfirmUrl()
public void setConfirmUrl(java.lang.String confirmUrl)
confirmUrl - The confirmUrl to set.| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||