Reporting

Un article de Bluexml.com.

Home Official WebSite Download Forum


BlueXML Developer Studio, and more particularly, the Alfresco generator provide reporting feature. From the definition of the data model, we generate report definition directly usable. Our report permits to view all attributes without association. We have actually worked on iReport and BIRT Report.

Sommaire

Data

Our report is based on XML files obtained by webscript. To get all content of a particular type, you have this URL :

http://<SEVER>:<PORT>/alfresco/services/<TYPE_NAME>.xml

Per example, in a CRM model, we have this URL :

http://localhost:8080/alfresco/service/com_bluexml_crm_Contact.xml

We obtain this XML content :

<records>
  <type>com_bluexml_crm_Contact</type>
  <qName>crm:com_bluexml_crm_Contact</qName>
  <totalCount>27</totalCount>
  <items>
     <item>
       <id>a1d18a8a-d5a0-11dc-90b7-2fc3009d9a0f</id>
       <displayPath>/Alfresco/Espace invité</displayPath>
       <icon16>/images/filetypes/_default.gif</icon16>
       <nodeRef>workspace://SpacesStore/a1d18a8a-d5a0-11dc-90b7-2fc3009d9a0f</nodeRef>
       <com_bluexml_crm_Contact_lastName>DUPONT</com_bluexml_crm_Contact_lastName>
       <com_bluexml_crm_Contact_firstName>François</com_bluexml_crm_Contact_firstName>
       <com_bluexml_crm_Contact_surname>df</com_bluexml_crm_Contact_surname>
       <com_bluexml_crm_Contact_title>M.</com_bluexml_crm_Contact_title>
       <com_bluexml_crm_Contact_language>français </com_bluexml_crm_Contact_language>
       <com_bluexml_crm_CommunicationInformation_phone>00.01.02.03.04</com_bluexml_crm_CommunicationInformation_phone>
       <com_bluexml_crm_CommunicationInformation_hotline></com_bluexml_crm_CommunicationInformation_hotline>
       <com_bluexml_crm_CommunicationInformation_fax></com_bluexml_crm_CommunicationInformation_fax>
       <com_bluexml_crm_CommunicationInformation_mobile></com_bluexml_crm_CommunicationInformation_mobile>
       <com_bluexml_crm_CommunicationInformation_email></com_bluexml_crm_CommunicationInformation_email>
       <com_bluexml_crm_Project_linkedTo></com_bluexml_crm_Project_linkedTo>
       <com_bluexml_crm_BroadcastList_includesContact></com_bluexml_crm_BroadcastList_includesContact>
       <com_bluexml_crm_Event_organizedBy></com_bluexml_crm_Event_organizedBy>
       ...
     </item>
     ...
  </items>
</records>

iReport

Overview

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

Definition

Data

If we see the IReport definition, we can see that we select all items :

<queryString language="xPath"><![CDATA[//item]]></queryString>

Next, we define all attributes :

 <field name="com_bluexml_crm_Contact_lastName" class="java.lang.String">
   <fieldDescription><![CDATA[com_bluexml_crm_Contact_lastName]]></fieldDescription>
 </field>
 <field name="com_bluexml_crm_Contact_firstName" class="java.lang.String">
   <fieldDescription><![CDATA[com_bluexml_crm_Contact_firstName]]></fieldDescription>
 </field>
 <field name="com_bluexml_crm_Contact_surname" class="java.lang.String">
   <fieldDescription><![CDATA[com_bluexml_crm_Contact_surname]]></fieldDescription>
 </field>
 <field name="com_bluexml_crm_Contact_title" class="java.lang.String">
   <fieldDescription><![CDATA[com_bluexml_crm_Contact_title]]></fieldDescription>
 </field>
 <field name="com_bluexml_crm_Contact_language" class="java.lang.String">
   <fieldDescription><![CDATA[com_bluexml_crm_Contact_language]]></fieldDescription>
 </field>
 <field name="com_bluexml_crm_CommunicationInformation_phone" class="java.lang.String">
   <fieldDescription><![CDATA[com_bluexml_crm_CommunicationInformation_phone]]></fieldDescription>
 </field>
 <field name="com_bluexml_crm_CommunicationInformation_hotline" class="java.lang.String">
   <fieldDescription><![CDATA[com_bluexml_crm_CommunicationInformation_hotline]]></fieldDescription>
 </field>
 <field name="com_bluexml_crm_CommunicationInformation_fax" class="java.lang.String">
   <fieldDescription><![CDATA[com_bluexml_crm_CommunicationInformation_fax]]></fieldDescription>
 </field>
 <field name="com_bluexml_crm_CommunicationInformation_mobile" class="java.lang.String">
   <fieldDescription><![CDATA[com_bluexml_crm_CommunicationInformation_mobile]]></fieldDescription>
 </field>
 <field name="com_bluexml_crm_CommunicationInformation_email" class="java.lang.String">
   <fieldDescription><![CDATA[com_bluexml_crm_CommunicationInformation_email]]></fieldDescription>
 </field>

View

Image:Ireport_01.gif

Result

If we generate as PDF file, we can obtained :

Image:Ireport_02.gif

Links

iReport Project Page : http://www.jasperforge.org/sf/projects/ireport

BIRT Report

Overview

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

Definition

Data

We define a XML data source :

<oda-data-source extensionID="org.eclipse.datatools.enablement.oda.xml" name="Data Source" id="7">
   <text-property name="displayName"></text-property>
   <property name="FILELIST">http://localhost:8080/alfresco/service/com_bluexml_crm_Contact.xml</property>
</oda-data-source>

Next, we define all attributes :

<structure name="cachedMetaData">
<list-property name="resultSet">
 <structure>
   <property name="position">1</property>
   <property name="name">Nom de famille</property>
   <property name="dataType">string</property>
 </structure>
 <structure>
   <property name="position">2</property>
   <property name="name">Prénom</property>
   <property name="dataType">string</property>
 </structure>
 ...
</list-property>
</structure>

We make the request :

<property name="queryText">table0#-TNAME-#table0#:#[/records/items/item]#:#
  {Nom de famille;STRING;/com_bluexml_crm_Contact_lastName},
  {Prénom;STRING;/com_bluexml_crm_Contact_firstName},
  {Surnom;STRING;/com_bluexml_crm_Contact_surname},
  {Salutation;STRING;/com_bluexml_crm_Contact_title},
  {Langue;STRING;/com_bluexml_crm_Contact_language},
  {Téléphone;STRING;/com_bluexml_crm_CommunicationInformation_phone},
  {Assistance téléphonique;STRING;/com_bluexml_crm_CommunicationInformation_hotline},
  {Fax;STRING;/com_bluexml_crm_CommunicationInformation_fax},
  {Portable;STRING;/com_bluexml_crm_CommunicationInformation_mobile},
  {E-Mail;STRING;/com_bluexml_crm_CommunicationInformation_email}
</property>

View

Image:BIRTReport_01.gif

Result

If we generate as PDF file, we can obtained :

Image:BIRTReport02.gif

Links

Eclipse BIRT Home : http://www.eclipse.org/birt/phoenix/