The scheduler runs reports in the background according to a user-defined schedule (also called a job). You can configure the following aspects of the scheduler:
• | Restricting File System Output |
• | Removing Report Scheduling Interval Options |
• | Adding a Holiday Exclusion Calendar |
Restricting File System Output
The scheduler outputs reports through several channels. Most reports are emailed, but reports can also be written to FTP folders. You can also configure the scheduler to write reports to the server's local file system. This option is disabled by default for security reasons.
|
If you turn on scheduler file system output, make sure you have configured user and folder access rights to make sure that malicious files cannot be written to your file system. The process that writes the files is the same user that runs the application server that hosts JasperReports Server. |
Scheduler File System Output |
|
Configuration File |
|
...\WEB-INF\applicationContext.xml |
|
Property to Update |
Description |
enableSaveToHostFS |
Set the value from "false" (the default) to "true". When true, the user interface for the scheduler displays active fields that allow the schedule creator to specify a folder in the server's file system. The scheduler will write files to this location every time it runs the schedule for this report.
This property also determines the scheduler's overall access to the file system. When true, any schedule configured with a file system folder will write to the file system. When false, no scheduled reports will write output to the file system (FTP and email output are not affected). However, any file system output specified in a schedule remains defined and will again trigger file system output when this property is true again. |
Removing Report Scheduling Interval Options
When users schedule reports, they can specify that the report run periodically at regular intervals. For simple recurrence, the default interval can be expressed in days, hours, or minutes. If it is necessary to prevent users from scheduling frequent reports, you can limit the intervals to days or hours by editing the following configuration file:
Scheduling Interval Options |
|
Configuration File |
|
...\WEB-INF\flows\reportJobBeans.xml |
|
Section to Update |
Description |
recurrenceIntervalUnits |
Comment out the intervals you want to disable. |
To remove a temporal interval, enclose the corresponding bean in comment characters. For example, to keep users from scheduling reports at minute intervals, comment out the bean containing the INTERVAL_MINUTE field:
<!-- <bean class="com.jaspersoft.jasperserver.war.dto.ByteEnum"> <property name="code"> <util:constant static-field="com.jaspersoft.jasperserver.api.engine.scheduling. domain.ReportJobSimpleTrigger.INTERVAL_MINUTE"/> </property> <property name="labelMessage"> <value>job.interval.unit.minute.label</value> </property> </bean> --> |
Adding a Holiday Exclusion Calendar
The scheduler support exclusion calendar that specify days or times when no report should be run, even if the schedule is triggered then. For example, you might not want a report to run on a bank holiday when the financial data would be meaningless.
The scheduler maintains a list of named calendars, and the user interface allows the schedule creator to select a calendar whose dates will be excluded from the schedule.
Currently, the only method to define a holiday calendar is through the REST API. You can use any browser plug-in that acts as a REST client and can send PUT requests to JasperReports Server. Using such a plug-in, compose and send the following REST request (header and body) to your server:
PUT http://<host>:<port>/jasperserver[-pro]/rest_v2/jobs/calendars/2014FrenchHolidays Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <reportJobCalendar> <calendarType>holiday</calendarType> <description>2014 French Holidays</description> <excludeDays> <excludeDay>2014-01-01</excludeDay> <excludeDay>2014-04-18</excludeDay> <excludeDay>2014-04-21</excludeDay> <excludeDay>2014-05-01</excludeDay> <excludeDay>2014-05-08</excludeDay> <excludeDay>2014-05-29</excludeDay> <excludeDay>2014-06-09</excludeDay> <excludeDay>2014-07-14</excludeDay> <excludeDay>2014-08-15</excludeDay> <excludeDay>2014-11-01</excludeDay> <excludeDay>2014-11-11</excludeDay> <excludeDay>2014-12-24</excludeDay> <excludeDay>2014-12-25</excludeDay> </excludeDays> <timeZone>GMT+01:00</timeZone> </reportJobCalendar> |
For example, using the Poster plug-in for Firefox, you can submit this request as shown in the following figure. The figure also shows the successful reply from the server.
|
Creating a Holiday Calendar with REST Web Services |
Then you should see your new calender in the list of calendar in the Schedule tab.
|
Selecting a Custom Holiday Calendar in the Scheduler |
The REST API supports other types of calendars, however, the user interface only lists the calendars of type holiday. Using the REST API, however, you can create and manage any number of calendars and update any schedule to use them. For more information, see the JasperReports Server Web Services Guide.