Package io.jmix.emailtemplates
Interface EmailTemplates
- All Known Implementing Classes:
EmailTemplatesImpl
public interface EmailTemplates
That interface provides converting email template
EmailTemplate
with report parameters
to Jmix email info EmailInfo
.
There are two cases to pass the report parameters. It is map to pass non-repeating parameters for all included reports,
and list of wrappers ReportWithParams
containing parameters for each report separately.
Also interface provides checking that report parameter type ReportInputParameter
was changed. It compares with
parameter type value saved in ParameterValue
entity.-
Method Summary
Modifier and TypeMethodDescriptionbuildFromTemplate
(EmailTemplate emailTemplate) That method providesEmailTemplateBuilder
fluent builder API for email template.buildFromTemplate
(String code) That method providesEmailTemplateBuilder
fluent builder API by template with unique string code.void
checkParameterTypeChanged
(ReportInputParameter inputParameter, ParameterValue parameterValue) That method checks that the report input parameter did not change own parameter typegenerateEmail
(EmailTemplate emailTemplate, Collection<ReportWithParams> params) That method createsEmailInfo
from template that may contain the same reports with different parameter values.generateEmail
(EmailTemplate emailTemplate, Map<String, Object> params) That method createsEmailInfo
by template and parameters map for all included reports.generateEmail
(String emailTemplateCode, Collection<ReportWithParams> params) That method createsEmailInfo
by template with unique string code.generateEmail
(String emailTemplateCode, Map<String, Object> params) That method createsEmailInfo
by template with unique string code.
-
Method Details
-
generateEmail
EmailInfo generateEmail(EmailTemplate emailTemplate, Map<String, Object> params) throws TemplateNotFoundException, ReportParameterTypeChangedExceptionThat method createsEmailInfo
by template and parameters map for all included reports.- Parameters:
emailTemplate
-EmailTemplate
entity containing body and attachments reportsparams
- map containing parameters for all included reports- Returns:
EmailInfo
from Jmix emailer- Throws:
TemplateNotFoundException
- If emailTemplate does not contain reports or nullReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.
-
generateEmail
EmailInfo generateEmail(EmailTemplate emailTemplate, Collection<ReportWithParams> params) throws TemplateNotFoundException, ReportParameterTypeChangedException That method createsEmailInfo
from template that may contain the same reports with different parameter values.- Parameters:
emailTemplate
-EmailTemplate
entity containing body and attachments reportsparams
-ReportWithParams
wrapper containing report and its parameters- Returns:
EmailInfo
from Jmix emailer- Throws:
TemplateNotFoundException
- If emailTemplate does not contain reports or nullReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.
-
generateEmail
EmailInfo generateEmail(String emailTemplateCode, Map<String, Object> params) throws TemplateNotFoundException, ReportParameterTypeChangedExceptionThat method createsEmailInfo
by template with unique string code.- Parameters:
emailTemplateCode
- unique string code of email templateparams
- map containing parameters for all included reports- Returns:
EmailInfo
from Jmix emailer- Throws:
TemplateNotFoundException
- If emailTemplate does not contain reports or nullReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.
-
generateEmail
EmailInfo generateEmail(String emailTemplateCode, Collection<ReportWithParams> params) throws TemplateNotFoundException, ReportParameterTypeChangedException That method createsEmailInfo
by template with unique string code.- Parameters:
emailTemplateCode
- unique string code of email templateparams
-ReportWithParams
wrapper containing report and its parameters- Returns:
EmailInfo
from Jmix emailer- Throws:
TemplateNotFoundException
- If emailTemplate does not contain reports or nullReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.
-
checkParameterTypeChanged
void checkParameterTypeChanged(ReportInputParameter inputParameter, ParameterValue parameterValue) throws ReportParameterTypeChangedException That method checks that the report input parameter did not change own parameter type- Parameters:
inputParameter
-ReportInputParameter
from Jmix reportingparameterValue
- entityParameterValue
to save report parameter default value- Throws:
ReportParameterTypeChangedException
- If parameter type of inputParameter does not equal to type saved in parameterValue.
-
buildFromTemplate
That method providesEmailTemplateBuilder
fluent builder API for email template.- Parameters:
emailTemplate
-EmailTemplate
entity containing body and attachments reports- Returns:
EmailTemplateBuilder
fluent template builder API
-
buildFromTemplate
That method providesEmailTemplateBuilder
fluent builder API by template with unique string code.- Parameters:
code
- unique string code of email template*- Returns:
EmailTemplateBuilder
fluent template builder API- Throws:
TemplateNotFoundException
- If emailTemplate does not contain reports or null
-