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 providesEmailTemplateBuilderfluent builder API for email template.buildFromTemplate(String code) That method providesEmailTemplateBuilderfluent builder API by template with unique string code.voidcheckParameterTypeChanged(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 createsEmailInfofrom template that may contain the same reports with different parameter values.generateEmail(EmailTemplate emailTemplate, Map<String, Object> params) That method createsEmailInfoby template and parameters map for all included reports.generateEmail(String emailTemplateCode, Collection<ReportWithParams> params) That method createsEmailInfoby template with unique string code.generateEmail(String emailTemplateCode, Map<String, Object> params) That method createsEmailInfoby template with unique string code.
-
Method Details
-
generateEmail
EmailInfo generateEmail(EmailTemplate emailTemplate, Map<String, Object> params) throws TemplateNotFoundException, ReportParameterTypeChangedExceptionThat method createsEmailInfoby template and parameters map for all included reports.- Parameters:
emailTemplate-EmailTemplateentity containing body and attachments reportsparams- map containing parameters for all included reports- Returns:
EmailInfofrom 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 createsEmailInfofrom template that may contain the same reports with different parameter values.- Parameters:
emailTemplate-EmailTemplateentity containing body and attachments reportsparams-ReportWithParamswrapper containing report and its parameters- Returns:
EmailInfofrom 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 createsEmailInfoby template with unique string code.- Parameters:
emailTemplateCode- unique string code of email templateparams- map containing parameters for all included reports- Returns:
EmailInfofrom 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 createsEmailInfoby template with unique string code.- Parameters:
emailTemplateCode- unique string code of email templateparams-ReportWithParamswrapper containing report and its parameters- Returns:
EmailInfofrom 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-ReportInputParameterfrom Jmix reportingparameterValue- entityParameterValueto save report parameter default value- Throws:
ReportParameterTypeChangedException- If parameter type of inputParameter does not equal to type saved in parameterValue.
-
buildFromTemplate
That method providesEmailTemplateBuilderfluent builder API for email template.- Parameters:
emailTemplate-EmailTemplateentity containing body and attachments reports- Returns:
EmailTemplateBuilderfluent template builder API
-
buildFromTemplate
That method providesEmailTemplateBuilderfluent builder API by template with unique string code.- Parameters:
code- unique string code of email template*- Returns:
EmailTemplateBuilderfluent template builder API- Throws:
TemplateNotFoundException- If emailTemplate does not contain reports or null
-