Interface ReportProvider

All Superinterfaces:
PluginProvider, ReportProvider, UIExtensionProvider

@Deprecated public interface ReportProvider extends ReportProvider
Provides an interface and standard set of methods for creating custom report types within Morpheus. The report engine typically leverages a concept of a defined ReportType and its associated OptionType filters as well as a means to process a report and subsequently render the results in a nice view format. NOTE: This Provider has moved to the providers sub package.

A custom report has 2 parts. One is the method for processing/generating the report. This takes an input of a ReportResult for details as to the users configured filters as well as where the result rows should be stored. The process method should send data back as result rows grouped by section. These sections can be header,footer,main or custom. But be aware, only the main section is used when automatically providing csv export functionality.

Example Process (Groovy Code):

 void process(ReportResult reportResult) {,ReportResult.Status.generating).blockingGet();
      Long displayOrder = 0
      List<GroovyRowResult> results = []
      Connection dbConnection

      try {
          dbConnection =
          if(reportResult.configMap?.phrase) {
              String phraseMatch = "${reportResult.configMap?.phrase}%"
              results = new Sql(dbConnection).rows("SELECT id,name,status from instance WHERE name LIKE ${phraseMatch} order by name asc;")
          } else {
              results = new Sql(dbConnection).rows("SELECT id,name,status from instance order by name asc;")
      } finally {

      }"Results: ${results}")
      Observable<GroovyRowResult> observable = Observable.fromIterable(results) as Observable<GroovyRowResult>{ resultRow ->
"Mapping resultRow ${resultRow}")
          Map<String,Object> data = [name:, id:, status: resultRow.status]
          ReportResultRow resultRowRecord = new ReportResultRow(section: ReportResultRow.SECTION_MAIN, displayOrder: displayOrder++, dataMap: data)
"resultRowRecord: ${resultRowRecord.dump()}")
          return resultRowRecord
      }.buffer(50).doOnComplete {
      }.doOnError { Throwable t ->
      }.subscribe {resultRows ->

The second part of the report is the rendering/visual aspect. This is done via the ReportProvider.renderTemplate(ReportResult, Map) method. This contains a reference to the originating report result as well as the rows grouped by section.

See Also: