Package io.jmix.emailtemplates
Interface EmailTemplateBuilder
- All Known Implementing Classes:
EmailTemplateBuilderImpl
public interface EmailTemplateBuilder
That interface provides abilities of builder pattern to create filled email template
EmailTemplate
.
There are a lot of 'set' and 'add' intermediate methods and five terminal methods.
The implementation must contain copy of email template that have to filled by terminal methods.-
Method Summary
Modifier and TypeMethodDescriptionThat terminal method fills 'attachedFiles' property of email templateEmailTemplate
.addAttachmentReport
(Report report) That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
by oneTemplateReport
for that report.That terminal method fills 'bcc' property of email templateEmailTemplate
.That terminal method fills 'cc' property of email templateEmailTemplate
.That terminal method fills 'to' property of email templateEmailTemplate
.build()
That intermediate method creates copy of filledEmailTemplate
That intermediate method createsEmailInfo
by filled email template usingEmailTemplates
.void
That intermediate method sends filled email templateEmailTemplate
usingEmailer
.void
sendEmail
(boolean async) That intermediate method sends filled email templateEmailTemplate
usingEmailer
.void
That intermediate method asynchronously sends filled email templateEmailTemplate
usingEmailer
.That terminal method fills 'attachedFiles' property of email templateEmailTemplate
.setAttachmentParameter
(Report report, String key, Object value) That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
.setAttachmentParameters
(ReportWithParams reportWithParams) That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
.setAttachmentParameters
(Report report, Map<String, Object> params) That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
.setAttachmentParameters
(Collection<ReportWithParams> reportsWithParams) That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
.setAttachmentReports
(Collection<Report> reports) That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
by collection ofTemplateReport
for each reports.That terminal method fills 'bcc' property of email templateEmailTemplate
.setBodyParameter
(String key, Object value) That terminal method fillsTemplateReport
for child entity of email templateEmailTemplate
.setBodyParameters
(Map<String, Object> params) That terminal method fillsTemplateReport
of child entity of email templateEmailTemplate
.That terminal method fills 'cc' property of email templateEmailTemplate
.void
setEmailTemplate
(EmailTemplate emailTemplate) Clones specified email template and set it for the builder instanceThat terminal method fills 'from' property of email templateEmailTemplate
.setSubject
(String subject) That terminal method fills subject property of email templateEmailTemplate
.That terminal method fills 'to' property of email templateEmailTemplate
.
-
Method Details
-
setEmailTemplate
Clones specified email template and set it for the builder instance- Parameters:
emailTemplate
- email template
-
setSubject
That terminal method fills subject property of email templateEmailTemplate
.- Parameters:
subject
-String
- Returns:
EmailTemplateBuilder
-
setFrom
That terminal method fills 'from' property of email templateEmailTemplate
.- Parameters:
from
-String
- Returns:
EmailTemplateBuilder
-
addTo
That terminal method fills 'to' property of email templateEmailTemplate
. Addresses is added to already existed by the concatenation with ',' symbol.- Parameters:
to
-String
- Returns:
EmailTemplateBuilder
-
setTo
That terminal method fills 'to' property of email templateEmailTemplate
.- Parameters:
to
-String
- Returns:
EmailTemplateBuilder
-
addCc
That terminal method fills 'cc' property of email templateEmailTemplate
. Addresses is added to already existed by the concatenation with ',' symbol.- Parameters:
cc
-String
- Returns:
EmailTemplateBuilder
-
setCc
That terminal method fills 'cc' property of email templateEmailTemplate
.- Parameters:
cc
-String
- Returns:
EmailTemplateBuilder
-
addBcc
That terminal method fills 'bcc' property of email templateEmailTemplate
. Addresses is added to already existed by the concatenation with ',' symbol.- Parameters:
bcc
-String
- Returns:
EmailTemplateBuilder
-
setBcc
That terminal method fills 'bcc' property of email templateEmailTemplate
.- Parameters:
bcc
-String
- Returns:
EmailTemplateBuilder
-
addAttachmentReport
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
by oneTemplateReport
for that report.- Parameters:
report
-Report
- Returns:
EmailTemplateBuilder
-
setAttachmentReports
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
by collection ofTemplateReport
for each reports.- Parameters:
reports
- collection ofReport
- Returns:
EmailTemplateBuilder
-
addAttachmentFile
That terminal method fills 'attachedFiles' property of email templateEmailTemplate
.- Parameters:
file
-EmailTemplateAttachment
- Returns:
EmailTemplateBuilder
-
setAttachmentFiles
That terminal method fills 'attachedFiles' property of email templateEmailTemplate
.- Parameters:
files
- list ofEmailTemplateAttachment
- Returns:
EmailTemplateBuilder
-
setBodyParameter
That terminal method fillsTemplateReport
for child entity of email templateEmailTemplate
. If there are no reports with parameter with alias 'key', do nothing.- Parameters:
key
-String
is alias property ofParameterValue
value
-Object
will be converted to defaultValue property ofParameterValue
- Returns:
EmailTemplateBuilder
-
setBodyParameters
That terminal method fillsTemplateReport
of child entity of email templateEmailTemplate
. If there are no reports with parameter with aliases that contained in key set, do nothing.- Parameters:
params
-Map
- Returns:
EmailTemplateBuilder
-
setAttachmentParameter
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
. Method removes allTemplateReport
with same report if they exist.- Parameters:
report
- reportkey
-String
is alias property ofParameterValue
value
-Object
will be converted to defaultValue property ofParameterValue
- Returns:
EmailTemplateBuilder
-
setAttachmentParameters
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
. Method removes allTemplateReport
with same report if they exist.- Parameters:
reportWithParams
-ReportWithParams
- Returns:
EmailTemplateBuilder
-
setAttachmentParameters
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
. Method removes allTemplateReport
with same report if they exist.- Parameters:
report
-Report
params
-Map
- Returns:
EmailTemplateBuilder
-
setAttachmentParameters
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
. Method removes allTemplateReport
with same report if they exist.- Parameters:
reportsWithParams
- collection ofReportWithParams
- Returns:
EmailTemplateBuilder
-
generateEmail
That intermediate method createsEmailInfo
by filled email template usingEmailTemplates
.- Returns:
EmailInfo
from Jmix emailer- Throws:
ReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.TemplateNotFoundException
- If emailTemplate does not contain reports or null.
-
build
EmailTemplate build()That intermediate method creates copy of filledEmailTemplate
- Returns:
EmailTemplate
from Jmix emailer
-
sendEmail
void sendEmail() throws TemplateNotFoundException, ReportParameterTypeChangedException, EmailExceptionThat intermediate method sends filled email templateEmailTemplate
usingEmailer
.- Throws:
ReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.TemplateNotFoundException
- If emailTemplate does not contain reports or null.EmailException
- if an error occurs during email sending
-
sendEmail
void sendEmail(boolean async) throws TemplateNotFoundException, ReportParameterTypeChangedException, EmailException That intermediate method sends filled email templateEmailTemplate
usingEmailer
.- Parameters:
async
- Provides choice of selecting asynchronous option.- Throws:
ReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.TemplateNotFoundException
- If emailTemplate does not contain reports or null.EmailException
- if an error occurs during email sending
-
sendEmailAsync
That intermediate method asynchronously sends filled email templateEmailTemplate
usingEmailer
.- Throws:
ReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.TemplateNotFoundException
- If emailTemplate does not contain reports or null.
-