use of io.jmix.emailtemplates.entity.JsonEmailTemplate in project jmix by jmix-framework.
the class EmailTemplateBuilderImpl method cloneTemplate.
protected EmailTemplate cloneTemplate(EmailTemplate emailTemplate) {
EmailTemplate clonedTemplate = metadataTools.deepCopy(emailTemplate);
if (clonedTemplate instanceof JsonEmailTemplate) {
clonedTemplate.setEmailBodyReport(emailTemplate.getEmailBodyReport());
((JsonEmailTemplate) clonedTemplate).setReport(emailTemplate.getReport());
}
List<TemplateReport> attachedTemplateReports = new ArrayList<>();
List<TemplateReport> templateAttachedTemplateReports = emailTemplate.getAttachedTemplateReports();
if (templateAttachedTemplateReports != null) {
for (TemplateReport templateReport : templateAttachedTemplateReports) {
TemplateReport newTemplateReport = metadataTools.deepCopy(templateReport);
attachedTemplateReports.add(newTemplateReport);
}
}
clonedTemplate.setAttachedTemplateReports(attachedTemplateReports);
return clonedTemplate;
}
Aggregations