Feature: Jasper Report Deployment Refactoring and Improvement
Goal: Functional
Feature Ticket: IDEMPIERE-4873
Description: Refactor and improve the deployment of Jasper Report.
Images
- To Load from File:
- add Report Parameter "RESOURCE_DIR" (type String) with Default Value Expression = ""
- Image Expression - $P{RESOURCE_DIR}+"image file name". For e.g $P{RESOURCE_DIR}+"MyCompanyLogo.png".
- To Load from AD_Image:
Sub Report
- add Report Parameter "SUBREPORT_DIR" (type String) with Default Value Expression = ""
- Subreport Expression - $P{SUBREPORT_DIR}+"Subreport file name". For e.g $P{SUBREPORT_DIR}+"OrderLine.jasper".
- You can use any name for Subreport.
Resource Bundle
- Use resource bundle property file - Multi-Lingual_Jasper
- NF9_AD_Resource_Bundle_For_Jasper_Report
Deploy as Attachment
- Upload all report artifacts as your Jasper Report Process's attachment
- Jasper Report field = "attachment:Jasper Report File Name". For e.g, "attachment:Order.jasper".
- All report artifacts will be downloaded from the attachment archive to a temporary local folder.
- The "RESOURCE_DIR" and "SUBREPORT_DIR" will be set to the temporary local folder.
Deploy as File Resources
- Deploy all report artifacts to a folder that's accessible by the iDempiere server.
- This can be convenient for Development use as you can make your changes at Jasper Studio and preview the changes at a running instance of iDempiere immediately.
- Jasper Report field = "full path to the Jasper Report File" (the use of file: prefix is optional). For e.g, "/home/hengsin/myreports/Order.jasper" or "file:///home/hengsin/myreports/Order.jasper".
- The Jasper Report file is download to a local temporary folder for compilation if it is a .jrxml file.
- The "RESOURCE_DIR" and "SUBREPORT_DIR" will be set to the parent folder of the main jasper report file. Using the example above, it will be set to "/home/hengsin/myreports/". If your Subreport expression is $P{SUBREPORT_DIR}+"OrderLine.jasper", it will be resolved to "/home/hengsin/myreports/OrderLine.jasper" (Similar translation happen for Image expression).
- If a folder is not included the file is intended to be in [IDEMPIERE_HOME]/reports - for example if the Jasper Report field is filled with "Order.jrxml" - then the file is searched in [IDEMPIERE_HOME]/reports/Order.jrxml
Deploy as Web Resources
- Deploy all report artifacts as static file of a web server (Can be an OSGi web bundle plugin too)
- Jasper Report field = "full web path to the Jasper Report File", for e.g, "http://127.0.0.1:8080/MyJasperReportFiles/Order.jasper"
- The Jasper Report file is download to a local temporary folder for compilation if it is a .jrxml file.
- The "RESOURCE_DIR" and "SUBREPORT_DIR" will be set to the parent path of the main jasper report file. Using the example above, it will be set to "http://127.0.0.1:8080/MyJasperReportFiles/" (you can use either http or https). If your Subreport expression is $P{SUBREPORT_DIR}+"OrderLine.jasper", it will be resolved to "http://127.0.0.1:8080/MyJasperReportFiles/OrderLine.jasper" (Similar translation happen for Image expression).
Deploy as Class Loader Resources
- Create a fragment plugin with "org.adempiere.report.jasper" as the Host Plug-in.
- Create an unique Java Package (for e.g org.hengsin.jasper.reports) and deploy all your Jasper Report Resources there.
- To deploy, install the fragment plugin using telnet or felix web console. If running from Eclipse, you just have to add your fragment plugin to the selected workspace plugin (for e.g, create a duplicate copy of "server.product" launch configuration and add the fragment plugin).
- Jasper Report Field = "resource:Package Name+Jasper Report File Name", for e.g "resource:org/hengsin/jasper/reports/Order.jasper"
- The "RESOURCE_DIR" and "SUBREPORT_DIR" will be set to the parent path of the main jasper report file. Using the example above, it will be set to "resource:org/hengsin/jasper/reports/" (resource: will be replaced by the actual class loader resource prefix, for e.g bundleresource://86.fwk1882395698:2/). If your Subreport expression is $P{SUBREPORT_DIR}+"OrderLine.jasper", it will be resolved to "resource:org/hengsin/jasper/reports/OrderLine.jasper" (Similar translation happen for Image expression).
- Since v11 (https://idempiere.atlassian.net/browse/IDEMPIERE-5922), we have added a new syntax of Jasper Report Field = "resource:bundle symbolic name:Package Name+Jasper Report File Name" (e.g resource:org.idempiere.test:org/idempiere/test/jasper/AR_Invoice.jrxml). With the new syntax, you don't have to create your plugin as fragment of "org.adempiere.report.jasper".
Deploy as Fragment Resource Bundle
- Create non-Java fragment plugin with "org.adempiere.report.jasper" as the Host Plug-in (i.e Don't create as a Java Project).
- Create a unique Java package like folder structure at the root of your fragment project. For e.g, if your fragment project name is JasperReportFragment, JasperReportFragment/org/hengsin/jasper/reports.
- Make sure that folder is added to build.properties and deploy all the report artifacts there.
- To deploy, install the fragment plugin using telnet or felix web console. If running from Eclipse, you just have to add your fragment plugin to the selected workspace plugin (for e.g, create a duplicate copy of "server.product" launch configuration and add the fragment plugin).
- Jasper Report Field = "bundle:Full path to the Jasper Report File", for e.g "bundle:/org/hengsin/jasper/reports/Order.jasper".
- The "RESOURCE_DIR" and "SUBREPORT_DIR" will be set to the parent path of the main jasper report file. Using the example above, it will be set to "bundle:/org/hengsin/jasper/reports/" (bundle: will be replaced by the actual bundle entries prefix, for e.g bundleentry://3.fwk1882395698/). If your Subreport expression is $P{SUBREPORT_DIR}+"OrderLine.jasper", it will be resolved to "bundle:org/hengsin/jasper/reports/OrderLine.jasper" (Similar translation happen for Image expression).
- Since v11 (https://idempiere.atlassian.net/browse/IDEMPIERE-5922), we have added a new syntax of Jasper Report Field = "bundle:bundle symbolic name:Full path to the Jasper Report File" (e.g bundle:org.idempiere.test:/AR_Invoice_Bundle.jrxml). With the new syntax, you don't have to create your plugin as fragment of "org.adempiere.report.jasper".