Migrate Jasperreports IMOBjectCollections from JRDatasource to JRRewindableDataSource.

Our current implementation of jasperreports implements datasources as a Collection of IMObjects stored as an iterator.  Iterators by nature are not resetable unless you have access to the original dataset in which case you can simple overwrite the variable to reset it.  

It may be better to switch the implementation to cover JRRewindableDataSource, which requires to the moveFirst() method to be implemented.

This would mean that all subreports that use a Dataexpression to generate the datasource as opposed to a sql datasource will be presented with a datasource that can navigate a page break - currently they do not.

I have reported this issue here before but I was using a custom report.  However a user of 1.6 is reporting it now using the default reports.

http://www.openvpms.org/forum/monthly-statement-printing-error

http://www.openvpms.org/forum/error-when-doing-statements.-what-does-mean

http://www.openvpms.org/forum/custom-statement-wont-print-certain-custom...

here is the new implementation

http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRR...

 

The quick fudge for this is changing the iterator to a ArrayList before passing it to the collection and storing it there as an ArrayList.  Effectively in movefirst you can just replace the iterator with the original array. 

It would probably be better to rewrite the module getting rid of the iterator all together and working of an ArrayList using its methods to move throw the datacollection.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Migrate Jasperreports IMOBjectCollections from ...

In order to support JRRewindableDataSource, the various IMReport methods that take an Iterator should be changed to Iterable instead.

Re: Migrate Jasperreports IMOBjectCollections from ...

Thanks tim - learning every day - is your opinion that this change is beneficial to the wider community or a localised issue?

I am building a version changed to Rewindable now - if it tests fine I will submit a patch..

In Intellij I am finding it hard to see class error after making interface changes....in Netbeans the package gets given an error icon indicating it has a compilation error on the fly, in Intellij I find I am having to search for references and update them...and if I miss one I have to start the build again..any tips for speeding my errorchecking after making a change.

 

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Migrate Jasperreports IMOBjectCollections from ...

Hi Ben - feel free to submit a patch.

IntelliJ should display packages that have errors underlined in red, both in the Project explorer, and in the package navigation above it.

The fastest way to change the methods is to use Refactor -> Change Signature (Ctrl-F6) and change Iterator to Iterable. You can then use Find-Usages (Alt-F7) to locate the callers and update them accordingly.

-Tim

Syndicate content