This tutorial has been created with the version Alfresco 2.9B.
Contents |
Note
You have to install all the following packages, even if you want to use only one of them : if you only want to use BIRT Report, you have to install iReport too.
BIRT Report
BIRT is an Eclipse-based open source reporting system for web applications, especially those based on Java and J2EE. BIRT has two main components: a report designer based on Eclipse, and a runtime component that you can add to your app server. BIRT also offers a charting engine that lets you add charts to your own application.Source : BIRT Project
We have downloaded the latest version of BIRT Runtime : 2.2.1.1 from Eclipse.org. We have extracted this file on the folder c:\Alfresco\reporting\birt-2.1.1.1. This folder will be identified by BIRT_RUNTIME_DIR.
IReport
iReport is a powerful, intuitive and easy to use visual report builder/designer for JasperReports written in 100% pure java. This tool allows users to visually edit complex reports with charts, images, and subreports. iReport is integrated with leading open source chart libraries for java. The data to print can be retrieved through several ways including multiple JDBC connections, TableModels, JavaBeans, XML, MDX, EJBQL, Hibernate, etc.Source : iReport
We have downloaded the latest version of IReport : 2.0.4 from JasperReport :
- jasperreports-2.0.4-project.zip
- jasperreports-2.0.4.jar
We have extracted the ZIP file on the folder c:\Alfresco\reporting\japerreports-2.0.4. This folder will be identified by JASPER_RUNTIME_DIR.
iText
iText is a library that allows you to generate PDF files on the fly.
iText is an ideal library for developers looking to enhance web- and other applications with dynamic PDF document generation and/or manipulation. iText is not an end-user tool. Typically you won't use it on your Desktop as you would use Acrobat or any other PDF application. Rather, you'll build iText into your own applications so that you can automate the PDF creation and manipulation process.Source iText
We have downloaded the latest version of the library : 2.0.8 from iText. This JAR file have been moved in the folder BIRT_RUNTIME_DIR/ReportEngine/plugins/com.lowagie.itext.
Entreprise Report Services
We have downloaded the latest version of the module : 1.0 RC2 from AlfrescoForge. We extract the file release.zip in the folder c:\Alfresco\reporting\report_services identifed by REPORT_SERVICE_DIR.
Configuration
We update correctly the file REPORT_SERVICE_DIR/build/build-report.properties. In this example, the file c:\Alfresco\reporting\report_services\build\build-report.properties contains this information :
#alfresco.war points out alfresco.war file. Replace this with your own. alfresco.war=C:/Alfresco/tomcat/webapps/alfresco.war #birt.engine points out "birt runtime" folder. birt.engine=C:/Alfresco/reporting/birt-2.2.1.1/ReportEngine #for development environment use only. Comment out the following in production environment. #dev=true #jasper.home points out "Jasper Home Director" it should be able to copy libraries. jasper.home=C:/Alfresco/reporting/jasperreports-2.0.4
Construction
We move on the folder REPORT_SERVICE_DIR/build/. We modify the file build.xml :
<target name="integrate-extension" depends="package-jar, pre-create-deployable">
<available file="${alfresco.war}" type="file" property="alfresco.war.present" />
<fail unless="alfresco.war.present" message="Could not find alfresco.war, please copy it to ${alfresco.war}" />
<zip destfile="${alfresco.war}" update="true">
<zipfileset file="${package.file.jar}" prefix="WEB-INF/lib" />
<zipfileset dir="${web.dir}" />
<property name="target.build.file" value="${alfresco.war}"/>
<property name="target.build.lib.prefix" value="WEB-INF/lib"/>
<property name="target.build.config.prefix" value="WEB-INF/classes"/>
<zipfileset dir="${src-config.files}" prefix="WEB-INF/classes">
<exclude name="**/module.properties"/>
<exclude name="**/module-context.xml"/>
<exclude name="${src-config.files}/reporting/engine/*-reporting-engine.xml"/>
</zipfileset>
<zipfileset file="${src-config.files}/alfresco/module/reporting/module-context.xml"
fullpath="WEB-INF/classes/alfresco/extension/reporting-context.xml">
</zipfileset>
</zip>
<property name="target.build.file" value="${alfresco.war}"/>
<property name="target.build.lib.prefix" value="WEB-INF/lib"/>
<property name="target.build.config.prefix" value="WEB-INF/classes"/>
<antcall target="addReportEngines"></antcall>
</target>
After, we create the AMP file with the target create-amp. We obtain the file reporting.amp in the folder REPORT_SERVICE_DIR/bin/. If we integrate the AMP file now, we have an errror :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rhinoScriptDebugger'
defined in class path resource [alfresco/script-services-context.xml]: Instantiation of bean failed; nested
exception is java.lang.IllegalAccessError: class org.alfresco.repo.jscript.AlfrescoRhinoScriptDebugger$AlfrescoDim
cannot access its superclass org.mozilla.javascript.tools.debugger.Dim
Caused by: java.lang.IllegalAccessError: class org.alfresco.repo.jscript.AlfrescoRhinoScriptDebugger$AlfrescoDim cannot
access its superclass org.mozilla.javascript.tools.debugger.Dim
An AMP file is a ZIP file. So we have removed the file js.jar in the folder lib. Next, we have integrate the AMP file to the WAR file with the Module Management Tool provided by Alfresco.
We have integrate too the JAR file jasperreports-2.0.4.jar in the folder of tomcat : C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\lib.
