Info |
---|
Help is available by sending an email to csf-support@mit.edu |
Tip |
---|
Need to know the configurable properties for csf-email? Go to The project .properties file properties for more information. |
Panel | |
---|---|
Quick Links to:
|
Panel |
---|
CSF Email Service Technical Spec
Table of Contents |
---|
Panel | |
---|---|
Anchor | AuthorizationsTechnicalSpec-1.Introducti | AuthorizationsTechnicalSpec-1.Introducti
1. Introductionindent | The CSF Service is a module in CSF to handle various functions related to sending emails to a single or group of recipients. The implementation will include all the methods in the existing EmailServiceImpl in CSF common-legacy. New methods are added
handle the bulk and preview functionality. The EmailServiceImpl is not annotated so it has to be configured in one of the application Context files in the web application. It is not annotated so we can inject the ApplicationConfiguration for those web applications that are using sais-common.functionality. In addition, new functionalities have been added to store the email message |
Panel | ||||||
---|---|---|---|---|---|---|
2. Dependencies2.1 CSF base | ||||||
Panel | ||||||
Anchor | | AuthorizationsTechnicalSpec-2.Dependencies | AuthorizationsTechnicalSpec-2.Dependencies | |||
indent | 1 | 1 | ||||
h4.{anchor:AuthorizationsTechnicalSpec-2.1ESCommon}*2.1 CSF base*
| ||||||
indent | 2 | 2 | We will utilize CSF base module to{anchor:
Anchor | |
---|---|
|
...
|
...
2.2 CSF testWe will utilize CSF test module to facilitate the unit tests created for the email module 2.3 CSF ormWe will utilize CSF orm module to facilitate the IO operations of its dao. |
Panel |
---|
...
3. Object Model |
...
...
3. |
...
1 Class Diagram |
...
The following domain classes are created to represent (1) EmailModel is created to hold all the fields in an email message |
...
. It is used by other web application The following diagram represents the domain class EmailModel. |
...
(2) EmailEvent is a persistent object created to represent the persist object for each email that is queued or sent. (3) EmailAttachment is a persistent object created to save the attachment associated with email events. The following diagram represents the domain class EmailEvent and EmailAttachment and their relationship: 3.2 Class Description. |
...
3.2.1 EmailModelThis is the domain class that represents an Email Message object. It contains the following fields:
3.2.2 EmailPersonThis is the domain class that represents an Email Person object. |
...
It contains the following fields:
3.2.3 EmailEventThis is the domain class that represents the persisted Email Event object. It contains the following fields:
3.2.4 EmailAttachment This is the domain class that represents the persisted Email Attachment object. It contains the
|
Panel | |||||||
---|---|---|---|---|---|---|---|
4. Service Modules
4.1 Class Diagram4.2 Class Descriptions.4.2.1 EmailService InterfaceThis is the interface that defines the methods available for the other web applications to utilize when they are required
4.2.3 EmailService |
...
...
Wiki Markup |
---|
This is the interface that defines the methods available for the other web applications to utilize when they are required to send out emails to a single or a list of recipients. The service includes the following methods:
<span style="color: #000091">public</span> <span style="color: #910091">void</span> sendBulkEmail(EmailModel emailModel)
<span style="color: #000091">public</span> <span style="color: #910091">void</span> sendBulkEmailWithTemplate(EmailModel emailModel, String velocityTemplate, Map context)
<span style="color: #000091">public</span> <span style="color: #910091">Map<String, Integer></span> sendBulkEmailWithCounts(EmailModel emailModel)
<span style="color: #000091">public</span> <span style="color: #910091">Map<String, Object></span> generateEmailPreviewWithTemplate(EmailModel emailModel, String type, String velocityTemplate, Map context)
public <span style="color: #910091">Map<String, Object></span> generateSummaryReportPreview(EmailModel emailModel)
<span style="color: #000091">public</span> <span style="color: #910091">void</span> newEmail(String velocityTemplate, Map context, String to, String from, String subject, boolean html)
<span style="color: #000091">public</span> <span style="color: #910091">void</span> newEmail(String velocityTemplate, Map context, String\[\] tos, String from, String subject, boolean html)
<span style="color: #000091">public</span> <span style="color: #910091">void</span> newEmail(String velocityTemplate, Map context, String to, String subject, boolean html)
<span style="color: #000091">public</span> <span style="color: #910091">void</span> newEmail(String velocityTemplate, Map context, String\[\] tos, String subject, boolean html)
<span style="color: #000091">public</span> <span style="color: #910091">void</span> newEmail(String body, String to, String subject, boolean html)
<span style="color: #000091">public</span> <span style="color: #910091">void</span> newEmail(String from, String\[\] to, String subject, String body, String\[\] cc, String\[\] bcc, String\[\] rr)
<span style="color: #000091">public</span> <span style="color: #910091">List</span> getMessageQueue()
public <span style="color: #910091">void</span> batchSend()
public <span style="color: #910091">boolean</span> validateEmailAddress(String emailAddress) |
...
ImplementationThis is the implementation class for the |
...
EmailService |
...
. |
4.2.3. |
...
1 sendBulkEmail |
...
This |
...
method |
...
obtains |
...
an |
...
EmailModelDomain |
...
Object. |
...
It |
...
will |
...
then |
...
process |
...
the |
...
data |
...
and |
...
call |
...
the |
...
newEmail |
...
method |
...
to |
...
save the |
...
...
and |
...
|
...
summary |
...
report for the |
...
intended |
...
recipients. |
...
The |
...
call |
...
to |
...
the |
...
newEmail |
...
method |
...
should |
...
be |
...
configured |
...
with |
...
the |
...
following |
...
parameters: |
...
|
...
from, |
...
String |
...
[ |
...
] |
...
to, |
...
String |
...
subject, |
...
String |
...
body, |
...
String |
...
[ |
...
] |
...
cc, |
...
String |
...
[ |
...
] |
...
bcc, |
...
String |
...
[ |
...
] |
...
rr); |
...
|
...
following |
...
attributes |
...
in |
...
the |
...
EmailModel |
...
Object |
...
will |
...
affect |
...
the |
...
generation |
...
of |
...
email:
4.2.3.2 sendBulkEmailWithTemplateThis method obtains an EmailModel Object, a velocity template name and a map that contains the values for the variables in the template. |
...
create |
...
report for intended recipients. |
...
...
4.2.3. |
...
3 |
...
sendBulkEmailWithCounts |
...
This method obtains an EmailModel Object. It will call the sendBulkEmail method |
...
to create and save the email message and the summary 4.2.3.4 generateEmailPreviewWithTemplateThis method obtains an EmailModel Object, a string to specify the type of preview, a velocity template name, and a Map that contains the values |
...
tect to the email model object and put the updated object into the returned Map. If a summary report preview is required, it 4.2.3.5 generateSummaryReportPreviewThis private method adds the objects/attributes necessary to create a preview of the summary report. The objects to be added are as |
...
follows: |
...
|
4.2.3 |
...
.6 sendEmailWithAttachmentsThis method accepts an EmailModel object and a list of attachments. It will then call newEmail method to create and save the message(s) in database. 4.2.3 |
...
.7 sendEmailWithTemplateAndAttachmentsThis method accepts an EmailModel object, a velocity template name, a map of replaced values, and a list of File objects (attachments). It will then 4.2.3. |
...
8 sendEmailWithAttachmentsFromDataSource This method accepts an EmailModel object and a list of DataSource objects(attachments) and a boolean to signal the system to use the from 4.2.3. |
...
9 newEmailThese |
...
sets of methods are |
...
the same public methods available in the EmailService in the CSF common-legacy module. 4.2.3 |
...
.10 sendReportRecipientEmail4.2.3.11 createReportRecipientContentThis method is a public method migrated over from the EmailServiceImpl in common-legacy module. 4.2.3. |
...
12 saveMessageThis is a private method |
...
that are is called within the EmailServiceImpl to save the email message (just text 4.2.3.13 saveMessageWithAttachmentAsDataSource This is a private method that is called within the EmailServiceImpl to save the email message with a list of 4.2.3.14 updateDataToEmailEventThis is a private method that are is called within the EmailServiceImpl to update the data to the EmailEvent table. 4.2.3.15 updateApplicationConfigurationParametersToEmailEventThis is a protected method that are is called within the EmailServiceImpl to update the data to the EmailEvent object 4.2.3. |
...
16 updateMessageContentThis is a private method that are is called within the EmailServiceImpl by various prepare method to update the 4.2.3.17 createMimeMessagePreparatorForEmailWithCcBccAttachmentsThis is a |
...
private method that are is called within the EmailServiceImpl to create a MimeMessage preparator instance 4.2.3.18 createMimeMessagePreparatorForEmailThis is a private method that are is called within the EmailServiceImpl to create a MimeMessage preparator instance 4.2.3.19 prepareThe 4 prepare methods are static public methods that are available to create the MimeMessage object for each email 4.2.3. |
...
20 batchSendThis method is a public method migrated over from the EmailServiceImpl in common-legacy module. 4.2.3. |
...
21 sendMessageThis is a private method that is called within the EmailServiceImpl to send the email message via the email server. 4.2.3.22 getMessageQueueThis method is a public method migrated over from the EmailServiceImpl in common-legacy module. 4.2.3.23 getMessageQueueStatisticsThis method is a public method that will retrieve statistics from the database based on criteria including from date, 4.2.3. |
...
24 validateEmailAddressThis method takes an input of email address in String and validate if the email address is valid. If the email address is valid, it will return
4.2.3.25 deleteThis method deletes records from the email event and email attachment tables, based on a configurable parameter: email.in.system.days, 4.2.3.26 getTemplatePathThis method returns the path where the velocity template locates. 4.2.3.27 getFileSeparatorThis method takes returns the file separator string for the system EmailService is running on. 4.2.3.28 isTomcatServerThis method checks if the system running the EmailService is a tomcat server. It will return a Boolean. 4.2.3.29 isErrorInEmailMetaDataThis method takes will verify if the pass in parameter is in the correct format. 4.2.3.30 getMimeTypeThis method returns the MimeType of the file 4.2.3.31 handleExceptionThis is a private method that prints out the exception message and stack trace to log. 4.2.3.32 nonNullizeArrayAn utility method to replace the null with an empty array if a method passed a null String array as a Cc or Bcc list |