Reporting framework for Java spring web application - java

Am working on a java spring web application. I want to implement reporting features for it. the main feature i want to implement in reporting is that i should be able to select some parameters. depending on that the reports should be generated. Parameter selection mean: i select 2 dates and the report should be generated for the data within those 2 dates. this is just an example. can anyone suggest me on what i should be using?

Taking off from your question in the comments section on using parameters in JasperReports:
4.1. Parameters
Parameters are useful for passing data to the report engine that it can not find > in its data source or when data changes depending on different runtime > > conditions.
We can also change portions or even the entire SQL query with parameters received > in the report filling operation.
The section 4.1 of blog should help you with creating a query statement with the parameters.

Related

Adding values to a BIRT report through servlet

Please before you say its repeated please understand my problem.
Im developing Java EE 8 application which makes use of BIRT to generate a pdf and send it on to client. I've already completed report design, and webpages to take the data, and also servlets to process render and send the generated pdf(generic).
But i want to add the data received from the request directly to the generated pdf ie without adding them to a database(so i cannot add the values by binding data source).Ive even added the names in report design to enable me to add values at run time.
Ive seen How do you set and pass a parameter to a BIRT report created by the BIRT Report Designer through the BIRT API? and understood idea there but my problem is i have date columns in my design which has to be set as well.
What im hoping with this question is
A simple example to the provided solution in the linked post.Or a
better solution if present.
Which is the class which can populate the BIRT-date since java.util.Date is deprecated.
And to know if BIRT api provides way to manuplate the report elements via name or id in a servlet or a model java class.
thankyou for your help
forgiving me if i have bored you with a long question.
Ashwin
Why don't you just consider using a string representation of the date values instead?

How to generate a dynamic report in java

I am doing a project for a clinical laboratory. I am using java, hibernate and SQL Server for my project. In some cases I need to generate reports on results of the particular Lab tests, for each tests the format of report differs.It is impossible to create predesigned forms for all the tests. So in this case the freedom of designing the form for test report should be given to the user of the application and this report format is mapped to each tests, so that when the application runs the report should be generated dynamically according to the mapped report format of the test. Can anyone help me to suggest a method for doing this(Here the report format is designed by user by using drag and drop facility, because the user is not technically skilled to do it by coding.The designed form can be mapped to a particular test by the user and the report is generated according to the uploaded format by filling the data of particular test taken from database). Thanks in advance.
Microsoft SQL Server provides a reporting service component (SSRS). Reports could be designed by the user in a desktop tool called Business Intelligence Studio*. This tool allows the user to drag and drop UI components to generate a template file. The template file contains two important details - data source details to fetch data & the format of the report to be displayed.
The template file is then uploaded on the report server. A report is generated from this template dynamically when needed. Dynamically here refers to the fact that the data to be displayed in the report is fetched at runtime when the request for report generation is made.
The template file can also accept Report Parameters which could help to generate multiple variants of the report for one template file. There are various other SSRS features which you could browse through.
SSRS dynamically report generation capability seems to suit the requirements you mention above.
SSRS also has exposes web services through you can integrate your application with SSRS. There are web service methods for uploading a template and rendering a report.
*There are web based alternatives too. One of them is cizer.

Avoid Data Cache after generating report with embedded Pentaho Report Designer Classic Engine

I'm using Vaadin 6.8 and pentaho classic engine 5.0.1 embedded to my application. I've successfully generated the reports in the formats required and with parameters established. The issue comes when I noticed that after generating the report, there is something like a data-cache that doesn't allow me to get updated data from the datasource (MySQL jdbc in report definition). The report generator is generating new files, but the data is not updated because of this cache, it means that, different files are generated with the same data content, even when I update it directly in the database. I'm forced to close my vaadin application and generate the reports again to get the update on the report data, but I cannot close the user session every time to get it working as requirement.
After many days I've found this, where it explains that disabling data-cache is enough to avoid that problem:
http://forums.pentaho.com/showthread.php?82765-Engine-3-8-disable-data-caching
I've tried to set that config-key via my java classes, but I don't know how to set that key, so I decided to search more about this, and in the next link, says that is possible but using a BI-server.:
http://infocenter.pentaho.com/help/index.jsp?topic=%2Fperformance_tuning_guide%2Ftopic_reporting_caching.html
My application runs alone in a server, and I can't use the BI-server as I only need the report generator, that's the purpose of using embedded report generator. How can I set that config-key via Java classes or in a way that I can handle all in my Java application? or how can I avoid data-cache on report generation with classic engine?
The only way I've found to avoid data-cache without a global config-key is to define data-cache = false at Pentaho 's Report Designer Master Report attributes while editing a report.

Configuring & Generating BIRT Reports Dynamically

