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

custom code before running a report


al_ryder

Recommended Posts

Hi,

I'm trying to figure out how to run some custom code before a report gets run. Specifically when a user clicks on a report with an input control, after the input control value  is selected and before the report is actually run with that input control value; I want to do some server side validation of the input contol value before it's passed to whatever method runs the actual report.

I was thinking about wiring up some kind of method interceptor via acegi, but is there already some kind of 'hook' into this method via an existing spring bean?

 

Thanks

 

Alan

 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

From within a Jasper Report, you can call a 'Jar file Scriptlet', which could then maybe do what you want to do. I believe you can pass in params at that point if I remember correctly (I would have to go dig for it) - but that is where I suggest you start looking as it seems the most logical place to me to inject any Java logic within the report, not try to hook into the server itself or even the security layer.

This is how I manipulated some params in one report I did.

You can google this or you can find it in various docs/books (Heffelfinger's book has a section on it).

If you want to hook into the JS web page where a user enters params and give them feedback there then maybe you are back to playing with the server code or intercepting the method call as you mentioned.
http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRDefaultScriptlet.html



Post Edited by developerdude at 10/15/2009 16:44
Link to comment
Share on other sites

Thanks developerdude,

I should probably have detailed the context of my question better. Basically we have a situation in which different jasper users belong to multiple departments. We have one report which shows financial reporting per department. We have an input control which displays a list of departments that the user is able to run the report for. So once the user selects the department, the viewReportFlow takes care of running this report.

The thing is, there is a major security flaw with my approach as a user can stick a proxy in between the browser and the Jasper Server application and change the department code to whatever he/she wants. In order to enforce the client side validation rules I also need to revalidate them at the server side, so hence I want to put some code at the server side which validates that the current logged in user actually has access to the department code that he's asking to run the report for.

 

Cheers

 

Alan

 

 

 

Link to comment
Share on other sites

Oh, okay, then it sounds appropriate if you have to use Acegi to intercept the method invocation. I thought you were just using it to validate a param to a report, like checking a date range or something.

I haven't played with that area of JS much at all. My integration with it is limited to two things: an external process that grabs report results via the web services and puts them on an FTP server, and a tweak to the report filling code to send an email notification when no data is found for a report. We don't use JS as a 'public' BI solution, we use it to run automated reports we write and manage.

Beyond that, all I have done is create a configuration for the Acegi beans that integrates with LDAP/Active Dir, so we can eventually have our internal users log into it.



Post Edited by developerdude at 10/16/2009 08:48
Link to comment
Share on other sites

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...