use of io.jmix.emailtemplates.entity.EmailTemplate 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;
}
use of io.jmix.emailtemplates.entity.EmailTemplate in project jmix by jmix-framework.
the class EmailTemplateBrowse method onSendEmailClick.
protected void onSendEmailClick() {
EmailTemplate template = emailTemplatesTable.getSingleSelected();
if (template != null) {
template = dataManager.load(EmailTemplate.class).id(template.getId()).fetchPlan("emailTemplate-fetchPlan").optional().orElse(null);
screens.create(EmailTemplateSendScreen.class, OpenMode.DIALOG, new MapScreenOptions(ParamsMap.of("emailTemplate", template))).show();
}
}
Aggregations