Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
As an example, we will build a batch-reporting facility that generates to-do reports and e-mails them to the user nightly. We will leverage a couple of services created in earlier chapters: EMailAuthenticatedService from Chapter 8 and ReportService from Chapter 10. Figure 11-1 shows is an overview of the nightly reporting process.
Figure 11-1. Nightly reporting process
The process starts with the NightlyReportJob. When the NightlyReportJob is invoked by Quartz, it immediately invokes the BatchService. The BatchService is the main control routine. It facilitates the interaction with other solution components. First, the BatchService retrieves all User objects that have an e-mail address. For each user, the BatchService retrieves the Todo objects. The BatchService then uses the ReportService to generate a PDF report. Finally, the BatchService uses the EmailAuthenticatedService to send the user an e-mail attachment of the report.