Skip to content

Scheduled Jasper Server Job isn't passing parameters #79

@paawak

Description

@paawak

Hello,

We are using the jrs-rest-java-client, version 5.5.0 (https://github.com/Jaspersoft/jrs-rest-java-client ) to schedule a
Job on the Jasper (Tomcat) Server. The problem is, though the job is created on the server, the report parameters are
all null.

This is the client code:

private Session clientSessionForAsynchronousRequest;

private void scheduleJob(String reportUri, Map parameters) {
    Job job = new Job();
    job.setLabel("New Job for ISS Report");
    job.setDescription("New Job for the report template: " + reportUri);
    JobSource jobSource = new JobSource();
    jobSource.setReportUnitURI(reportUri);

    jobSource.setParameters(new HashMap(parameters));
    job.setSource(jobSource);
    Set outputFormats = new HashSet();
    outputFormats.add(OutputFormat.PDF);
    outputFormats.add(OutputFormat.XLSX);
    job.setOutputFormats(outputFormats);
    RepositoryDestination repositoryDestination = new RepositoryDestination();
    repositoryDestination.setSaveToRepository(true);
    repositoryDestination.setFolderURI("/scheduled_reports");
    job.setRepositoryDestination(repositoryDestination);
    SimpleTrigger trigger = new SimpleTrigger();
    trigger.setStartType(SimpleTrigger.START_TYPE_NOW);
    trigger.setOccurrenceCount(1);
    trigger.setRecurrenceInterval(0);
    trigger.setRecurrenceIntervalUnit(IntervalUnitType.DAY);
    job.setTrigger(trigger);
    job.setBaseOutputFilename("portiss_report" + System.currentTimeMillis());

    clientSessionForAsynchronousRequest.jobsService().scheduleReport(job);

}

However, we have a bad work-around, by changing the JobsService in jrs-rest-java-client. The above code works if I replace:

long jobId = clientSessionForAsynchronousRequest.jobsService().scheduleReport(job);

With:
long jobId = clientSessionForAsynchronousRequest.jobsService().scheduleReportWithHack(job);
// long jobId = clientSessionForAsynchronousRequest.jobsService().scheduleReport(job);

Also, I have forked the project on git-hub, and you will find my changes here:
https://github.com/paawak/jrs-rest-java-client

Thanks,
Palash.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions