JBoss.orgCommunity Documentation
This chapter covers the steps required for BIRT Integration
In this section you'll find out how to create a web project including Seam and BIRT capabilities
These are the prerequisites required to create a Seam web project including with BIRT functionality:
Follow the next steps to create a web project
Create a new Seam Web Project
Choose the 2.0 version of the Seam facet
Add the "Birt Reporting Runtime Component" facet
Or choose the "JBoss BIRT Integration Web Project" configuration
Create the birttests.xhtml, testbirt.xhtml and testbirt1.xhtml pages as follows:
birttests.xhtml:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml"> <ui:define name="body"> <h:messages globalOnly="true" styleClass="message"/> <rich:panel> <f:facet name="header">Welcome to JBoss BIRT!</f:facet> <ul> <li><s:link view="/testbirt.xhtml" value="Test Birt" /></li> <li><s:link view="/testbirt1.xhtml" value="Test Birt 1" /></li> </ul> </rich:panel> </ui:define> </ui:composition>
testbirt.xhtml:
<p:birt xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:p="http://jboss.com/products/seam/birt" designType="run" format="pdf" designName="test.rptdesign" title="JBoss Birt Test"> <p:param name="sample" value="sample param"/> </p:birt>
testbirt1.xhtml:
<p:birt xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:p="http://jboss.com/products/seam/birt" designType="frameset" designName="test1.rptdesign" title="JBoss Birt Test"> </p:birt>
Try the tests out by accessing http://localhost:8080//birttests.seam with your web browser.
The birt tag recognizes most of the parameters described on the BIRT Report Viewer Parameters page. The attributes of the birt tag don't contain the "__" prefix. The param tag describes report parameters. It supports the following attributes:
name - the parameter name (required)
value - the parameter value (required)
isnull - specifies that a report parameter has a null value (optional)
islocale - specifies whether the parameter is localized (optional)
These tags are defined in the org.jboss.birt.core/resources/jboss-seam-birt.jar library that contains source.
It is possible to embed a BIRT report in some Seam xhtml page. For instance:
Example:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:b="http://jboss.com/products/seam/birt" template="layout/template.xhtml"> <ui:define name="body"> <h:messages globalOnly="true" styleClass="message" id="globalMessages"/> <rich:panel> <f:facet name="header">Products</f:facet> <b:birt designType="embed" designName="ProductCatalog.rptdesign" embeddable="true" masterpage="false"/> <div style="clear:both"/> </rich:panel> <div class="actionButtons"> <s:button view="/ProductsEdit.xhtml" id="edit" value="Edit"/> <s:button view="/BirtProductsPdf.xhtml" id="BirtProductPdf" value="Product Catalog - PDF"/> <s:button view="/BirtProductsFrameset.xhtml" id="BirtProductFrameset" value="Product Catalog - Frameset"/> <s:button view="/BirtProductsEmbedded.xhtml" id="BirtProductEmbedded" value="Product Catalog - Embedded"/> <s:button view="/TopSellingProducts.xhtml" id="TopSellingProducts" value="Top Selling Products"/> <s:button view="/#{empty productsFrom ? 'ProductsList' : productsFrom}.xhtml" id="done" value="Done"/> </div> </ui:define> </ui:composition>
The JBoss BIRT Integration feature includes the Hibernate ODA Data Source completely integrated with Hibernate Tools. You can use it in the way you use any of BIRT ODA drivers. For instance,
run the Seam Generate Entities action
This action will create a Hibernate Console configuration.
create a new BIRT report
add the Hibernate ODA datasource
add the Hibernate ODA dataset
All the HQL features like syntax highlighting, content assist, formatting, Drag and Drop, etc., are available to you here
You can create a BIRT report using this data source and data set.
You can also use parameters within the Hibernate ODA driver.
You can deploy this report by adding an action button to the Seam's CRUD xhtml file.
create the testHibernateOda.xhtml file
birttests.xhtml:
<p:birt xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:p="http://jboss.com/products/seam/birt" designType="run" format="pdf" designName="testHibernateOda.rptdesign" title="JBoss Birt Test"> </p:birt>
open the Articles.xhtml page
click the Birt PDF Report button
The JNDI URL property can be either Hibernate Session Factory or Hibernate Entity Manager Factory. If a user doesn't specify this property, our engine will try the following JNDI URLs :
java:/<project_name>
java:/<project_name>EntityManagerFactory
If you want to test this feature using PDE Runtime, you need to add osgi.dev=bin to the WebContent/WEB-INF/platform/configuration/config.ini file
In conclusion, the main goal of this document is to get you know with a full featureset that JBoss BIRT Tools provides. Thus if you have some questions, comments or suggestions on the topic, please fell free to ask in the JBoss Tools Forum. You can also influence on how you want to see JBoss Tools docs in future leaving your vote on our page here.