Issue creating dynamic Report
Options
Hi,<br />
I am trying to create a dynamic BIRT Report by using the BIRT Report API.<br />
<br />
Therefore I created a simple reportdesign with a simple ScriptedDataSource. Finally I linked a ScriptedDataSetEventAdapter Java-Class to the report.<br />
<br />
<a class='bbc_url' href='http://imageshack.us'><img src='http://img131.imageshack.us/img131/3623/reportviewhh3.png' alt='Posted Image' class='bbc_img' /></a><br />
<br />
<br />
Then I managed to load the report via the reporting API.<br />
The dynamic created PDF file should now contain the table with the scripted DataSource (filled by the linked ScriptedDataSetEventAdapter). But it looks like no data could be found.<br />
<br />
<a class='bbc_url' href='http://imageshack.us'><img src='http://img235.imageshack.us/img235/9558/scripteddataseteventadawr2.png' alt='Posted Image' class='bbc_img' /></a><br />
<br />
I have got a few questions to this issue:<br />
<br />
1) When the classfile of the ScriptedDataSetEventAdapter could not be found, would I get an exception or would be the missing class file be ignored and the linked data is "only" empty?<br />
<br />
2) Have anyone an idea why the data could not be found?<br />
<br />
3) Are there any good examples available, where I could see how Java Event Handlers could be linked to a reportdesign?<br />
<br />
<br />
Finally, my class who process the BIRT loading (perhaps I have made a misstake here):<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
public class ProcessBIRTReporting {
public static final String PDF = RenderOption.OUTPUT_FORMAT_PDF;
// default engine home
private static final String ENGINE_HOME = "/WEB-INF/ReportEngine";
private final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
private final EngineConfig config = new EngineConfig();
/**
*... cisAdapter = custom adapter which contains httpSession
*/
public ProcessBIRTReporting(Adapter cisAdapter, String outputFormat, BIRTStreamReadable designStream) throws EngineException {
this.configReport(cisAdapter);
this.prepareReport(outputFormat, designStream);
}
/**
* ...
*/
private void configReport(Adapter cisAdapter) {
final HttpSession httpSession = cisAdapter.findHttpServletRequest().getSession();
final ServletContext servletContext=httpSession.getServletContext();
config.setEngineHome(servletContext.getRealPath(ENGINE_HOME));
}
/**
* ...
*/
private void prepareReport(String outputFormat, BIRTStreamReadable designStream) throws EngineException{
final IReportEngine engine = new ReportEngine(config);
final IReportRunnable design = engine.openReportDesign(designStream.getInputStream());
final RenderOption renderOptions = new RenderOption();
renderOptions.setOutputFormat(outputFormat);
renderOptions.setOutputStream(outStream);
this.runTask(design, renderOptions, engine);
}
/**
* ...
*/
private void runTask(IReportRunnable design, RenderOption renderOptions, IReportEngine engine) throws EngineException {
final IRunAndRenderTask task = engine.createRunAndRenderTask(design);
HashMap test = task.getParameterValues();
task.setRenderOption(renderOptions);
task.run();
}
public byte[] getReportAsByteArray(){
return outStream.toByteArray();
}
}
</pre>
<br />
Thanks in advance<br />
Alex
I am trying to create a dynamic BIRT Report by using the BIRT Report API.<br />
<br />
Therefore I created a simple reportdesign with a simple ScriptedDataSource. Finally I linked a ScriptedDataSetEventAdapter Java-Class to the report.<br />
<br />
<a class='bbc_url' href='http://imageshack.us'><img src='http://img131.imageshack.us/img131/3623/reportviewhh3.png' alt='Posted Image' class='bbc_img' /></a><br />
<br />
<br />
Then I managed to load the report via the reporting API.<br />
The dynamic created PDF file should now contain the table with the scripted DataSource (filled by the linked ScriptedDataSetEventAdapter). But it looks like no data could be found.<br />
<br />
<a class='bbc_url' href='http://imageshack.us'><img src='http://img235.imageshack.us/img235/9558/scripteddataseteventadawr2.png' alt='Posted Image' class='bbc_img' /></a><br />
<br />
I have got a few questions to this issue:<br />
<br />
1) When the classfile of the ScriptedDataSetEventAdapter could not be found, would I get an exception or would be the missing class file be ignored and the linked data is "only" empty?<br />
<br />
2) Have anyone an idea why the data could not be found?<br />
<br />
3) Are there any good examples available, where I could see how Java Event Handlers could be linked to a reportdesign?<br />
<br />
<br />
Finally, my class who process the BIRT loading (perhaps I have made a misstake here):<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
public class ProcessBIRTReporting {
public static final String PDF = RenderOption.OUTPUT_FORMAT_PDF;
// default engine home
private static final String ENGINE_HOME = "/WEB-INF/ReportEngine";
private final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
private final EngineConfig config = new EngineConfig();
/**
*... cisAdapter = custom adapter which contains httpSession
*/
public ProcessBIRTReporting(Adapter cisAdapter, String outputFormat, BIRTStreamReadable designStream) throws EngineException {
this.configReport(cisAdapter);
this.prepareReport(outputFormat, designStream);
}
/**
* ...
*/
private void configReport(Adapter cisAdapter) {
final HttpSession httpSession = cisAdapter.findHttpServletRequest().getSession();
final ServletContext servletContext=httpSession.getServletContext();
config.setEngineHome(servletContext.getRealPath(ENGINE_HOME));
}
/**
* ...
*/
private void prepareReport(String outputFormat, BIRTStreamReadable designStream) throws EngineException{
final IReportEngine engine = new ReportEngine(config);
final IReportRunnable design = engine.openReportDesign(designStream.getInputStream());
final RenderOption renderOptions = new RenderOption();
renderOptions.setOutputFormat(outputFormat);
renderOptions.setOutputStream(outStream);
this.runTask(design, renderOptions, engine);
}
/**
* ...
*/
private void runTask(IReportRunnable design, RenderOption renderOptions, IReportEngine engine) throws EngineException {
final IRunAndRenderTask task = engine.createRunAndRenderTask(design);
HashMap test = task.getParameterValues();
task.setRenderOption(renderOptions);
task.run();
}
public byte[] getReportAsByteArray(){
return outStream.toByteArray();
}
}
</pre>
<br />
Thanks in advance<br />
Alex
0
Categories
- All Categories
- 111 Developer Announcements
- 49 Articles
- 103 General Questions
- 123 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 123 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 1 XM Fax