Class ReportUtil
java.lang.Object
com.ssgllc.fish.service.util.published.ReportUtil
Reports for scripts. Called as the
reportUtil bean.-
Constructor Summary
ConstructorsConstructorDescriptionReportUtil(com.ssgllc.fish.service.ReportService reportService, com.ssgllc.fish.service.ReportAsyncService reportAsyncService) -
Method Summary
Modifier and TypeMethodDescriptionRuns a report as the current user and gives its rows, as a dashboard widget gets them: the same access rule and parameter handling as the report endpoint, the post-process script of the report applied, and no report log entry.
-
Constructor Details
-
ReportUtil
public ReportUtil(com.ssgllc.fish.service.ReportService reportService, com.ssgllc.fish.service.ReportAsyncService reportAsyncService)
-
-
Method Details
-
runReport
Runs a report as the current user and gives its rows, as a dashboard widget gets them: the same access rule and parameter handling as the report endpoint, the post-process script of the report applied, and no report log entry. A report that the user cannot run gives an error, not an empty result. Do not call it for a report from the post-process script of that same report: the script would run again each time. A report that runs a report in its script, and so on, stops with an error at 5 levels.
Groovy example:
def rows = reportUtil.runReport("DailyCaseCounts", [DISEASE: diseaseId])
rows.each { log.info("${it.date}: ${it.count}") }
- Parameters:
reportName- name of the report definition. The report must not be long-running.parameters- report parameters by name, as the report endpoint takes them; may be null. A value of another type than the endpoint takes (an id, a date) goes to the report as text.- Returns:
- one map for each row, with the column labels as keys
- Throws:
org.springframework.web.server.ResponseStatusException- 404 when no report has the name, or the current user cannot read itcom.ssgllc.fish.exception.CasetivityIllegalArgumentException- when the report is long-running, or rejects its parameters
-