Search in sources :

Example 1 with JsonEmailTemplate

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;
}
Also used : JsonEmailTemplate(io.jmix.emailtemplates.entity.JsonEmailTemplate) ArrayList(java.util.ArrayList) JsonEmailTemplate(io.jmix.emailtemplates.entity.JsonEmailTemplate) EmailTemplate(io.jmix.emailtemplates.entity.EmailTemplate) TemplateReport(io.jmix.emailtemplates.entity.TemplateReport)

Aggregations

EmailTemplate (io.jmix.emailtemplates.entity.EmailTemplate)1 JsonEmailTemplate (io.jmix.emailtemplates.entity.JsonEmailTemplate)1 TemplateReport (io.jmix.emailtemplates.entity.TemplateReport)1 ArrayList (java.util.ArrayList)1