Jump to content
We've recently updated our Privacy Statement, available here ×

ReportDataSourceService


jgardner16

Recommended Posts

Hi,

I have a report that uses a JavaBean set datasource in Ireport and works fine the javabean returns a Collection. Is it possible to do this in JasperIntellegence by implementing ReportDataSourceService and if so how do I do this? If not is there another way to use a javabean datasource with JasperIntellegence.

 

 

thanks

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

You can plug-in your ReportDataSourceService implementation as data source for a report by defining a Spring bean data source.

 

You would need to:

 

  • Implement ReportDataSourceService

    Code:

    public class MyDataSourceService implements ReportDataSourceService {
    ..
    }

  • Write a factory bean for MyDataSourceService, including all the properties needed to create a MyDataSourceService instance

    Code:
    [code]
    public class MyDataSourceServiceFactory {
    private String prop1;
    private String prop2;
    //property setters
    public MyDataSourceService createDSService() {
    //use the props to instantiate the service
    return new MyDataSourceService(prop1, prop2);
    }
    }

Configure a factory bean in Spring. You could do this using a file named applicationContext-myDataSource.xml placed under WEB-INF.

Code:
[code]
<bean id="myDataSourceServiceFactory" class="MyDataSourceServiceFactory">
<property name="prop1" value="value1"/>
<property name="prop2" value="value2"/>
</bean>

Create in JI a bean data source, having myDataSourceServiceFactory as bean name and createDSService as method name.

Select the bean data source when creating the report unit.[/ul]

 

Regards,

Lucian

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...