Tolven Reports
From DOC
Contents |
Overview
Tolven currently supports Jasper reports (jrmxl files), which output to the PDF format. To develop reports, you need to create a custom plugin to contain all of your components, best achieved by setting up a development environment as described in the Developer's Guide. With minimal customization, only the jrxml reports are required.
Example Reports
An example of a plugin which uses Jasper reports is: org.tolven.config.pathology. To obtain this plugin add the following entry to your tolven-config/plugins.xml
<plugin id="org.tolven.config.pathology"> <root /> </plugin>
In the <install-dir>/bin directory execute the following commands:
repositoryInit Stop JBoss configPhase1 Start JBoss configPhase3
During configPhase3, you will see reports (jrxml files) being loaded. Now log into Tolven:
Login into a Tolven Account which has Patients Select a Patient Select the Reports tab (which may be under the More tab) Click the link: "Patient Pathology Summary"
Report Servlet
The "Patient Pathology Summary" link in the example above, is structured as follows:
https://localhost/Tolven/report/?reportName=path1&reportType=jrxml&tolvenQuery=echr:patient&tolvenQueryParameter=echr:patient-53250911
This GUI page with this example URL is located in patientReports.xhtml in the org.tolven.component.tolvenweb plugin. This URL is intercepted by the org.tolven.web.servlet.ReportServlet, which is an example of a servlet which processes reports identified by URL pattern: /report/*. The query string carries information about the particular report and context e.g.:
reportName=path1 reportType=jrxml (options: [jrxml] default jrxml) reportFormat= (options: [pdf] default pdf) tolvenQuery=echr:patient tolvenQueryParameter=echr:patient-53250911
This generic report servlet can be used or a custom one created if need be. Creating custom servlets is described here: Customize tolvenWEB Plugin. The custom servlet should be placed in your custom plugin, and will be assembled into org.tolven.component.tolvenweb during configPhase1.
Report Bean
The Report Servlet passes the query information to org.tolven.report.bean.ReportBean, which processes this report request and returns a PDF. This is done by creating a TolvenReportDataSource which is the subclass of a Jasper report class JRDataSource (see Jasper Report's API and documentation). TolvenReportDataSource is added as a datasource for a jasper report and works with the report query information and in the context of the AccountUser entity selected when the user logged into Tolven.
To obtain the example source code, you can download the following plugins from http://tolven.org/download OR unzip the versions directly
from your tolven-config/repositoryRuntime/plugins directory:
The devLib.jar in org.tolven.component.tolvenweb contains: ReportServlet.java, ReportBean.java and patientReports.xhtml The devLib.jar in org.tolven.component.tolvenejb contains: TolvenReportDataSource org.tolven.config.pathology contains a number of example report *.jrxml files
This generic report bean can be used or a custom one created if need be. Creating custom beans is described here: Customize_tolvenEJB_Plugin. The custom bean should be placed in your custom plugin, and will be assembled into org.tolven.component.tolvenejb during configPhase1.
Report Tools
Reports can be created using a number of opensource tools (iReport, JasperAssistant etc). You can use those tools to study the example reports. In order to incorporate TolvenReportDataSource into your jasper reports, you will need to add Tolven devLib.jar files to the classpath of the report tool, as well as import those classes into your jasper jrxml file e.g:
<import value="org.tolven.core.entity.AccountUser"/> <import value="org.tolven.report.TolvenReportDataSource"/>
See the example reports for further examples and the documentation for the report tool of your choice.
Identifying Reports For Assembly
In the org.tolven.config.pathology, the following entry is placed in the manifest showing that the reports are zipped under the directory app/report, as shown below:
<extension id="reports" plugin-id="org.tolven.component.application" point-id="reports"> <parameter id="dir" value="app/report" /> </extension>
You need to add a similar entry to the manifest of your custom plugin to ensure that these reports are available for upload during configPhase3.
Tolven GUI
You may also need GUI interfaces (xhtml files) to allow the reports to be selected in Tolven, e.g. patientReports.xhtml in the org.tolven.component.tolvenweb. Adding custom xhtml files is described here: Customize tolvenWEB Plugin. The xhtml files should be placed in your custom plugin, and will be assembled into org.tolven.component.tolvenweb during configPhase1.

