use of io.jmix.reports.runner.ReportRunContext in project jmix by jmix-framework.
the class EmailTemplatesImpl method generateEmailInfoWithoutAttachments.
protected EmailInfo generateEmailInfoWithoutAttachments(ReportWithParams reportWithParams) {
String body = "";
String subject = "";
if (reportWithParams != null && reportWithParams.getReport() != null) {
ReportOutputDocument outputDocument = reportRunner.run(new ReportRunContext(reportWithParams.getReport()).setParams(reportWithParams.getParams()));
body = new String(outputDocument.getContent(), UTF_8);
subject = outputDocument.getDocumentName();
}
return EmailInfoBuilder.create().setSubject(subject).setBody(body).setBodyContentType(EmailInfo.HTML_CONTENT_TYPE).build();
}
use of io.jmix.reports.runner.ReportRunContext in project jmix by jmix-framework.
the class UiReportRunnerImpl method multiRunSync.
protected List<ReportOutputDocument> multiRunSync(UiReportRunContext uiReportRunContext, String multiParamName, Collection<Object> multiParamValues) {
List<ReportOutputDocument> outputDocuments = new ArrayList<>();
if (CollectionUtils.isNotEmpty(multiParamValues)) {
multiParamValues.forEach(paramValue -> {
Map<String, Object> map = new HashMap<>();
map.put(multiParamName, paramValue);
if (CollectionUtils.isNotEmpty(multiParamValues)) {
map.putAll(uiReportRunContext.getParams());
}
ReportRunContext reportRunContext = new ReportRunContext(uiReportRunContext.getReport()).setReportTemplate(uiReportRunContext.getReportTemplate()).setParams(map).setOutputType(uiReportRunContext.getOutputType()).setOutputNamePattern(uiReportRunContext.getOutputNamePattern());
ReportOutputDocument reportOutputDocument = reportRunner.run(reportRunContext);
outputDocuments.add(reportOutputDocument);
});
}
return outputDocuments;
}
Aggregations