Class ReportRecommendationUtil
Called as the reportRecommendationUtil bean. Every lookup applies the access rules of the
Reports pages, so a script cannot reach a report the user could not open. Criteria maps take the same
keys as bpmUtil.searchEntity; they narrow a result and never widen access.
Groovy example:
def me = com.ssgllc.fish.service.util.registered.ExpressionUtil.getCurrentUserUuidStr()
def custom = reportRecommendationUtil.getCustomReports([:])
def shared = custom.findAll { it.userId != me }
def standard = reportRecommendationUtil.getStandardReports(["name.contains": "case"])
standard.each { report ->
def description = reportRecommendationUtil.describeReport(report)
if (description == null) { return } // unreadable or unparseable: leave it out
context.append(reportRecommendationUtil.runReportUrl(report.name)).append("\n")
description.params.each { context.append(it.describe()).append("\n") }
}
-
Constructor Summary
ConstructorsConstructorDescriptionReportRecommendationUtil(com.ssgllc.fish.service.CustomReportPersonalizedService customReportPersonalizedService, com.ssgllc.fish.service.ReportService reportService, com.ssgllc.fish.service.cache.ValueSets valueSets, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptioncom.ssgllc.fish.service.report.vo.ReportDescriptiondescribeReport(com.ssgllc.fish.service.dto.gen.ReportDefinitionDTO report) A report's inputs, with the URL query keys (input names) that prefill them, and its output columns.com.ssgllc.fish.service.report.vo.ReportDescriptiondescribeReport(com.ssgllc.fish.service.dto.gen.ReportDefinitionDTO report, int maxAllowedValues) AsdescribeReport(ReportDefinitionDTO), listing the allowed values of a value set only when it holds at mostmaxAllowedValuesactive concepts.List<com.ssgllc.fish.service.dto.gen.CustomReportDTO> getCustomReports(Map<String, Object> criteria) The custom (personalized) reports the current user owns or that are shared with them, sorted by name, with the parent report expanded and scrubbed.List<com.ssgllc.fish.service.dto.gen.CustomReportDTO> getCustomReports(Map<String, Object> criteria, int limit) AsgetCustomReports(Map), returning at mostlimitreports.getSavedValues(com.ssgllc.fish.service.dto.gen.CustomReportDTO customReport, com.ssgllc.fish.service.report.vo.ReportDescription description) The value-set, date and yes/no values a custom report was saved with, keyed by input name (the SQL param name, or the field id on an input form).List<com.ssgllc.fish.service.dto.gen.ReportDefinitionDTO> getStandardReports(Map<String, Object> criteria) The standard reports the current user can read, sorted by name, with definition internals scrubbed: the Standard tab's listing.List<com.ssgllc.fish.service.dto.gen.ReportDefinitionDTO> getStandardReports(Map<String, Object> criteria, int limit) AsgetStandardReports(Map), returning at mostlimitreports.runPersonalizedReportUrl(String customReportId) An absolute link that runs a custom report with its saved values.runReportUrl(String reportName) An absolute link that opens a standard report.runReportUrl(String reportName, Map<String, ?> params) An absolute link that opens a standard report with inputs prefilled, keyed by input name.
-
Constructor Details
-
ReportRecommendationUtil
public ReportRecommendationUtil(com.ssgllc.fish.service.CustomReportPersonalizedService customReportPersonalizedService, com.ssgllc.fish.service.ReportService reportService, com.ssgllc.fish.service.cache.ValueSets valueSets, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
getStandardReports
public List<com.ssgllc.fish.service.dto.gen.ReportDefinitionDTO> getStandardReports(Map<String, Object> criteria) The standard reports the current user can read, sorted by name, with definition internals scrubbed: the Standard tab's listing. Only published reports unless the criteria name apublishedfilter of their own. Anidfilter is replaced by the reports the user's roles grant, as on that tab.- Parameters:
criteria- ReportDefinition criteria, keyed as forbpmUtil.searchEntity; null for none.- Returns:
- The matching reports.
Groovy example:
return reportRecommendationUtil.getStandardReports(["name.contains": "case"])
-
getStandardReports
public List<com.ssgllc.fish.service.dto.gen.ReportDefinitionDTO> getStandardReports(Map<String, Object> criteria, int limit) AsgetStandardReports(Map), returning at mostlimitreports.
Groovy example:
return reportRecommendationUtil.getStandardReports(["explanation.specified": true], 50)
-
getCustomReports
public List<com.ssgllc.fish.service.dto.gen.CustomReportDTO> getCustomReports(Map<String, Object> criteria) The custom (personalized) reports the current user owns or that are shared with them, sorted by name, with the parent report expanded and scrubbed. A report whoseuserIdis not the current user's reached them through sharing. Split the list by owner rather than filtering onuserIdhere: with sharing disabled the owner filter is forced to the current user, so a "not mine" query returns the caller's own reports.- Parameters:
criteria- CustomReport criteria, keyed as forbpmUtil.searchEntity; null for none.- Returns:
- The matching reports.
Groovy example:
def me = com.ssgllc.fish.service.util.registered.ExpressionUtil.getCurrentUserUuidStr()
def shared = reportRecommendationUtil.getCustomReports([:]).findAll { it.userId != me }
-
getCustomReports
public List<com.ssgllc.fish.service.dto.gen.CustomReportDTO> getCustomReports(Map<String, Object> criteria, int limit) AsgetCustomReports(Map), returning at mostlimitreports. -
describeReport
public com.ssgllc.fish.service.report.vo.ReportDescription describeReport(com.ssgllc.fish.service.dto.gen.ReportDefinitionDTO report) A report's inputs, with the URL query keys (input names) that prefill them, and its output columns. Inputs come from the input form when the report has one, otherwise from the params declared in its SQL. For a custom report, pass its parent report. The report is looked up by id, so inside one transaction this reuses the report the listing loaded.- Parameters:
report- A report fromgetStandardReports(Map), or a custom report's parent report.- Returns:
- The description; null when the current user cannot read the report or its definition
cannot be parsed, so the caller should leave the report out.
Groovy example:
return reportRecommendationUtil.describeReport(customReport.parentReport)?.params*.describe()
-
describeReport
public com.ssgllc.fish.service.report.vo.ReportDescription describeReport(com.ssgllc.fish.service.dto.gen.ReportDefinitionDTO report, int maxAllowedValues) AsdescribeReport(ReportDefinitionDTO), listing the allowed values of a value set only when it holds at mostmaxAllowedValuesactive concepts. -
getSavedValues
public Map<String,Object> getSavedValues(com.ssgllc.fish.service.dto.gen.CustomReportDTO customReport, com.ssgllc.fish.service.report.vo.ReportDescription description) The value-set, date and yes/no values a custom report was saved with, keyed by input name (the SQL param name, or the field id on an input form). A value-set value is written asCODE (Display)instead of the concept id the form saved, so a model can read it; several concepts are joined with", ", and a concept id the value set no longer holds is returned as it was saved. A date or yes/no value is returned as stored, so a relative date keeps its encoding.Text, numbers and entity values are left out: they can hold whatever the report's owner typed, which on a shared report is another user's data and should not reach a model.
- Parameters:
customReport- The custom report.description- Its parent report's description fromdescribeReport(ReportDefinitionDTO), which gives each input's type and value set. Null gives an empty map.
Groovy example:
return reportRecommendationUtil.getSavedValues(customReport, reportRecommendationUtil.describeReport(customReport.parentReport))
-
runReportUrl
An absolute link that opens a standard report.
Groovy example:
return reportRecommendationUtil.runReportUrl(report.name)
-
runReportUrl
An absolute link that opens a standard report with inputs prefilled, keyed by input name. A collection value is joined with commas, which is how a multi-value field takes several concept ids; null values are left out.
Groovy example:
return reportRecommendationUtil.runReportUrl(report.name, ["COUNTY": countyConceptId, "START_DATE": "2026-01-01"])
-
runPersonalizedReportUrl
An absolute link that runs a custom report with its saved values.
Groovy example:
return reportRecommendationUtil.runPersonalizedReportUrl(customReport.id)
-