Package io.jmix.reportsui.runner
Interface UiReportRunner
- All Known Implementing Classes:
UiReportRunnerImpl
public interface UiReportRunner
Interface is used for running reports from UI
-
Method Summary
Modifier and TypeMethodDescriptionbyReportCode
(String reportCode) Creates an instance ofFluentUiReportRunner
for a report with specified code.byReportEntity
(Report report) Creates an instance ofFluentUiReportRunner
for specified report.void
runAndShow
(UiReportRunContext context) Runs the report based on the information from theUiReportRunContext
and shows the result.void
runMultipleReports
(UiReportRunContext context, String multiParamAlias, Collection multiParamValue) Runs a report for each object from the specified collection.
-
Method Details
-
runAndShow
Runs the report based on the information from theUiReportRunContext
and shows the result. The run context may be created manually using the constructor or using theFluentUiReportRunner
.- Parameters:
context
- the object that contains all information required to run the report from UI
-
runMultipleReports
void runMultipleReports(UiReportRunContext context, String multiParamAlias, Collection multiParamValue) Runs a report for each object from the specified collection. Objects in the collection should have the same type as an input parameter with specified alias. If the report has other parameters besides the specified one, values for these parameters are copied for each report run. As result, the ZIP archive with executed reports is downloaded.
For example, a report has an input parameter with alias "name" and the String type:UiReportRunContext context = new UiReportRunContext(report) .setOutputType(ReportOutputType.PDF); uiReportRunner.runMultipleReports(context, "name", namesList);
The report will be executed for each string from the "namesList" collection.- Parameters:
context
- the object that contains all information required to run the report from UImultiParamAlias
- alias of the parameter for which a value from the collection is used for report executionmultiParamValue
- collection of values
-
byReportCode
Creates an instance ofFluentUiReportRunner
for a report with specified code.
Usage examples:UiReportRunContext context = uiReportRunner.byReportCode("orders-report") .withTemplateCode("order-template") .withOutputNamePattern("Orders") .withParametersDialogShowMode(ParametersDialogShowMode.IF_REQUIRED) .inBackground(screen) .buildContext(); uiReportRunner.byReportCode("orders-report") .addParam("orders", ordersList) .withParametersDialogShowMode(ParametersDialogShowMode.NO) .runAndShow(); uiReportRunner.byReportCode("orders-report") .addParam("orders", ordersList) .withParametersDialogShowMode(ParametersDialogShowMode.YES) .runAndShow(); uiReportRunner.byReportCode("customer-orders-report") .addParam("minOrdersDate", date) .withOutputType(ReportOutputType.PDF) .withTemplateCode(""orders-template"") .runMultipleReports("customer", customersList);
- Parameters:
reportCode
- report code- Returns:
- instance of
FluentUiReportRunner
-
byReportEntity
Creates an instance ofFluentUiReportRunner
for specified report.
Usage examples:UiReportRunContext context = uiReportRunner.byReportEntity(report) .withTemplateCode("order-template") .withOutputNamePattern("Orders") .withParametersDialogShowMode(ParametersDialogShowMode.IF_REQUIRED) .inBackground(screen) .buildContext(); uiReportRunner.byReportEntity(report) .addParam("orders", ordersList) .withParametersDialogShowMode(ParametersDialogShowMode.NO) .runAndShow(); uiReportRunner.byReportEntity(report) .withTemplate(template) .addParam("orders", ordersList) .withParametersDialogShowMode(ParametersDialogShowMode.YES) .runAndShow(); uiReportRunner.byReportEntity(report) .addParam("minOrdersDate", date) .withOutputType(ReportOutputType.PDF) .withTemplateCode(""orders-template"") .runMultipleReports("customer", customersList);
- Parameters:
report
- report entity- Returns:
- instance of
FluentUiReportRunner
-