Package io.jmix.emailtemplates.impl
Class EmailTemplateBuilderImpl
java.lang.Object
io.jmix.emailtemplates.impl.EmailTemplateBuilderImpl
- All Implemented Interfaces:
EmailTemplateBuilder
@Component("emltmp_EmailTemplateBuilder")
@Scope("prototype")
public class EmailTemplateBuilderImpl
extends Object
implements EmailTemplateBuilder
-
Field Summary
Modifier and TypeFieldDescriptionprotected Emailer
protected EmailTemplate
protected EmailTemplates
protected Metadata
protected MetadataTools
protected List<ReportWithParams>
-
Constructor Summary
-
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
protected EmailTemplate
cloneTemplate
(EmailTemplate emailTemplate) 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
.
-
Field Details
-
emailTemplate
-
reportParams
-
metadata
-
emailTemplates
-
emailer
-
metadataTools
-
-
Constructor Details
-
EmailTemplateBuilderImpl
public EmailTemplateBuilderImpl()
-
-
Method Details
-
setEmailTemplate
Description copied from interface:EmailTemplateBuilder
Clones specified email template and set it for the builder instance- Specified by:
setEmailTemplate
in interfaceEmailTemplateBuilder
- Parameters:
emailTemplate
- email template
-
setSubject
Description copied from interface:EmailTemplateBuilder
That terminal method fills subject property of email templateEmailTemplate
.- Specified by:
setSubject
in interfaceEmailTemplateBuilder
- Parameters:
subject
-String
- Returns:
EmailTemplateBuilder
-
setFrom
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'from' property of email templateEmailTemplate
.- Specified by:
setFrom
in interfaceEmailTemplateBuilder
- Parameters:
from
-String
- Returns:
EmailTemplateBuilder
-
addTo
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'to' property of email templateEmailTemplate
. Addresses is added to already existed by the concatenation with ',' symbol.- Specified by:
addTo
in interfaceEmailTemplateBuilder
- Parameters:
to
-String
- Returns:
EmailTemplateBuilder
-
setTo
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'to' property of email templateEmailTemplate
.- Specified by:
setTo
in interfaceEmailTemplateBuilder
- Parameters:
to
-String
- Returns:
EmailTemplateBuilder
-
addCc
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'cc' property of email templateEmailTemplate
. Addresses is added to already existed by the concatenation with ',' symbol.- Specified by:
addCc
in interfaceEmailTemplateBuilder
- Parameters:
cc
-String
- Returns:
EmailTemplateBuilder
-
setCc
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'cc' property of email templateEmailTemplate
.- Specified by:
setCc
in interfaceEmailTemplateBuilder
- Parameters:
cc
-String
- Returns:
EmailTemplateBuilder
-
addBcc
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'bcc' property of email templateEmailTemplate
. Addresses is added to already existed by the concatenation with ',' symbol.- Specified by:
addBcc
in interfaceEmailTemplateBuilder
- Parameters:
bcc
-String
- Returns:
EmailTemplateBuilder
-
setBcc
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'bcc' property of email templateEmailTemplate
.- Specified by:
setBcc
in interfaceEmailTemplateBuilder
- Parameters:
bcc
-String
- Returns:
EmailTemplateBuilder
-
addAttachmentReport
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
by oneTemplateReport
for that report.- Specified by:
addAttachmentReport
in interfaceEmailTemplateBuilder
- Parameters:
report
-Report
- Returns:
EmailTemplateBuilder
-
setAttachmentReports
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
by collection ofTemplateReport
for each reports.- Specified by:
setAttachmentReports
in interfaceEmailTemplateBuilder
- Parameters:
reports
- collection ofReport
- Returns:
EmailTemplateBuilder
-
addAttachmentFile
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'attachedFiles' property of email templateEmailTemplate
.- Specified by:
addAttachmentFile
in interfaceEmailTemplateBuilder
- Parameters:
file
-EmailTemplateAttachment
- Returns:
EmailTemplateBuilder
-
setAttachmentFiles
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'attachedFiles' property of email templateEmailTemplate
.- Specified by:
setAttachmentFiles
in interfaceEmailTemplateBuilder
- Parameters:
files
- list ofEmailTemplateAttachment
- Returns:
EmailTemplateBuilder
-
setAttachmentParameter
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
. Method removes allTemplateReport
with same report if they exist.- Specified by:
setAttachmentParameter
in interfaceEmailTemplateBuilder
- Parameters:
report
- reportkey
-String
is alias property ofParameterValue
value
-Object
will be converted to defaultValue property ofParameterValue
- Returns:
EmailTemplateBuilder
-
setAttachmentParameters
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
. Method removes allTemplateReport
with same report if they exist.- Specified by:
setAttachmentParameters
in interfaceEmailTemplateBuilder
- Parameters:
reportWithParams
-ReportWithParams
- Returns:
EmailTemplateBuilder
-
setAttachmentParameters
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
. Method removes allTemplateReport
with same report if they exist.- Specified by:
setAttachmentParameters
in interfaceEmailTemplateBuilder
- Parameters:
report
-Report
params
-Map
- Returns:
EmailTemplateBuilder
-
setBodyParameter
Description copied from interface:EmailTemplateBuilder
That terminal method fillsTemplateReport
for child entity of email templateEmailTemplate
. If there are no reports with parameter with alias 'key', do nothing.- Specified by:
setBodyParameter
in interfaceEmailTemplateBuilder
- Parameters:
key
-String
is alias property ofParameterValue
value
-Object
will be converted to defaultValue property ofParameterValue
- Returns:
EmailTemplateBuilder
-
setBodyParameters
Description copied from interface:EmailTemplateBuilder
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.- Specified by:
setBodyParameters
in interfaceEmailTemplateBuilder
- Parameters:
params
-Map
- Returns:
EmailTemplateBuilder
-
setAttachmentParameters
Description copied from interface:EmailTemplateBuilder
That terminal method fills 'attachedTemplateReports' property of email templateEmailTemplate
. Method removes allTemplateReport
with same report if they exist.- Specified by:
setAttachmentParameters
in interfaceEmailTemplateBuilder
- Parameters:
reportsWithParams
- collection ofReportWithParams
- Returns:
EmailTemplateBuilder
-
generateEmail
public EmailInfo generateEmail() throws ReportParameterTypeChangedException, TemplateNotFoundExceptionDescription copied from interface:EmailTemplateBuilder
That intermediate method createsEmailInfo
by filled email template usingEmailTemplates
.- Specified by:
generateEmail
in interfaceEmailTemplateBuilder
- 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
Description copied from interface:EmailTemplateBuilder
That intermediate method creates copy of filledEmailTemplate
- Specified by:
build
in interfaceEmailTemplateBuilder
- Returns:
EmailTemplate
from Jmix emailer
-
cloneTemplate
-
sendEmail
public void sendEmail() throws TemplateNotFoundException, ReportParameterTypeChangedException, EmailExceptionDescription copied from interface:EmailTemplateBuilder
That intermediate method sends filled email templateEmailTemplate
usingEmailer
.- Specified by:
sendEmail
in interfaceEmailTemplateBuilder
- Throws:
TemplateNotFoundException
- If emailTemplate does not contain reports or null.ReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.EmailException
- if an error occurs during email sending
-
sendEmail
public void sendEmail(boolean async) throws TemplateNotFoundException, ReportParameterTypeChangedException, EmailException Description copied from interface:EmailTemplateBuilder
That intermediate method sends filled email templateEmailTemplate
usingEmailer
.- Specified by:
sendEmail
in interfaceEmailTemplateBuilder
- Parameters:
async
- Provides choice of selecting asynchronous option.- Throws:
TemplateNotFoundException
- If emailTemplate does not contain reports or null.ReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.EmailException
- if an error occurs during email sending
-
sendEmailAsync
Description copied from interface:EmailTemplateBuilder
That intermediate method asynchronously sends filled email templateEmailTemplate
usingEmailer
.- Specified by:
sendEmailAsync
in interfaceEmailTemplateBuilder
- Throws:
TemplateNotFoundException
- If emailTemplate does not contain reports or null.ReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.
-