Interface ReportExecutionPresentation

All Known Implementing Classes:
DefaultReportExecutionPresentation, SpreadsheetReportExecutionPresentation, TableReportExecutionPresentation

@NullMarked public interface ReportExecutionPresentation
Strategy interface that encapsulates how a particular output channel (download, spreadsheet viewer, table viewer, …) selects templates, output types, and decides whether user input is required before a report can be run.

Implementations are registered as Spring beans and collected by ReportPresentationRegistry. Use ReportExecutionPresentationIds for the well-known built-in identifiers.

  • Method Details

    • getId

      String getId()
      Returns:
      unique identifier of this presentation (see ReportExecutionPresentationIds)
    • supportsReport

      boolean supportsReport(@Nullable Report report)
      Returns:
      true if the report has at least one template and output type compatible with this presentation
    • getAvailableTemplates

      List<ReportTemplate> getAvailableTemplates(@Nullable Report report)
      Returns:
      templates of the report that are compatible with this presentation
    • resolveDefaultTemplate

      @Nullable ReportTemplate resolveDefaultTemplate(@Nullable Report report, @Nullable ReportTemplate selectedTemplate)
      Returns:
      the template that should be used by default for this presentation, preferring selectedTemplate if it is compatible
    • getAvailableOutputTypes

      List<ReportOutputType> getAvailableOutputTypes(@Nullable Report report, @Nullable ReportTemplate template)
      Returns:
      output types for the template that are compatible with this presentation
    • resolveDefaultOutputType

      @Nullable ReportOutputType resolveDefaultOutputType(@Nullable Report report, @Nullable ReportTemplate template, @Nullable ReportOutputType selectedOutputType)
      Resolves the output type to run the report with.

      An explicitly requested selectedOutputType, e.g. the one set through the report runner API, must not be silently replaced: an implementation may return another type only if the requested one cannot be produced, either because this presentation is unable to render it or because the template cannot be converted to it. Restrictions on what the user is allowed to choose belong to getAvailableOutputTypes(Report, ReportTemplate) instead.

      Returns:
      the output type to run the report with, or null if this presentation cannot handle the template
    • requiresUserChoice

      boolean requiresUserChoice(@Nullable Report report, @Nullable ReportTemplate selectedTemplate, @Nullable ReportOutputType selectedOutputType)
      A selection passed in the arguments does not automatically remove the need to ask: the built-in presentations still let the user choose between several compatible templates, but do not ask for an output type that has already been chosen.
      Returns:
      true if the user must choose a template or an output type before the report can be run with this presentation