Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Passing real data to POJO datasource / DataSet
bchicos
<p>Hello, </p><p> </p><p>I have seen some examples of using the new POJO datasource / dataset introduced in BIRT 4.3 with mock data that is hardcoded in the pojo data set class. </p><p> </p><p>This is shown in a demo video and listed in the following blog on new features in BIRT 4.3</p><p> </p><p><a data-ipb='nomediaparse' href='
http://www.birt-exchange.com/be/download/demos/PojoDataSource.mp4'>http://www.birt-exchange.com/be/download/demos/PojoDataSource.mp4</a></p><p> </p><p><a
data-ipb='nomediaparse' href='
http://www.birt-exchange.org/forum/index.php?/blog/14/entry-494-a-look-at-the-new-features-in-birt-43/'>http://www.birt-exchange.org/forum/index.php?/blog/14/entry-494-a-look-at-the-new-features-in-birt-43/</a></p><p> </p><p>I
am not clear however on how to pass the real POJO data from my application (let's say my servlet which calls a bunch of services to create the POJO's). I was planning on using the report engine API in order to pick the appropriate report and set the pojo's somewhere such that the report loads that data and not the mock data. </p><p> </p><p>I've yet to see any examples or discussion around how to do this though. The documentation on POJO datasource / dataset seems to be pretty minimal. </p><p> </p>
Find more posts tagged with
Comments
gustavomonarin
<p>HI bchicos,</p><p> </p><p>Do you have any news about your doubt?</p><p> </p><p>I just started to look into birt for a small personal project and I haven't found a clear documentation as well, beside a couple of books that looks quite outdated...</p><p> </p><p>I haven't developed anything using this POJO datasource, but having a look in the interface, the method open receives a parameter that is the context. In my case I am planning to put my spring application context in the birt context, so in the method open, would be quite simple to retrieve my service bean from the context and call the java code that retrieves my model objects... and i think it would answer your question in a simplest way. In my case i am still looking around because I don't want to write a dataset java class for each object model...</p><p> </p><p>the signature of IPojoDataSet</p><p> </p><div>/**</div><div>* Open this POJO data set.<p></div><div>* Generally for initialization work. Called before POJO ODA driver begins to fetch POJO objects</div><div>*
@param
appContext: application context used by this POJO data set</div><div>*
@param
dataSetParamValues: <name, value> parameter pairs of this data set. An empty map will be passed in if this data set is with no parameter.</div><div>*
@throws
OdaException</div><div>*/</div><div>void open( Object appContext, Map<String, Object> dataSetParamValues ) throws OdaException;</div><div> </div><div>Regards</div>
gustavomonarin
<p>Hi, BChicos,</p><p> </p><p>Please have a look in the org.eclipse.birt.data.oda.pojo.impl.Query class in the getPojoDataset...</p><p> </p><p>In the window where you configure you dataset, in the Pojo Dataset properties, you pass a static dataset(mock) and also an application context key. What the pojo ODA does is, first it looks in the context by the key that you specified as a collection, iterator etc... only if this key is not set the mock the class that has the hardcoded values is used.</p><p> </p><p>So basically what you have to do is ensure that in the production the key that you configured is set with the list of real data...</p><p> </p><p>Regards</p>