From watching the 2-part YouTube videos and perusing the BIRT manual, my understanding of it is the the worflow goes something like this:
Create a new Report in Eclipse
Use the BIRT Report Designer (Eclipse plug-in) to design a report
Populate the report with Data Sources (JDBC drivers & databases) and Data Sets (specific tables)
Generate/export/print the report
As cool as this tool seems to be, I cannot find any documentation that leads me to believe that this is a Java tool and not an Eclipse-only tool (meaning, it has a Java API and can interact with Java apps, as opposed to a pure Eclipe plug-in which requires manual/human interaction from the Eclipse IDE.
Specifically, I want to confirm that BIRT either can or cannot do the following:
Configure a report (layout, UI widget placement, data sources/sets, etc.) programmatically; i.e. in the same way that JasperReport API has the iReport designer that generates JRXML, is the same true for BIRT?
Kick off a report "generation" through a Java API whereby data gets read-in realtime and populates the report and the report can be sent out or stored on a file system
Create HTML and PDF versions of the same report
Answers to your questions:
Yes. BIRT may not be as powerful as JasperReports, but it can achieve most of the common needs.
BIRT designer generates a .rptdesign file similar to JRXML in JasperReports.
About your question: almost everything is possible to achieve programmatically in BIRT. BIRT Report Engine APIs is the best source for you to get started with all the functionalities you have mentioned. It has good examples given for every functionality.
Not sure. BIRT usually fetches pre-saved data from DB and generates the report. You could though see the real time data representation (in the form of a flash chart may be) with the help of some external libraries (See if this thread and this example helps). But I am not aware of a direct way of converting the real time data to PDF/HTML report. You will have to find some hack(s).
Yes of course. Refer the APIs. To be specific, irendertask.
Sources to get more information/answers:
There are several example reports given on the website. A quick glance through them might give you more insights.
For discussions and troubleshooting, refer eclipse community forum and BIRTExchange (heavily used by BIRT users).
BIRT: A Field Guide to Reporting is an excellent book. I've used it myself from time to time.
I can confirm that the two BIRT components you are interested in using (BIRT Design Engine and Report Engine) will work in a pure-Java context and are deployable without Eclipse. I have deployed BIRT reports to run out of standalone Tomcat servers as well as Pentaho BI Server, and have exercised report definitions at the command line using shell scripts (no Eclipse involved).
Answers to your questions:
Configure a report programmatically: use the Design Engine API. I am not familiar with the Jasper Reports API so cannot comment on whether the BIRT method is similar, but the example code provides a good illustration. In particular, note lines 120-133 which add and manipulate widgets in the report, and how line 136 calls saveAs to save the report design file.
Generate a report in realtime: use the Report Engine. The sample code for the IRunAndRenderTask may be the most useful for you at first, but the engine has the ability to separate the data processing (extract and aggregate) of the report from the rendering and paging. I believe the examples focus on running reports from a Servlet, but it is easy to extract that logic from the servlet container logic.
Create both HTML and PDF versions: easily handled in the Report Engine via the IRenderTask. Once you've been through all the other setup work, changing the output format to produce PDF vs HTML is something of a joy. In my experience, it just works.
I found it useful to start out with a very simple Java class (adapted from the very old code here) to run a test report, called from the command line.
you can use the report engine API to configure reports:
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php#ireportrunnable
You can create HTML or PDF versions of a report by setting a variable in the url to generate the report or if using the report engine programmatically:
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php#irendertask
We use Eclipse to build and design reports. The report engine is deployed as part of a reports_war, the war has its own connection to the database. Our Java based web application uses urls to interact with the report templates (variables are set in the urls).
The BIRT Exchange is a good place for more information
There is not much difference between Birt and jasper as designing point of view except birt have eclipse plugin.
1)yes,you can configure it by java program or methods.
2)yes,this is possible.
3)yes again for export your report in different formats is easy for birt report by java
BIRT is a good and easy tool fro report generating.
you can design your pages in BIRT.
-
Create datasets and can pass the values from your web pages to your BIRT design using jsp tag lib.
BIRT fulfills all your requirement. Its so easy to use. first i use jasper, then tried crystal atlast Birt gies the output.
tag lib
i refer this link to view BIRTVIEWVER in my web page. PDF creation is so perfect in BIRT. You can generate PDF, DOC, HTML also.
you can pass values to your birt . while creating dataset there is option for passing params.
to do all this you have to install BIRTREPORT inyour eclipse BIRT Report designer

Integrating Pentaho/Talend/etc. with an OR Mapper

We have an application (Java) with an own OR mapper. Within this system we have what can be compared to Hibernate's interceptors (we call it triggers): Do specific actions just before saving data in the database, after it's deleted and so on. The underlying database is MySQL.
Now we would like to use tools such as Pentaho Data Integration or Talend to convert data to put it into our system. It's no problem to do that directly on the SQL level, but by doing so we loose the built-in power of our triggers.
Is there a way to somehow integrate any of the Data Integration solutions into our existing application? It would be great if there was a way to write into instances of our classes instead of writing into the database directly.
Any hints welcome :-)
I'd prefer Talend which is a Java code generator tool. (You can se my blog post at http://www.robertomarchetto.com/www/talend_studio_vs_kettle_pentao_pdi_comparison)
You could use a tJavaRow so you can write Java code for each processed row. In tJavaRow you can call Hibernate code, for example using a custom class defined in a new routine.
2 ways with Pentaho data integration I can think of straight off:
Simply create a plugin which adds/deletes data - you could copy the existing salesforce insert/update plugins, they would be a good start - rip out all the salesforce code and replace with yours.
Perhaps harder; But maybe more satisfying - Write a jdbc driver which uses your code!

Categories