org.apertereports.backbone.util
Class EmailProcessor
java.lang.Object
org.apertereports.backbone.util.EmailProcessor
- All Implemented Interfaces:
- ConfigurationConstants
public class EmailProcessor
- extends Object
- implements ConfigurationConstants
A helper class for processing email messages. Takes advantage of VelocityEngine to create email contents from template.
Uses a resource bundle message provider for template retrieval and Apache Commons Email library to send emails.
An application container should provide a javax.mail.session instance for it to work properly.
| Fields inherited from interface org.apertereports.common.ConfigurationConstants |
CONFIGURATION_CACHE_TIMEOUT_IN_MINUTES, JASPER_REPORTS_CHARACTER_ENCODING, JNDI_JMS_CONNECTION_FACTORY, JNDI_JMS_QUEUE_CYCLIC_REPORT, JNDI_JMS_QUEUE_GENERATE_REPORT, JNDI_MAIL_SESSION, MAIL_SEND_DELAY, MAIL_SESSION_USER, MESSAGE_PROVIDER_BGREPORT_EMAIL_MESSAGE, MESSAGE_PROVIDER_BGREPORT_EMAIL_TITLE, MESSAGE_PROVIDER_RESOURCE |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getInstance
public static EmailProcessor getInstance()
- Gets the singleton instance of this class.
- Returns:
- An EmailProcessor instance
processEmail
public void processEmail(ReportOrder reportOrder)
throws Exception
- Processes an email message from report order. The
javax.mail.session instance is taken from the initial
context. This should be configured in the application server hosting Vries.
The email message consists of a title and a proper message - these two should be returned by the resource
bundle message provider. The latter should be a velocity message template. Current implementation
contains information about the report itself and a generation date.
The contents of the generated report are sent as an attachment to the message.
- Parameters:
reportOrder -
- Throws:
Exception
getCharset
public String getCharset()
setCharset
public void setCharset(String charset)
getMessageProvider
public ResourceBundleMessageProvider getMessageProvider()
setMessageProvider
public void setMessageProvider(ResourceBundleMessageProvider messageProvider)
Copyright © 2011. All Rights Reserved.