But luckily JasperServer comes with its web services. Specially the "Repository" web service to administrate the resources in the JapserServer repository and "ReportScheduler" web service to work with all the scheduled jobs in JasperServer. the wsdls for these web services can be found in the following locations respectively,
http://
http://87.253.130.134:8083/jasperserver/services/ReportScheduler?wsdl
I created a custom web part for sharepoint that has mainly two interfaces. The first to list all the schedules that is currently on JasperServer and the second, once you click on a particular schedule it will display details of the schedule also a button to re-run that job, I recall, re-run it with one click.
This is simple. ReportScheduler web service has several methods, together which will achieve this.
The main method that is used in the webserivce to create a scheduled job is "scheduleJob()" This requires an object of type "Job" as its input parameter. Job object contains all the detail of a JasperServer scheduled job such as, reportUnitURI, baseOutputName, Email....etc.
So how to re-run an existing schedule?
First you need to get the job id of the scheduled job you need to re-run. and use the GetJob() method, which requires jobid as its input param. This method will return an Job type object which represent the scheduled job of the given jobid. you can get a copy of this Job type object but with a bit of change. There are two types of calendar triggers you can create. Calendar Trigger and Simple Trigger. you can create an new object of type Simple Trigger and make the Star Date/Time and End Date/Time null. Then you need to set this simple trigger as the copied Job type object's simple trigger. Now you have a Job object with a simple trigger that has null start and end dates.
Now you can call the method ScheduleJob() and pass your job object to it which will create a new Run Now job but with all the details of the old job. you can create a button and do this creating new job thing in it's event handler class.
This is just an overview of what I did to implement Re-Run functionality on SharePoint which is not provided out of the box by JasperServer. Hope this helps and below are some screenshots of my simple webpart,
Cheers!
No comments:
Post a Comment