Extending Reports
The report builder can be customized to provide new report executors, column types and parameter types.
Creating a Report Executor
Report Executors are used to execute the report based on the parameters and return the results. Report Executors do not need to return Resources, but all exisiting columns do expect Resource-based results.
To create a custom Report Executor:
- Register a component with the
componentGroup
“ACS Commons - Report Builder Config” - Updated the component dialog to write the property
reportExecutor
upon saving the configuration. The value should be the fully qualified name of the Report Executor Java class. See the query-config component for an example of this. - Add a default script (e.g. {component-name}.jsp), this will be called when editing the report to render the column configuration. See queryconfig/queryconfig.jsp as an example.
- Register a Sling Model implementing the ReportExecutor interface. See the QueryReportExecutor as an example.
Once you have this model successfully registered, you should be able to configure your report to use your new Report Executor.
Creating a Report Column
Report columns are used to render a particular cell of a report result. All of the provided Report Columns use Sling Resources, but this is not a hard requirement. To create a custom Report Column:
- Register a component with the
componentGroup
“ACS Commons - Report Builder Column” - If this column should be added to the CSV export, the component can write the property
exporter
upon saving the configuration. The value should be the fully qualified name of the Java used to export the result to CSV for this column. See the containing-page component for an example of this. - Add a default script (e.g. {component-name}.jsp), this will be called when editing the report to render the column configuration. See containing-page/containing-page.jsp as an example.
- Add a results.jsp script, this will be called when the column is rendered for a result. This should render a Coral Table Cell with the results. See containing-page/results.jsp as an example.
- Register a Sling Model implementing the ReportCellCSVExporter interface. See the PathReportCellCSVExporter as an example.
Creating a Report Parameter
Report Parameters are used to allow users to pass variables to the Report Executor.
To create a custom Report Parameter:
- Create a component with the
componentGroup
“ACS Commons - Report Builder Parameter” - Have this component set the property
resourceType
upon save. This should be the Sling Resource Type of the component to render this Parameter field. The existing components leverage existing Granite UI components including:granite/ui/components/coral/foundation/form/textfield
andgranite/ui/components/coral/foundation/form/datepicker
- Add a default script (e.g. {component-name}.jsp), this will be called when editing the report to render the column configuration. See basic/basic.jsp as an example.
Note - if you want to make an additional existing Granite component available in the Basic Parameter options, add an entry in the Report Parameter Components ACS Commons List