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 templateEmailTemplateby oneTemplateReportfor 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 filledEmailTemplateThat intermediate method createsEmailInfoby filled email template usingEmailTemplates.voidThat intermediate method sends filled email templateEmailTemplateusingEmailer.voidsendEmail(boolean async) That intermediate method sends filled email templateEmailTemplateusingEmailer.voidThat intermediate method asynchronously sends filled email templateEmailTemplateusingEmailer.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 templateEmailTemplateby collection ofTemplateReportfor each reports.That terminal method fills 'bcc' property of email templateEmailTemplate.setBodyParameter(String key, Object value) That terminal method fillsTemplateReportfor child entity of email templateEmailTemplate.setBodyParameters(Map<String, Object> params) That terminal method fillsTemplateReportof child entity of email templateEmailTemplate.That terminal method fills 'cc' property of email templateEmailTemplate.voidsetEmailTemplate(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 templateEmailTemplateby oneTemplateReportfor that report.- Parameters:
report-Report- Returns:
EmailTemplateBuilder
-
setAttachmentReports
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplateby collection ofTemplateReportfor 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 fillsTemplateReportfor child entity of email templateEmailTemplate. If there are no reports with parameter with alias 'key', do nothing.- Parameters:
key-Stringis alias property ofParameterValuevalue-Objectwill be converted to defaultValue property ofParameterValue- Returns:
EmailTemplateBuilder
-
setBodyParameters
That terminal method fillsTemplateReportof 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 allTemplateReportwith same report if they exist.- Parameters:
report- reportkey-Stringis alias property ofParameterValuevalue-Objectwill be converted to defaultValue property ofParameterValue- Returns:
EmailTemplateBuilder
-
setAttachmentParameters
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate. Method removes allTemplateReportwith same report if they exist.- Parameters:
reportWithParams-ReportWithParams- Returns:
EmailTemplateBuilder
-
setAttachmentParameters
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate. Method removes allTemplateReportwith same report if they exist.- Parameters:
report-Reportparams-Map- Returns:
EmailTemplateBuilder
-
setAttachmentParameters
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate. Method removes allTemplateReportwith same report if they exist.- Parameters:
reportsWithParams- collection ofReportWithParams- Returns:
EmailTemplateBuilder
-
generateEmail
That intermediate method createsEmailInfoby filled email template usingEmailTemplates.- Returns:
EmailInfofrom 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:
EmailTemplatefrom Jmix emailer
-
sendEmail
void sendEmail() throws TemplateNotFoundException, ReportParameterTypeChangedException, EmailExceptionThat intermediate method sends filled email templateEmailTemplateusingEmailer.- 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 templateEmailTemplateusingEmailer.- 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 templateEmailTemplateusingEmailer.- Throws:
ReportParameterTypeChangedException- If parameter type of inputParameter does not equal to type saved in parameterValue.TemplateNotFoundException- If emailTemplate does not contain reports or null.
-