Package io.jmix.emailtemplates.impl
Class EmailTemplatesImpl
java.lang.Object
io.jmix.emailtemplates.impl.EmailTemplatesImpl
- All Implemented Interfaces:
EmailTemplates
@Component("emltmp_EmailTemplates")
public class EmailTemplatesImpl
extends Object
implements EmailTemplates
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
protected FileStorageLocator
protected Metadata
protected ReportRunner
protected TemplateConverter
-
Constructor Summary
-
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 typeprotected EmailAttachment
createEmailAttachment
(String templateName, ReportWithParams reportWithParams) protected ReportWithParams
createParamsMapForReport
(Report report, Map<String, Object> params) protected List<EmailAttachment>
createReportAttachments
(Map<TemplateReport, ReportWithParams> reportsWithParams) generateEmail
(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.protected EmailInfo
generateEmailInfoWithoutAttachments
(ReportWithParams reportWithParams) protected EmailTemplateBuilder
getEmailTemplateBuilder
(EmailTemplate emailTemplate) protected EmailTemplate
getEmailTemplateByCode
(String emailTemplateCode)
-
Field Details
-
reportRunner
-
fileStorageLocator
-
templateConverter
-
applicationContext
@Autowired protected org.springframework.context.ApplicationContext applicationContext -
metadata
-
-
Constructor Details
-
EmailTemplatesImpl
public EmailTemplatesImpl()
-
-
Method Details
-
generateEmail
public EmailInfo generateEmail(EmailTemplate emailTemplate, Collection<ReportWithParams> params) throws TemplateNotFoundException, ReportParameterTypeChangedException Description copied from interface:EmailTemplates
That method createsEmailInfo
from template that may contain the same reports with different parameter values.- Specified by:
generateEmail
in interfaceEmailTemplates
- 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
public EmailInfo generateEmail(EmailTemplate emailTemplate, Map<String, Object> params) throws TemplateNotFoundException, ReportParameterTypeChangedExceptionDescription copied from interface:EmailTemplates
That method createsEmailInfo
by template and parameters map for all included reports.- Specified by:
generateEmail
in interfaceEmailTemplates
- 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
public EmailInfo generateEmail(String emailTemplateCode, Map<String, Object> params) throws TemplateNotFoundException, ReportParameterTypeChangedExceptionDescription copied from interface:EmailTemplates
That method createsEmailInfo
by template with unique string code.- Specified by:
generateEmail
in interfaceEmailTemplates
- 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
public EmailInfo generateEmail(String emailTemplateCode, Collection<ReportWithParams> params) throws TemplateNotFoundException, ReportParameterTypeChangedException Description copied from interface:EmailTemplates
That method createsEmailInfo
by template with unique string code.- Specified by:
generateEmail
in interfaceEmailTemplates
- 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.
-
getEmailTemplateByCode
protected EmailTemplate getEmailTemplateByCode(String emailTemplateCode) throws TemplateNotFoundException - Throws:
TemplateNotFoundException
-
checkParameterTypeChanged
public void checkParameterTypeChanged(ReportInputParameter inputParameter, ParameterValue parameterValue) throws ReportParameterTypeChangedException Description copied from interface:EmailTemplates
That method checks that the report input parameter did not change own parameter type- Specified by:
checkParameterTypeChanged
in interfaceEmailTemplates
- 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
Description copied from interface:EmailTemplates
That method providesEmailTemplateBuilder
fluent builder API for email template.- Specified by:
buildFromTemplate
in interfaceEmailTemplates
- Parameters:
emailTemplate
-EmailTemplate
entity containing body and attachments reports- Returns:
EmailTemplateBuilder
fluent template builder API
-
buildFromTemplate
Description copied from interface:EmailTemplates
That method providesEmailTemplateBuilder
fluent builder API by template with unique string code.- Specified by:
buildFromTemplate
in interfaceEmailTemplates
- Parameters:
code
- unique string code of email template*- Returns:
EmailTemplateBuilder
fluent template builder API- Throws:
TemplateNotFoundException
- If emailTemplate does not contain reports or null
-
getEmailTemplateBuilder
-
generateEmailInfoWithoutAttachments
-
createReportAttachments
protected List<EmailAttachment> createReportAttachments(Map<TemplateReport, ReportWithParams> reportsWithParams) -
createEmailAttachment
protected EmailAttachment createEmailAttachment(String templateName, ReportWithParams reportWithParams) -
createParamsMapForReport
-