1
2
3
4
5 package org.directdemocracyportal.democracy.service.governmentloader;
6
7 import org.quartz.Job;
8 import org.quartz.JobExecutionContext;
9 import org.quartz.JobExecutionException;
10 import org.quartz.SchedulerException;
11 import org.springframework.context.ApplicationContext;
12
13 /***
14 * The Class GovernmentImporterJob.
15 */
16 public class GovernmentImporterJob implements Job
17 {
18
19
20
21
22
23
24 public void execute(JobExecutionContext jobContext)
25 throws JobExecutionException {
26 GovernmentImporter governmentImporter = null;
27 try {
28 ApplicationContext ctx = (ApplicationContext) jobContext
29 .getScheduler().getContext().get("applicationContext");
30 governmentImporter = (GovernmentImporter) ctx
31 .getBean("swedishGovernmentImporter");
32 } catch (SchedulerException e) {
33 e.printStackTrace();
34 }
35
36 if (governmentImporter != null) {
37 governmentImporter.doImport();
38 }
39 }
40 }