Class UiReportRunnerImpl

java.lang.Object
io.jmix.reportsui.runner.impl.UiReportRunnerImpl
All Implemented Interfaces:
UiReportRunner

@UIScope @Component("report_UiReportRunner") public class UiReportRunnerImpl extends Object implements UiReportRunner
  • Field Details

    • reportRunner

      @Autowired protected ReportRunner reportRunner
    • screens

      @Autowired protected Screens screens
    • downloader

      @Autowired protected Downloader downloader
    • metadataTools

      @Autowired protected MetadataTools metadataTools
    • messages

      @Autowired protected Messages messages
    • dialogs

      @Autowired protected Dialogs dialogs
    • reportsClientProperties

      @Autowired protected ReportsClientProperties reportsClientProperties
    • reportZipUtils

      @Autowired protected ReportZipUtils reportZipUtils
    • reportsUtils

      @Autowired protected ReportsUtils reportsUtils
    • fluentUiReportRunners

      @Autowired protected org.springframework.beans.factory.ObjectProvider<FluentUiReportRunner> fluentUiReportRunners
  • Constructor Details

    • UiReportRunnerImpl

      public UiReportRunnerImpl()
  • Method Details

    • runAndShow

      public void runAndShow(UiReportRunContext context)
      Description copied from interface: UiReportRunner
      Runs the report based on the information from the UiReportRunContext and shows the result. The run context may be created manually using the constructor or using the FluentUiReportRunner.
      Specified by:
      runAndShow in interface UiReportRunner
      Parameters:
      context - the object that contains all information required to run the report from UI
    • runMultipleReports

      public void runMultipleReports(UiReportRunContext context, String multiParamAlias, Collection multiParamValue)
      Description copied from interface: UiReportRunner
      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.
      Specified by:
      runMultipleReports in interface UiReportRunner
      Parameters:
      context - the object that contains all information required to run the report from UI
      multiParamAlias - alias of the parameter for which a value from the collection is used for report execution
      multiParamValue - collection of values
    • downloadZipArchive

      protected void downloadZipArchive(List<com.haulmont.yarg.reporting.ReportOutputDocument> outputDocuments)
    • multiRunSync

      protected List<com.haulmont.yarg.reporting.ReportOutputDocument> multiRunSync(UiReportRunContext uiReportRunContext, String multiParamName, Collection<Object> multiParamValues)
    • byReportCode

      public FluentUiReportRunner byReportCode(String reportCode)
      Description copied from interface: UiReportRunner
      Creates an instance of FluentUiReportRunner 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);
       
      Specified by:
      byReportCode in interface UiReportRunner
      Parameters:
      reportCode - report code
      Returns:
      instance of FluentUiReportRunner
    • byReportEntity

      public FluentUiReportRunner byReportEntity(Report report)
      Description copied from interface: UiReportRunner
      Creates an instance of FluentUiReportRunner 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);
       
      Specified by:
      byReportEntity in interface UiReportRunner
      Parameters:
      report - report entity
      Returns:
      instance of FluentUiReportRunner
    • runInBackground

      protected void runInBackground(UiReportRunContext context, Screen hostScreen)
    • showDialog

      protected <T> void showDialog(BackgroundTask<Integer,T> task)
    • openReportParamsDialog

      protected void openReportParamsDialog(UiReportRunContext context, @Nullable ReportInputParameter inputParameter, boolean bulkPrint)
    • getReportForPrinting

      protected Report getReportForPrinting(Report report)
    • showResult

      protected void showResult(com.haulmont.yarg.reporting.ReportOutputDocument document, UiReportRunContext context)
    • getTemplateCode

      @Nullable protected String getTemplateCode(UiReportRunContext context)
    • prepareContext

      protected void prepareContext(UiReportRunContext context)
    • getDefaultTemplate

      protected ReportTemplate getDefaultTemplate(Report report)
    • needToShowParamsDialog

      protected boolean needToShowParamsDialog(UiReportRunContext uiReportRunContext)
    • getInputParameter

      protected ReportInputParameter getInputParameter(UiReportRunContext uiReportRunContext, String multiParamAlias)
    • containsVisibleInputParameters

      protected boolean containsVisibleInputParameters(Report report)