Home
Analytics
ODA from POJO
ozyman
Hello all,
I'm a little confused about using the RE/DE APIs to build a report. I'm trying to build a dynamic report from POJO. I went through the tutorials available and I figured out using RE/DE APIs is the best way for me.
But the problem seems to be that all RE/DE examples I've seen use an ODA from a database. How can I build a custom ODA from POJO? Once I have ODA, building a report is fairly simple.
Another problem is that my POJO has no template/fixed structure. All the POJO examples assume a fixed template.
Any piece of code would be great.
Thanks in advance,
Find more posts tagged with
Comments
thuston
<blockquote class='ipsBlockquote' ><p>Another problem is that my POJO has no template/fixed structure. All the POJO examples assume a fixed template.</p></blockquote>
What does this mean? You need to have a consistent way of returning values that can be interpreted as a relational table resultset.<br />
<br />
Actuate BIRT 11 (2.6) comes with a POJO ODA.<br />
With the POJO ODA you map get()er functions as dataSet columns.<br />
For each "row" (next()) each of the linked "column" functions will be called once.
ozyman
<blockquote class='ipsBlockquote' data-author="'thuston'" data-cid="71821" data-time="1293807251" data-date="31 December 2010 - 07:54 AM"><p>
What does this mean? You need to have a consistent way of returning values that can be interpreted as a relational table resultset.<br />
<br /></p></blockquote>
<br />
Actually the system returns a data structure, which contain the list of columns and list of rows(values) and the report should be built based on these values. These columns/rows depend on the user interaction(in another module), hence I can't specify any pre-determined structure. How can I specify BIRT to take this data structure as a grid? And there will be multiple(list) of this data structure, so I can I specify to BIRT to take this list as data set? <br />
<br />
Is there anyway this can be done? Or can BIRT have an ODA strictly only from a POJO?<br />
<br />
Thanks in advance,
ozyman
I did some search and I stumbled upon this example
http://wiki.eclipse.org/Java_-_Build_Dynamic_Table_(BIRT)
This is more or less what I'm searching for. But I would like to know how to build the data source and data set
as I explained previously. More precisely, how to specify java class as data source and how to build data set from the data in the java class(This java class is not a strict POJO)?
I can't even seem to find javadoc for the odadataset/odadatasource. Any pointers anyone?
Thanks in advance,
thuston
A dynamic number of columns is not easy to deal with as a relational structure.
If that is what comes back, you shouldn't use an ODA. Since you'll have to dynamically modify the layout too, just do everything in code.
I think others have done this and may be able to point you to an example.
johnw
What your asking can be done. Its a little tricky, but it is possible. As long as the java class is in your classpath, you can use the scripted data source, and specify the fetch event programatically to pull from your POJO. So, in your outside RE/DE API program, you would get that structure, and then specify your data set columns in the Scripted Data Set that you would create programatically.
If your program returns an object that specifies that structure, great, you can go from that and just add. Otherwise, your looking at doing some really heavy work with the Java Reflection API's in order to get that structure. You can also do your programatic approach strictly in the initialize event of your report. But once you get into building reports using the DEAPI, your losing the designer. Is there really a compelling reason to use BIRT for your report in this scenario?