[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[birt-report-designer-dev] Trouble with Scripted data source: Java API getting invoked multiple times

Title: Trouble with Scripted data source: Java API getting invoked multiple times

Hi All,
I am using a scripted datasource to talk to the Hibernate layer via a Java API. I noticed that the call from the reportengine to the Java API happens more than once, before the data is displayed completely. This leads to a performance bottleneck for the reports. Can you please guide me what am I doing wrong here?

The following is my environment:
birt-runtime-2_3_0
Hibernate 3.2
And here is my code:

 <method name="open">
 <![CDATA[reportGenerator = new Packages.com.xxx.BirtReportGenerator();
reportData = reportGenerator.getPublishedApprovals(params["AAA"].value, params["BBB"].value,params["CCC"].value);
iter = reportData.iterator();]]></method>

<method name="fetch">
<![CDATA[if(!iter.hasNext()){
        return false
}
else{
        report = iter.next();
        dataSetRow["analystHeader"]=report.getAnalystHeader();
        dataSetRow["securityHeader"]=report.getSecurityHeader();
        dataSetRow["sortHeader"]=report.getSortOrder();
        dataSetRow["genHeader"]=report.getGenerated();

        dataSetRow["expiry"]=report.getPublishedDate();
        dataSetRow["security"]=report.getSecurity();
        if(report.getDetails()!=null){
                detailsIterator = report.getDetails().iterator();
                if(detailsIterator==null||!detailsIterator.hasNext()){
                        return false;
                }else{
                        var detailInfo = detailsIterator.next();
                        dataSetRow["type"] = detailInfo[0];
                        dataSetRow["from"] = detailInfo[1];
                        dataSetRow["to"] = detailInfo[2];
                        dataSetRow["comments"] = detailInfo[3];
                }
        }
        return true;
}]]></method>
<method name="close">
<![CDATA[iter = null;
reportData =null;
reportGenerator =null;]]>
</method>
</script-data-set>


Regards,
Abhilash John