Search in sources :

Example 1 with ReportWithParams

use of io.jmix.emailtemplates.dto.ReportWithParams in project jmix by jmix-framework.

the class EmailTemplateParametersFragment method collectParameters.

public List<ReportWithParams> collectParameters() {
    List<ReportWithParams> reportDataList = new ArrayList<>();
    for (ReportWithParamField fieldValue : parameterComponents) {
        ReportWithParams reportData = new ReportWithParams(fieldValue.getReport());
        for (String paramName : fieldValue.getFields().keySet()) {
            Field parameterField = fieldValue.getFields().get(paramName);
            Object value = parameterField.getValue();
            reportData.put(paramName, value);
        }
        reportDataList.add(reportData);
    }
    return reportDataList;
}
Also used : ReportWithParamField(io.jmix.emailtemplatesui.dto.ReportWithParamField) ReportWithParams(io.jmix.emailtemplates.dto.ReportWithParams) ReportWithParamField(io.jmix.emailtemplatesui.dto.ReportWithParamField)

Example 2 with ReportWithParams

use of io.jmix.emailtemplates.dto.ReportWithParams in project jmix by jmix-framework.

the class EmailTemplateBuilderImpl method setAttachmentParameters.

@Override
public EmailTemplateBuilder setAttachmentParameters(Collection<ReportWithParams> reportsWithParams) {
    TemplateReport emailBodyReport = emailTemplate.getEmailBodyReport();
    ReportWithParams reportWithParams = reportParams.stream().filter(e -> e.getReport().equals(emailBodyReport.getReport())).findFirst().orElse(null);
    reportParams.clear();
    if (reportWithParams != null) {
        reportParams.add(reportWithParams);
    }
    reportParams.addAll(reportsWithParams);
    return this;
}
Also used : ReportWithParams(io.jmix.emailtemplates.dto.ReportWithParams) TemplateReport(io.jmix.emailtemplates.entity.TemplateReport)

Example 3 with ReportWithParams

use of io.jmix.emailtemplates.dto.ReportWithParams in project jmix by jmix-framework.

the class EmailTemplateBuilderImpl method setAttachmentParameters.

@Override
public EmailTemplateBuilder setAttachmentParameters(Report report, Map<String, Object> params) {
    ReportWithParams reportWithParams = new ReportWithParams(report);
    reportWithParams.setParams(params);
    setAttachmentParameters(reportWithParams);
    return this;
}
Also used : ReportWithParams(io.jmix.emailtemplates.dto.ReportWithParams)

Example 4 with ReportWithParams

use of io.jmix.emailtemplates.dto.ReportWithParams in project jmix by jmix-framework.

the class EmailTemplateBuilderImpl method setAttachmentParameter.

@Override
public EmailTemplateBuilder setAttachmentParameter(Report report, String key, Object value) {
    ReportWithParams reportWithParams = reportParams.stream().filter(e -> e.getReport().equals(report)).findFirst().orElse(null);
    if (reportWithParams == null) {
        reportWithParams = new ReportWithParams(report);
        reportParams.add(reportWithParams);
    }
    reportWithParams.put(key, value);
    return this;
}
Also used : ReportWithParams(io.jmix.emailtemplates.dto.ReportWithParams)

Example 5 with ReportWithParams

use of io.jmix.emailtemplates.dto.ReportWithParams in project jmix by jmix-framework.

the class EmailTemplateBuilderImpl method setBodyParameter.

@Override
public EmailTemplateBuilder setBodyParameter(String key, Object value) {
    TemplateReport emailBodyReport = emailTemplate.getEmailBodyReport();
    ReportWithParams reportWithParams = reportParams.stream().filter(e -> e.getReport().equals(emailBodyReport.getReport())).findFirst().orElse(null);
    if (reportWithParams == null) {
        reportWithParams = new ReportWithParams(emailBodyReport.getReport());
        reportParams.add(reportWithParams);
    }
    reportWithParams.put(key, value);
    return this;
}
Also used : ReportWithParams(io.jmix.emailtemplates.dto.ReportWithParams) TemplateReport(io.jmix.emailtemplates.entity.TemplateReport)

Aggregations

ReportWithParams (io.jmix.emailtemplates.dto.ReportWithParams)14 TemplateReport (io.jmix.emailtemplates.entity.TemplateReport)6 Report (io.jmix.reports.entity.Report)4 ReportParameterTypeChangedException (io.jmix.emailtemplates.exception.ReportParameterTypeChangedException)3 ReportInputParameter (io.jmix.reports.entity.ReportInputParameter)3 EmailAttachment (io.jmix.email.EmailAttachment)2 EmailTemplates (io.jmix.emailtemplates.EmailTemplates)2 ParameterValue (io.jmix.emailtemplates.entity.ParameterValue)2 TemplateNotFoundException (io.jmix.emailtemplates.exception.TemplateNotFoundException)2 ReportWithParamField (io.jmix.emailtemplatesui.dto.ReportWithParamField)2 MetaClass (io.jmix.core.metamodel.model.MetaClass)1 EmailInfo (io.jmix.email.EmailInfo)1