Difference between revisions of "BIRT/FAQ/Extensions"
Revision as of 11:42, 10 July 2006
Back to BIRT FAQ Index
Q: Where can I find DE API Java documentation?
Answered by Rima Kanguri The DE API JAVA docs are part of the help inside Eclipse. After you install the BIRT plugins, go to Help-> HelpContents ->BIRT Developer Guide->Reference->API Reference -> Report Object Model API Reference.
Q: Can I extend BIRT?
Yes, BIRT provides several extension points:
- Data access extensions through BIRT's Open Data Access (ODA) framework.
- Extended data access UI using the Eclipse plugin framework.
- Extended report items that add visual items such as gauges, etc. Includes design-time UI support.
- Scripting within a report. Scripting can access application-specific business logic implemented as Java classes.
- Rendering extensions that produce additional report output formats.
Q: How can I create a custom report item such as a stop light?
How Java developers could extend the basic BIRT model through the creation of Java objects that are accessed through BIRT script. For instance, a company would like to develop a propietary Stop Light Display for use in a management summary report, this display would have a significant amount of business logic and display logic that they would like to implement in Java.
ROM calls this an "extended item". The development team is working on a specification of exactly how this will happen. Briefly, you start by creating an extension definition file, something like that created for plug-ins in Eclipse. In that file you identify the element name, the properties, and the Java classes to use in the Designer, Report Engine. The Designer class paints the design-time view of the element using SWT (or can just return an image.)
The Report Engine has two phases: the Factory (which creates the report) and the Presentation phase which renders the report to HTML, FO, PDF, etc. The extension file provides separate classes for each phase. The Factory class is often optional; even without it the Factory can figure out (from the property definitions) what data needs to be stored in the report document.
The Presentation class does the bulk of the work. Let's take the simplest case where the element can be represented by an image. Your stop light example fits this well. In this case, the Presentation Java class gets two pieces of information: the element design (or definition) and the element instance. The element design holds all the properties the user set in the designer. Perhaps here that includes the color settings, the threshold for which light to show, etc. The element instance provides the data. Suppose that the stoplight shows actual sales as a percent of quota. If so, we can get this percent from the element instance. We then compare this with the design setting for the threshold, and determine say, that the ratio is 90%, and so we should show the yellow light.
We then create an image and return it to the Report Engine, which "does the right thing" to put the image into the HTML file, PDF or whatever.
That's the high level answer. Please take a look at the extension specification once it is released and see if it provides the details you'd need to create such an extension.
See additional discussion of data extensions on the Data FAQ page.