Class FluentUiReportRunner

java.lang.Object
io.jmix.reportsui.runner.FluentUiReportRunner

@Component("report_FluentUiReportRunner") @Scope("prototype") public class FluentUiReportRunner extends Object
Class is used to run a report using various additional criteria:
  • Report entity or report code
  • ReportTemplate entity or template code: if none of these fields is set, the default template is used.
  • Output type
  • Output name pattern
  • Input parameters
  • Screen: screen or screen fragment from which the report runs
  • Show a dialog to input the report parameters (defined by ParametersDialogShowMode)
  • Run a report synchronously or in the background (by default, a report runs synchronously)

Use the UiReportRunner bean to obtain an instance of the FluentUiReportRunner.
  • Field Details

    • fluentReportRunners

      @Autowired protected org.springframework.beans.factory.ObjectProvider<FluentReportRunner> fluentReportRunners
  • Constructor Details

    • FluentUiReportRunner

      public FluentUiReportRunner()
  • Method Details

    • setUiReportRunner

      @Autowired public void setUiReportRunner(UiReportRunner uiReportRunner)
    • init

      public FluentUiReportRunner init(Report report)
    • init

      public FluentUiReportRunner init(String reportCode)
    • withParams

      public FluentUiReportRunner withParams(Map<String,Object> params)
      Sets a map with input parameters.
      Parameters:
      params - input parameters
      Returns:
      current instance of fluent runner
    • addParam

      public FluentUiReportRunner addParam(String alias, Object value)
      Adds an input parameter to the parameter map.
      Parameters:
      alias - parameter alias
      value - parameter value
      Returns:
      current instance of fluent runner
    • withTemplateCode

      public FluentUiReportRunner withTemplateCode(String templateCode)
      Sets a code of template that will be used to run a report.
      Parameters:
      templateCode - template code
      Returns:
      current instance of fluent runner
    • withTemplate

      public FluentUiReportRunner withTemplate(ReportTemplate template)
      Sets a template that will be used to run a report.
      Parameters:
      template - report template
      Returns:
      current instance of fluent runner
    • withOutputType

      public FluentUiReportRunner withOutputType(ReportOutputType outputType)
      Sets a type of output document.
      Parameters:
      outputType - type of output document.
      Returns:
      current instance of fluent runner
    • withOutputNamePattern

      public FluentUiReportRunner withOutputNamePattern(@Nullable String outputNamePattern)
      Sets a name pattern of an output document.
      Parameters:
      outputNamePattern - name pattern of an output document
      Returns:
      current instance of fluent runner
    • inBackground

      public FluentUiReportRunner inBackground(FrameOwner originFrameOwner)
      Sets a property to run a report in the background.
      Parameters:
      originFrameOwner - screen or screen fragment from which the report runs
      Returns:
      current instance of fluent runner
    • withParametersDialogShowMode

      public FluentUiReportRunner withParametersDialogShowMode(ParametersDialogShowMode mode)
      Sets a mode to show a dialog to input the report parameter before report run. If a mode is not specified, the ParametersDialogShowMode.IF_REQUIRED is used by default.
      Parameters:
      mode - mode to show a dialog to input the report parameter before report run
      Returns:
      current instance of fluent runner
    • buildContext

      public UiReportRunContext buildContext()
      Creates an instance of UiReportRunContext based on the parameters specified for the fluent runner.
      Returns:
      run context
    • runAndShow

      public void runAndShow()
      Builds a UiReportRunContext instance, runs a report using this run context and shows the result.
    • runMultipleReports

      public void runMultipleReports(String multiParamAlias, Collection multiParamValues)
      Builds a UiReportRunContext instance, 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.
      Parameters:
      multiParamAlias - alias of the parameter for which a value from the collection is used for report execution
      multiParamValues - collection of values