Interface Reporter

All Known Implementing Classes:
AbstractReporter, Reporter.NoOpImpl, ReporterModel

public interface Reporter
A Reporter allows building up functional reports with a hierarchy reflecting task/subtasks of processes. The enclosed reports are based on Report class.

A Reporter can create sub-reporters to separate from current reports the reports from that task. Each sub-reporter is defined by a key identifying the corresponding task, a default String describing the corresponding task, and TypedValue values indexed by their keys. These values may be referred to by their key in the description of the sub-reporter, or in its reports, using the ${key} syntax, in order to be later replaced by StringSubstitutor for instance when formatting the string for the end user.

Instances of Reporter are not thread-safe. When a new thread is created, a new Reporter should be provided to the process in that thread. A reporter is not meant to be shared with other threads nor to be saved as a class parameter, but should instead be passed on in methods through their arguments.

The Reporter can be used for multilingual support. Indeed, each Reporter name and Report message can be translated based on their key and using the value keys in the desired order.

Author:
Florian Dupuy <florian.dupuy at rte-france.com>
  • Field Details

    • NO_OP

      static final Reporter NO_OP
      A No-op implementation of Reporter
  • Method Details

    • createSubReporter

      Reporter createSubReporter(String taskKey, String defaultName, Map<String,TypedValue> values)
      Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with some associated values.
      Parameters:
      taskKey - the key identifying that task
      defaultName - a name or message describing the corresponding task, which may contain references to the provided values
      values - a map of TypedValue indexed by their key, which may be referred to within the defaultName or within the reports message of the created sub-reporter
      Returns:
      the new sub-reporter
    • createSubReporter

      Reporter createSubReporter(String taskKey, String defaultName)
      Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with no associated value.
      Parameters:
      taskKey - the key identifying that task
      defaultName - a name or message describing the corresponding task
      Returns:
      the new sub-reporter
    • createSubReporter

      Reporter createSubReporter(String taskKey, String defaultName, String key, Object value)
      Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with one associated value.
      Parameters:
      taskKey - the key identifying that task
      defaultName - a name or message describing the corresponding task, which may contain references to the provided value
      key - the key for the value which follows
      value - the value which may be referred to within the defaultName or within the reports message of the created sub-reporter
      Returns:
      the new sub-reporter
    • createSubReporter

      Reporter createSubReporter(String taskKey, String defaultName, String key, Object value, String type)
      Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with one associated typed value.
      Parameters:
      taskKey - the key identifying that task
      defaultName - a name or message describing the corresponding task, which may contain references to the provided typed value
      key - the key for the typed value which follows
      value - the value which may be referred to within the defaultName or within the reports message of the created sub-reporter
      type - the string representing the type of the value provided
      Returns:
      the new sub-reporter
    • report

      void report(String reportKey, String defaultMessage, Map<String,TypedValue> values)
      Add a new report with its associated values.
      Parameters:
      reportKey - a key identifying the current report
      defaultMessage - the default report message, which may contain references to the provided values or to the values of current reporter
      values - a map of TypedValue indexed by their key, which may be referred to within the defaultMessage provided
    • report

      void report(String reportKey, String defaultMessage)
      Add a new report with no associated value.
      Parameters:
      reportKey - a key identifying the current report
      defaultMessage - the default report message, which may contain references to the values of current reporter
    • report

      void report(String reportKey, String defaultMessage, String valueKey, Object value)
      Add a new report with one associated value.
      Parameters:
      reportKey - a key identifying the current report
      defaultMessage - the default report message, which may contain references to the provided value or to the values of current reporter
      valueKey - the key for the value which follows
      value - the int, long, float, double, boolean or String value which may be referred to within the defaultMessage provided
    • report

      void report(String reportKey, String defaultMessage, String valueKey, Object value, String type)
      Add a new report with one associated typed value.
      Parameters:
      reportKey - a key identifying the current report
      defaultMessage - the default report message, which may contain references to the provided typed value or to the values of current reporter
      valueKey - the key for the typed value which follows
      value - the int, long, float, double, boolean or String value which may be referred to within the defaultMessage provided
      type - the string representing the type of the value provided
    • report

      void report(Report report)
      Add a new report
      Parameters:
      report - the report to add