NF9.1 Jasper Report Deployment

From iDempiere en

Feature: Jasper Report Deployment Refactoring and Improvement

Goal: Functional

Developer: Hengsin (talk)

Feature Ticket: IDEMPIERE-4873

Description: Refactor and improve the deployment of Jasper Report.

Images

  1. To Load from File:
    1. add Report Paramter "RESOURCE_DIR" (type String) with Default Value Expression = ""
    2. Image Expression - $P{RESOURCE_DIR}+"image file name". For e.g $P{RESOURCE_DIR}+"MyCompanyLogo.png".
  2. To Load from AD_Image:
    1. NF9.1_Column_Display_Type_For_Jasper_Report

Sub Report

  1. add Report Parameter "SUBREPORT_DIR" (type String) with Default Value Expression = ""
    1. Subreport Expression - $P{SUBREPORT_DIR}+"Subreport file name". For e.g $P{SUBREPORT_DIR}+"OrderLine.jasper".
    2. You can use any name for Subreport.

Resource Bundle

  1. Use resource bundle property file - Multi-Lingual_Jasper
  2. NF9.1_AD_Resource_Bundle_For_Jasper_Report

Deploy as Attachment

  1. Upload all report artifacts as your Jasper Report Process's attachment
  2. Jasper Report field = "attachment:Jasper Report File Name". For e.g, "attachment:Order.jasper".
  3. All report artifacts will be downloaded from the attachment archive to a temporary local folder.
  4. The "RESOURCE_DIR" and "SUBREPORT_DIR" will be set to the temporary local folder.

Deploy as File Resources

  1. Deploy all report artifacts to a folder that's accessible by the iDempiere server.
  2. 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.
  3. Jasper Report field = "full path to the Jasper Report File" (the use of file: prefix is optional). For e.g, "/home/hengsin/myreports/Order.jaser" or "file:///home/hengsin/myreports/Order.jaser".
  4. The Jasper Report file is download to a local temporary folder for compilation if it is a .jrxml file.
  5. 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).

Deploy as Web Resources

  1. Deploy all report artifacts as static file of a web server (Can be an OSGi web bundle plugin too)
  2. Jasper Report field = "full web path to the Jasper Report File", for e.g, "http://127.0.0.1:8080/MyJasperReportFiles/Order.jasper"
  3. The Jasper Report file is download to a local temporary folder for compilation if it is a .jrxml file.
  4. 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

  1. Create a fragment plugin with "org.adempiere.report.jasper" as the Host Plug-in.
  2. Create an unique Java Package (for e.g org.hengsin.jasper.reports) and deploy all your Jasper Report Resources there.
  3. 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).
  4. Jasper Report Field = "resource:Package Name+Jasper Report File Name", for e.g "resource:org/hengsin/jasper/reports/Order.jasper"
  5. 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).

Deploy as Fragment Resource Bundle

  1. Create non-Java fragment plugin with "org.adempiere.report.jasper" as the Host Plug-in (i.e Don't create as a Java Project).
  2. 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.
  3. Make sure that folder is added to build.properties and deploy all the report artifacts there.
  4. 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).
  5. Jasper Report Field = "bundle:Full path to the Jasper Report File", for e.g "bundle:/org/hengsin/jasper/reports/Order.jasper".
  6. 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).
Cookies help us deliver our services. By using our services, you agree to our use of cookies.