Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Seam (BIRT) Recipe
Contents
Set up environment
Get started with Seam
- Download and install seam (I tried it with jboss-seam-2.0.0.GA).
- Get started with seam-gen, generate new project.
build.properties
can look like this:
#Generated by seam setup #Sun May 11 07:49:04 CEST 2008 hibernate.connection.password= workspace.home=/home/user/projects model.package=org.seambirt.sample.entity driver.jar=lib/hsqldb.jar action.package=org.seambirt.sample test.package=org.seambirt.sample.test database.type=hsql richfaces.skin=deepMarine hibernate.default_catalog.null= hibernate.default_schema.null= database.drop=n project.name=seambirt hibernate.connection.username=sa hibernate.connection.driver_class=org.hsqldb.jdbcDriver hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider project.type=ear icefaces.home= database.exists=n jboss.home=/opt/jboss-4.2.2.GA hibernate.dialect=org.hibernate.dialect.HSQLDialect hibernate.connection.url=jdbc\:hsqldb\:.
- Generate new entity (
$ seam new-entity
). I named it SampleReport. - [OPTIONAL] Include Seam project into your IDE. Eclipse Users: Add the project
into Eclipse using File > New > Project and select General > Project (not Java Project). NetBeans Users: Open the project in NetBeans.
Get started with BIRT
- Download BIRT (birt-runtime-2_2_1)
- Copy jars below from
$BIRT_RUNTIME/WebViewerExample/WEB-INF/lib
to$PROJECT/lib
cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/com.ibm.icu_3.6.1.v20070906.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/commons-cli-1.0.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/coreapi.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/dataadapterapi.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/dteapi.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/engineapi.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/flute.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/chartengineapi.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/js.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/modelapi.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/modelodaapi.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/odadesignapi.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/org.apache.commons.codec_1.3.0.v200706111738.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/org.eclipse.emf.common_2.2.1.v200702131851.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/org.eclipse.emf.ecore.xmi_2.2.2.v200702131851.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/org.eclipse.emf.ecore_2.2.2.v200702131851.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/org.w3c.css.sac_1.3.0.v200706111724.jar $PROJECT/lib cp $BIRT_RUNTIME/WebViewerExample/WEB-INF/lib/scriptapi.jar $PROJECT/lib
- Copy dir (include subdirs) from $BIRT_RUNTIME/WebViewerExample/WEB-INF/platform to $PROJECT/resources/WEB-INF/platform
cp -r $BIRT_RUNTIME/WebViewerExample/WEB-INF/platform $PROJECT/resources/WEB-INF/platform
Integrate
Change project defaults
- Change ant script
$PROJECT/build.xml
- Add property
<property name="birt.platform.dir" value="resources/WEB-INF/platform" />
- Change war target:
<target name="war" depends="compile" description="Build the distribution .war file"> <copy todir="${war.dir}"> <fileset dir="${basedir}/view" /> <fileset dir="${basedir}/resources"> <include name="Reports/**/*" /> </fileset> </copy> .... <copy todir="${war.dir}/WEB-INF/lib"> <fileset dir="${lib.dir}"> <include name="richfaces-impl*.jar" /> <include name="richfaces-ui*.jar" /> <include name="oscache*.jar" /> <include name="commons-digester.jar" /> <include name="commons-beanutils.jar" /> <include name="jsf-facelets.jar" /> <include name="jboss-seam-*.jar" /> <exclude name="jboss-seam-gen.jar" /> <!-- BIRT --> <include name="seam-birt.jar" /> <include name="com.ibm.icu_3.6.1.v20070906.jar" /> <include name="commons-cli-1.0.jar" /> <include name="coreapi.jar" /> <include name="dataadapterapi.jar" /> <include name="dteapi.jar" /> <include name="engineapi.jar" /> <include name="flute.jar" /> <include name="chartengineapi.jar" /> <include name="js.jar" /> <include name="modelapi.jar" /> <include name="modelodaapi.jar" /> <include name="odadesignapi.jar" /> <include name="org.apache.commons.codec_1.3.0.v200706111738.jar" /> <include name="org.eclipse.emf.common_2.2.1.v200702131851.jar" /> <include name="org.eclipse.emf.ecore.xmi_2.2.2.v200702131851.jar" /> <include name="org.eclipse.emf.ecore_2.2.2.v200702131851.jar" /> <include name="org.w3c.css.sac_1.3.0.v200706111724.jar" /> <include name="scriptapi.jar" /> </fileset> </copy> <copy todir="${war.dir}/WEB-INF/platform/"> <fileset dir="${birt.platform.dir}" /> </copy>
build.xml all in one:
<?xml version="1.0"?> <project name="seambirt" default="deploy" basedir="."> <!-- Give user a chance to override without editing this file or typing -D --> <property file="${basedir}/build.properties" /> <property name="profile" value="dev" /> <property file="build-${profile}.properties" /> <!-- set global properties for this build --> <property name="project.name" value="seambirt" /> <property name="dist.dir" value="dist" /> <property name="src.model.dir" value="src/model" /> <property name="src.action.dir" value="src/action" /> <property name="src.test.dir" value="src/test" /> <property name="lib.dir" value="lib" /> <property name="ear.dir" value="exploded-archives/${project.name}.ear" /> <property name="jar.dir" value="exploded-archives/${project.name}.jar" /> <property name="war.dir" value="exploded-archives/${project.name}.war" /> <property name="test.dir" value="test-build" /> <property name="bootstrap.dir" value="${basedir}/bootstrap" /> <property name="deploy.dir" value="${jboss.home}/server/default/deploy" /> <property name="ear.deploy.dir" value="${deploy.dir}/${project.name}.ear" /> <property name="jar.deploy.dir" value="${ear.deploy.dir}/${project.name}.jar" /> <property name="war.deploy.dir" value="${ear.deploy.dir}/${project.name}.war" /> <property name="testng.jar" value="${basedir}/lib/testng.jar" /> <property name="javac.debug" value="true" /> <property name="javac.deprecation" value="false" /> <property name="debug" value="false" /> <property name="birt.platform.dir" value="resources/WEB-INF/platform" /> <!--Properties for validating configuration files --> <property name="validate.resources.dir" value="${basedir}/exploded-archives" /> <property name="schema.dir" value="${basedir}/exploded-archives/schemas" /> <property name="src.schema.dir" value="${schema.dir}/org/jboss/seam" /> <property name="schema.version" value="2.0" /> <fileset id="lib" dir="${lib.dir}"> <include name="*.jar" /> </fileset> <path id="build.classpath"> <fileset refid="lib" /> </path> <target name="init" description="Initialize the build"> <mkdir dir="${jar.dir}" /> <mkdir dir="${ear.dir}" /> <mkdir dir="${war.dir}" /> <mkdir dir="${dist.dir}" /> </target> <target name="compile" depends="init" description="Compile the Java source code" unless="eclipse.running"> <javac classpathref="build.classpath" destdir="${jar.dir}" debug="${javac.debug}" deprecation="${javac.deprecation}" nowarn="on"> <src path="${src.model.dir}" /> <src path="${src.action.dir}" /> </javac> </target> <target name="copyclasses" depends="init" description="Copy the classes that were compiled by eclipse" if="eclipse.running"> <copy todir="${jar.dir}"> <fileset dir="classes/model"> <include name="**/*.class" /> </fileset> <fileset dir="classes/action"> <include name="**/*.class" /> </fileset> </copy> </target> <target name="jar" depends="compile,copyclasses" description="Build the distribution .jar file"> <copy todir="${jar.dir}"> <fileset dir="${basedir}/resources"> <include name="seam.properties" /> </fileset> </copy> <copy todir="${jar.dir}/META-INF"> <fileset dir="${basedir}/resources/META-INF"> <include name="ejb-jar.xml" /> </fileset> </copy> <copy tofile="${jar.dir}/META-INF/persistence.xml" file="${basedir}/resources/META-INF/persistence-${profile}.xml" overwrite="true" /> <copy tofile="${jar.dir}/import.sql" file="${basedir}/resources/import-${profile}.sql" overwrite="true" /> </target> <target name="war" depends="compile" description="Build the distribution .war file"> <copy todir="${war.dir}"> <fileset dir="${basedir}/view" /> <fileset dir="${basedir}/resources"> <include name="Reports/**/*" /> </fileset> </copy> <copy todir="${war.dir}/WEB-INF"> <fileset dir="${basedir}/resources/WEB-INF"> <include name="*.*" /> <include name="classes/**/*.*" /> <exclude name="classes/**/*.class" /> </fileset> <filterset> <filter token="debug" value="${debug}" /> <filter token="jndiPattern" value="${project.name}/#{ejbName}/local" /> <filter token="embeddedEjb" value="false" /> </filterset> </copy> <copy todir="${war.dir}/WEB-INF"> <fileset dir="${basedir}/resources/WEB-INF"> <include name="lib/*.*" /> <include name="classes/**/*.class" /> </fileset> </copy> <copy todir="${war.dir}/WEB-INF/lib"> <fileset dir="${lib.dir}"> <include name="richfaces-impl*.jar" /> <include name="richfaces-ui*.jar" /> <include name="oscache*.jar" /> <include name="commons-digester.jar" /> <include name="commons-beanutils.jar" /> <include name="jsf-facelets.jar" /> <include name="jboss-seam-*.jar" /> <exclude name="jboss-seam-gen.jar" /> <!-- BIRT --> <include name="seam-birt.jar" /> <include name="com.ibm.icu_3.6.1.v20070906.jar" /> <include name="commons-cli-1.0.jar" /> <include name="coreapi.jar" /> <include name="dataadapterapi.jar" /> <include name="dteapi.jar" /> <include name="engineapi.jar" /> <include name="flute.jar" /> <include name="chartengineapi.jar" /> <include name="js.jar" /> <include name="modelapi.jar" /> <include name="modelodaapi.jar" /> <include name="odadesignapi.jar" /> <include name="org.apache.commons.codec_1.3.0.v200706111738.jar" /> <include name="org.eclipse.emf.common_2.2.1.v200702131851.jar" /> <include name="org.eclipse.emf.ecore.xmi_2.2.2.v200702131851.jar" /> <include name="org.eclipse.emf.ecore_2.2.2.v200702131851.jar" /> <include name="org.w3c.css.sac_1.3.0.v200706111724.jar" /> <include name="scriptapi.jar" /> </fileset> </copy> <copy todir="${war.dir}/WEB-INF/platform/"> <fileset dir="${birt.platform.dir}" /> </copy> <copy todir="${war.dir}/WEB-INF/classes"> <fileset dir="${basedir}/resources"> <include name="messages*.properties" /> </fileset> </copy> </target> <target name="ear" description="Build the EAR"> <copy todir="${ear.dir}"> <fileset dir="${basedir}/resources"> <include name="*jpdl.xml" /> <include name="hibernate.cfg.xml" /> <include name="jbpm.cfg.xml" /> <include name="*.drl" /> </fileset> <fileset dir="${lib.dir}"> <include name="jboss-seam.jar" /> </fileset> <fileset dir="${basedir}"> <include name="lib/jbpm*.jar" /> <include name="lib/jboss-el.jar" /> <include name="lib/drools-*.jar" /> <include name="lib/janino-*.jar" /> <include name="lib/antlr-*.jar" /> <include name="lib/mvel*.jar" /> <include name="lib/richfaces-api*.jar" /> </fileset> </copy> <copy todir="${ear.dir}/META-INF"> <fileset dir="${basedir}/resources/META-INF"> <include name="application.xml" /> <include name="jboss-app.xml" /> </fileset> </copy> </target> <target name="archive" depends="jar,war,ear" description="Package the archives"> <jar jarfile="${dist.dir}/${project.name}.jar" basedir="${jar.dir}" /> <jar jarfile="${dist.dir}/${project.name}.war" basedir="${war.dir}" /> <jar jarfile="${dist.dir}/${project.name}.ear"> <fileset dir="${ear.dir}" /> <fileset dir="${dist.dir}"> <include name="${project.name}.jar" /> <include name="${project.name}.war" /> </fileset> </jar> </target> <target name="datasource"> <fail unless="jboss.home">jboss.home not set</fail> <copy todir="${deploy.dir}"> <fileset dir="${basedir}/resources"> <include name="${project.name}-${profile}-ds.xml" /> </fileset> </copy> </target> <target name="explode" depends="jar,war,ear,datasource" description="Deploy the exploded archive"> <fail unless="jboss.home">jboss.home not set</fail> <mkdir dir="${jar.deploy.dir}" /> <mkdir dir="${war.deploy.dir}" /> <copy todir="${jar.deploy.dir}"> <fileset dir="${jar.dir}" /> </copy> <copy todir="${war.deploy.dir}"> <fileset dir="${war.dir}" /> </copy> <copy todir="${ear.deploy.dir}"> <fileset dir="${ear.dir}" /> </copy> </target> <target name="unexplode" description="Undeploy the exploded archive"> <delete failonerror="no"> <fileset dir="${ear.deploy.dir}"> <exclude name="**/*.jar" /> </fileset> </delete> <delete file="${deploy.dir}/${project.name}-${profile}-ds.xml" failonerror="no" /> <delete dir="${ear.deploy.dir}" failonerror="no" /> </target> <target name="restart" depends="explode" description="Restart the exploded archive"> <touch file="${ear.deploy.dir}/META-INF/application.xml" /> </target> <target name="deploy" depends="archive,datasource" description="Deploy to JBoss AS"> <fail unless="jboss.home">jboss.home not set</fail> <copy todir="${deploy.dir}" file="${dist.dir}/${project.name}.ear" /> </target> <target name="undeploy" description="Undeploy the example from JBoss"> <delete file="${deploy.dir}/${project.name}.ear" /> <delete file="${deploy.dir}/${project.name}-dev-ds.xml" /> <delete file="${deploy.dir}/${project.name}-prod-ds.xml" /> </target> <target name="clean" description="Cleans up the build directory"> <delete dir="${dist.dir}" /> <delete dir="${ear.dir}" /> <delete dir="${war.dir}" /> <delete dir="${jar.dir}" /> <delete dir="${src.schema.dir}" failonerror="no" /> <delete dir="${basedir}/test-report" /> <delete dir="${basedir}/test-output" /> <delete failonerror="no"> <fileset dir="${test.dir}"> <exclude name="**/*.class" if="eclipse.running" /> </fileset> </delete> </target> <target name="compiletest" unless="eclipse.running" description="Compile the Java source code for the tests"> <mkdir dir="${test.dir}" /> <javac classpathref="build.classpath" destdir="${test.dir}" debug="${javac.debug}" deprecation="${javac.deprecation}" nowarn="on"> <src path="${src.action.dir}" /> <src path="${src.model.dir}" /> <src path="${src.test.dir}" /> </javac> </target> <target name="copytestclasses" if="eclipse.running" description="Copy classes compiled by eclipse to the test dir"> <mkdir dir="${test.dir}" /> <copy todir="${test.dir}"> <fileset dir="classes/model"> <include name="**/*.class" /> </fileset> </copy> <copy todir="${test.dir}"> <fileset dir="classes/action"> <include name="**/*.class" /> </fileset> </copy> <copy todir="${test.dir}"> <fileset dir="classes/test"> <include name="**/*.class" /> </fileset> </copy> </target> <target name="buildtest" depends="compiletest,copytestclasses" description="Build the tests"> <copy todir="${test.dir}"> <fileset dir="${basedir}/resources"> <exclude name="META-INF/persistence*.xml" /> <exclude name="import*.sql" /> <exclude name="${project.name}-*-ds.xml" /> </fileset> </copy> <copy tofile="${test.dir}/META-INF/persistence.xml" file="${basedir}/resources/META-INF/persistence-test.xml" overwrite="true" /> <copy tofile="${test.dir}/import.sql" file="${basedir}/resources/import-test.sql" overwrite="true" /> <copy todir="${test.dir}" flatten="true"> <fileset dir="${src.test.dir}"> <include name="**/*Test.xml" /> </fileset> </copy> </target> <target name="test" depends="buildtest" description="Run the tests"> <taskdef resource="testngtasks" classpath="${testng.jar}" /> <path id="test.path"> <path path="${test.dir}" /> <fileset dir="${lib.dir}/test"> <include name="*.jar" /> </fileset> <path path="${bootstrap.dir}" /> <path refid="build.classpath" /> </path> <testng outputdir="${basedir}/test-report"> <classpath refid="test.path" /> <xmlfileset dir="${test.dir}" includes="*Test.xml" /> </testng> </target> <target name="validateConfiguration" depends="war,ear,jar" description="Validate the xml configuration files"> <mkdir dir="${schema.dir}" /> <unjar src="${lib.dir}/jboss-seam.jar" dest="${schema.dir}"> <patternset> <include name="org/jboss/seam/*.xsd" /> <include name="org/jboss/seam/*.dtd" /> </patternset> </unjar> <ant antfile="validate.xml" target="validateConfiguration" /> </target> </project>
Code Seam-BIRT servlet
- Make two new classes in the project (e.g. in
$PROJECT/src/action
dir)- org.jboss.seam.pdf.birt.BirtEngine
package org.jboss.seam.pdf.birt; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import java.util.logging.Level; import javax.servlet.ServletContext; import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.core.framework.IPlatformContext; import org.eclipse.birt.core.framework.Platform; import org.eclipse.birt.core.framework.PlatformServletContext; import org.eclipse.birt.report.engine.api.EngineConfig; import org.eclipse.birt.report.engine.api.IReportEngine; import org.eclipse.birt.report.engine.api.IReportEngineFactory; public class BirtEngine { private static IReportEngine birtEngine = null; private static Properties configProps = new Properties(); private final static String configFile = "BirtConfig.properties"; public static synchronized void initBirtConfig() { loadEngineProps(); } public static synchronized IReportEngine getBirtEngine(ServletContext sc) { if (birtEngine == null) { EngineConfig config = new EngineConfig(); if (configProps != null) { String logLevel = configProps.getProperty("logLevel"); Level level = Level.OFF; if ("SEVERE".equalsIgnoreCase(logLevel)) { level = Level.SEVERE; } else if ("WARNING".equalsIgnoreCase(logLevel)) { level = Level.WARNING; } else if ("INFO".equalsIgnoreCase(logLevel)) { level = Level.INFO; } else if ("CONFIG".equalsIgnoreCase(logLevel)) { level = Level.CONFIG; } else if ("FINE".equalsIgnoreCase(logLevel)) { level = Level.FINE; } else if ("FINER".equalsIgnoreCase(logLevel)) { level = Level.FINER; } else if ("FINEST".equalsIgnoreCase(logLevel)) { level = Level.FINEST; } else if ("OFF".equalsIgnoreCase(logLevel)) { level = Level.OFF; } config.setLogConfig(configProps.getProperty("logDirectory"), level); } config.setEngineHome(""); IPlatformContext context = new PlatformServletContext(sc); config.setPlatformContext(context); try { Platform.startup(config); } catch (BirtException e) { e.printStackTrace(); } IReportEngineFactory factory = (IReportEngineFactory) Platform .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY); birtEngine = factory.createReportEngine(config); } return birtEngine; } public static synchronized void destroyBirtEngine() { if (birtEngine == null) { return; } birtEngine.shutdown(); Platform.shutdown(); birtEngine = null; } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } private static void loadEngineProps() { try { // Config File must be in classpath ClassLoader cl = Thread.currentThread().getContextClassLoader(); InputStream in = null; in = cl.getResourceAsStream(configFile); configProps.load(in); in.close(); } catch (IOException e) { e.printStackTrace(); } } }
- org.jboss.seam.pdf.birt.DocumentStoreServlet
package org.jboss.seam.pdf.birt; import java.io.IOException; public class DocumentStoreServlet extends HttpServlet { protected IReportEngine engine; protected IFragment requester; private static final long serialVersionUID = 519600274155718202L; public void init(ServletConfig servletconfig) throws ServletException { super.init(servletconfig); BirtEngine.initBirtConfig(); } @Override protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { new ContextualHttpServletRequest(request) { @Override public void process() throws ServletException, IOException { try { executeReport( request, response); } catch (EngineException e) { log("executeReport error", e); } } }.run(); } void executeReport(HttpServletRequest request, HttpServletResponse response) throws EngineException { //resp.setContentType("text/html"); response.setContentType( "application/pdf" ); response.setHeader ("Content-Disposition","inline; filename=test.pdf"); String reportName = request.getServletPath(); ServletContext sc = request.getSession().getServletContext(); this.engine = BirtEngine.getBirtEngine(sc); IReportRunnable design; try { //Open report design design = engine.openReportDesign( sc.getRealPath("./")+reportName.substring(0, reportName.length() -4) + ".xhtml" ); //create task to run and render report IRunAndRenderTask task = engine.createRunAndRenderTask( design ); task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, DocumentStoreServlet.class.getClassLoader()); //set output options //HTMLRenderOption options = new HTMLRenderOption(); PDFRenderOption options = new PDFRenderOption(); //options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML); options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF); options.setOutputStream(response.getOutputStream()); //options.setBaseImageURL(req.getContextPath()+"/images"); //options.setImageDirectory(sc.getRealPath("/images")); task.setRenderOption(options); //run report task.run(); task.close(); }catch (IOException e){ e.printStackTrace(); return; } System.out.println("Finished"); } /** * Destruction of the servlet. */ public void destroy() { super.destroy(); BirtEngine.destroyBirtEngine(); } }
- Add BIRT pdf servlet to $PROJECT/resources/WEB-INF/web.xml (see attached web.xml).
.... <!-- BIRT PDF servlet --> <servlet> <servlet-name>Document Store Servlet</servlet-name> <servlet-class>org.jboss.seam.pdf.birt.DocumentStoreServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Document Store Servlet</servlet-name> <url-pattern>*.pdf</url-pattern> </servlet-mapping> ...
Make BIRT report
- make sample.xhtml report (rptdesign)
Instantiate Seam component by
... <method name="open"><![CDATA[var reports = Packages.org.jboss.seam.Component.getInstance("sampleReportList", true); reportsIterator = reports.getResultList().listIterator();]]></method> ... <source> sample.xhtml all in one: <source lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.15" id="1"> <property name="createdBy">Eclipse BIRT Designer Version 2.2.1.r221_v20070924 Build <2.2.0.v20070924-1550></property> <property name="units">in</property> <data-sources> <script-data-source name="CustomersFavorite" id="2"/> </data-sources> <data-sets> <script-data-set name="Favorite" id="3"> <list-property name="resultSetHints"> <structure> <property name="position">1</property> <property name="name">Name</property> <property name="dataType">any</property> </structure> <structure> <property name="position">2</property> <property name="name">Version</property> <property name="dataType">any</property> </structure> <structure> <property name="position">3</property> <property name="name">Id</property> </structure> </list-property> <list-property name="columnHints"> <structure> <property name="columnName">Name</property> </structure> <structure> <property name="columnName">Version</property> </structure> <structure> <property name="columnName">Id</property> </structure> </list-property> <structure name="cachedMetaData"> <list-property name="resultSet"> <structure> <property name="position">1</property> <property name="name">Name</property> <property name="dataType">any</property> </structure> <structure> <property name="position">2</property> <property name="name">Version</property> <property name="dataType">any</property> </structure> <structure> <property name="position">3</property> <property name="name">Id</property> <property name="dataType">any</property> </structure> </list-property> </structure> <property name="dataSource">CustomersFavorite</property> <method name="open"><![CDATA[var reports = Packages.org.jboss.seam.Component.getInstance("sampleReportList", true); reportsIterator = reports.getResultList().listIterator();]]></method> <method name="fetch"><![CDATA[if( !( reportsIterator.hasNext()) ){ return( false ); } var report = reportsIterator.next(); row["Name"] = report.name; row["Version"] = report.version; row["Id"] = new Packages.java.lang.Integer(report.id); return ( true );]]></method> <method name="close"><![CDATA[reportsIterator = null;]]></method> </script-data-set> </data-sets> <page-setup> <simple-master-page name="Simple Master Page" id="4"> <page-footer> <text id="5"> <property name="contentType">html</property> <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> </text> </page-footer> </simple-master-page> </page-setup> <body> <label id="46"> <property name="textAlign">center</property> <text-property name="text">Sample Report</text-property> </label> <table id="19"> <property name="width">100%</property> <property name="dataSet">Favorite</property> <list-property name="boundDataColumns"> <structure> <property name="name">Name</property> <expression name="expression">dataSetRow["Name"]</expression> </structure> <structure> <property name="name">Version</property> <expression name="expression">dataSetRow["Version"]</expression> </structure> <structure> <property name="name">Id</property> <expression name="expression">dataSetRow["Id"]</expression> </structure> </list-property> <column id="22"> <property name="width">0.7368421053in</property> </column> <column id="20"> <property name="width">1.458in</property> <property name="repeat">1</property> </column> <header> <row id="23"> <property name="backgroundColor">#FF8040</property> <cell id="28"> <label id="29"> <property name="backgroundColor">#FF8040</property> <text-property name="text">Id</text-property> </label> </cell> <cell id="24"> <label id="25"> <property name="backgroundColor">#FF8040</property> <text-property name="text">Name</text-property> </label> </cell> </row> </header> <detail> <row id="30"> <list-property name="highlightRules"> <structure> <property name="operator">eq</property> <property name="backgroundColor">#E4B07C</property> <property name="color">#000000</property> <expression name="testExpr">row[0]%2</expression> <expression name="value1">0</expression> </structure> </list-property> <cell id="35"> <data id="36"> <property name="resultSetColumn">Id</property> </data> </cell> <cell id="31"> <data id="32"> <property name="resultSetColumn">Name</property> </data> </cell> </row> </detail> <footer> <row id="37"> <cell id="40"/> <cell id="38"/> </row> </footer> </table> </body> </report>
- Add create report button to
$PROJECT/view/sampleReportList.xhtml
- Add create report button to
Invalid language.
You need to specify a language like this: <source lang="html4strict">...</source>
Supported languages for syntax highlighting:
4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, otj, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic
... <div class="actionButtons"> <s:button id="done" value="Create sampleReport" view="/sampleReport.xhtml"/> <s:button id="report" value="Report" view="/sample.pdf?ReportName=report.rptdesign" /> </div> ...
Bon appetit
- Run ant explode, start jBoss app. server
- Cook in oven about 40 minutes & visit restaurant :-)