Free tutorials for Java, Eclipse and Web programming



Reporting with Eclipse BIRT and Java Objects (POJO's) - Tutorial

Lars Vogel Hendrik Still

Version 1.0

22.01.2010

Revision History
Revision 0.1 - 0.207.03.2008Hendrik Still
Created Article
Revision 0.307.03.2009Lars Vogel
Correted datamodel, dao, fixed screenshots
Revision 0.426.03.2009Lars Vogel
Updated Article
Revision 0.412.04.2009Lars Vogel
Corrected open script
Revision 0.507.05.2009Lars Vogel
StockDaoMock always returns data
Revision 0.612.05.2009Lars Vogel
Tomcat installation overview
Revision 0.724.06.2009Lars Vogel
Update to Eclipse 3.5 (Galileo)
Revision 0.808.07.2009Lars Vogel
Fixed RCP issue, corrected fetch and open script
Revision 0.914.09.2009Lars Vogel
Applied improved RCP view code from Nikhil Milo
Revision 1.022.01.2010Lars Vogel
Fixed double-screenshot

Eclipse Birt

This article describes how to use Eclipse BIRT for reporting on simple Java Objects (POJO's - Plan old Java Objects).

The article will also explain how to deploy the resulting BIRT report into a webcontainer (tomcat) and how to use it in an Eclipse RCP application.

Eclipse 3.5 (Eclipse Galileo) is used for this tutorial.


Table of Contents

1. Eclipse BIRT
1.1. Overview
1.2. Example
2. Installation
3. Project
4. Java classes
4.1. Overview
4.2. Domain Model
4.3. Data Access Object - Mock
5. Datasource and Dataset
5.1. The Datasource
5.2. The Dataset
5.3. JavaScript
6. Display the data in a table
6.1. Overview
6.2. Create a table
7. Chart
7.1. Create a Chart
8. Deploying in Tomcat
8.1. Overview
8.2. Install BIRT in Tomcat
8.3. Install your BIRT reports in Tomcat
9. Deploying in Eclipse RCP application
9.1. BIRT deploying to an RCP Application
10. Appendix: Using the Yahoo Service
10.1. Overview
10.2. The Code
11. Thank you
12. Questions and Discussion
13. Links and Literature
13.1. Source Code
13.2. Eclipse BIRT resources
13.3. Other Resources

1. Eclipse BIRT

1.1. Overview

Eclipse BIRT allows the creation of reports using various data sources.

These data sources define where the data is stored. Data sets defines the query for the report.

BIRT provides for example the following data sources:

  • Databases (via JDBC)

  • Text Files (cvs, XML)

  • WebServices (via WSDL-Files)

  • Scripting Data sources

In a Java program it is often convenient to use directly Java objects as a data source for reports. This article will focus on the usage of plain old Java objects (POJO) as data sources for BIRT reports.

1.2. Example

In this tutorial we will build a report which will show us information about the stock market. We get the information from a Java Object. The data will be displayed in a chart and in a table with detailed information. The result should look like this: