use of reports.ex2.entity.LiteratureType in project jmix-docs by Haulmont.
the class RunReportScreen method onRrcBtn1Click.
@Subscribe("rrcBtn1")
protected void onRrcBtn1Click(Button.ClickEvent event) {
Report report = getReportByCode("BOOKS");
LiteratureType type = dataManager.load(LiteratureType.class).query("select c from jmxrpr_LiteratureType c where c.name = :name").parameter("name", "Art").one();
// tag::report-run-context-v1[]
ReportRunContext context = new ReportRunContext(report).addParam("type", type).setOutputNamePattern("Books");
// end::report-run-context-v1[]
ReportOutputDocument document = reportRunner.run(context);
List<ReportOutputDocument> documents = new ArrayList<>();
documents.add(document);
// tag::report-zip-utils[]
byte[] zipArchiveContent = reportZipUtils.createZipArchive(documents);
downloader.download(zipArchiveContent, "Reports.zip", DownloadFormat.ZIP);
// end::report-zip-utils[]
}
use of reports.ex2.entity.LiteratureType in project jmix-docs by Haulmont.
the class RunReportScreen method onRrBtn2Click.
// end::rr-btn1-end[]
// tag::rr-btn2-start[]
@Subscribe("rrBtn2")
protected void onRrBtn2Click(Button.ClickEvent event) {
// end::rr-btn2-start[]
Report report = getReportByCode("BOOKS");
LiteratureType type = dataManager.load(LiteratureType.class).query("select c from jmxrpr_LiteratureType c where c.name = :name").parameter("name", "Art").one();
// tag::report-runner-v3[]
ReportOutputDocument document = reportRunner.byReportEntity(report).addParam("type", type).withOutputType(// <1>
ReportOutputType.PDF).withOutputNamePattern(// <2>
"Books").run();
// end::report-runner-v3[]
// tag::get-content[]
String documentName = document.getDocumentName();
byte[] content = document.getContent();
// end::get-content[]
// tag::rr-btn2-end[]
}
use of reports.ex2.entity.LiteratureType in project jmix-docs by Haulmont.
the class RunReportScreen method onRrcBtn2Click.
// tag::rrc-btn2-start[]
@Subscribe("rrcBtn2")
protected void onRrcBtn2Click(Button.ClickEvent event) {
// end::rrc-btn2-start[]
Report report = getReportByCode("BOOKS");
LiteratureType type = dataManager.load(LiteratureType.class).query("select c from jmxrpr_LiteratureType c where c.name = :name").parameter("name", "Art").one();
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("type", type);
ReportTemplate template = dataManager.load(ReportTemplate.class).query("select c from report_ReportTemplate c where c.code = :code and c.report = :report").parameter("code", "DEFAULT").parameter("report", report).one();
// tag::report-run-context-v2[]
ReportRunContext context = new ReportRunContext(report).setReportTemplate(template).setOutputType(ReportOutputType.PDF).setParams(paramsMap);
// end::report-run-context-v2[]
// tag::report-runner-v1[]
ReportOutputDocument document = reportRunner.run(// <1>
new ReportRunContext(report).setParams(paramsMap));
// end::report-runner-v1[]
// ReportOutputDocument document = reportRunner.run(context);
// tag::rrc-btn2-end[]
}
use of reports.ex2.entity.LiteratureType in project jmix-docs by Haulmont.
the class RunReportScreen method onRrBtn1Click.
// end::rrc-btn2-end[]
// tag::rr-btn1-start[]
@Subscribe("rrBtn1")
protected void onRrBtn1Click(Button.ClickEvent event) {
// end::rr-btn1-start[]
LiteratureType type = dataManager.load(LiteratureType.class).query("select c from jmxrpr_LiteratureType c where c.name = :name").parameter("name", "Art").one();
// tag::report-runner-v2[]
ReportOutputDocument document = // <1>
reportRunner.byReportCode("BOOKS").addParam("type", // <2>
type).withTemplateCode(// <3>
"books-template").run();
// end::report-runner-v2[]
// tag::rr-btn1-end[]
}
Aggregations