1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.batch;
17
18 import org.kuali.rice.core.api.datetime.DateTimeService;
19 import org.quartz.CronTrigger;
20 import org.quartz.SimpleTrigger;
21 import org.quartz.Trigger;
22 import org.springframework.beans.factory.BeanNameAware;
23
24 public abstract class TriggerDescriptor implements BeanNameAware {
25 private String name;
26 private String group;
27 private String jobName;
28 private DateTimeService dateTimeService;
29 private boolean testMode = false;
30
31 protected abstract void completeTriggerDescription(Trigger trigger);
32
33 public Trigger getTrigger() {
34 Trigger trigger = null;
35 if (getClass().equals(SimpleTriggerDescriptor.class)) {
36 trigger = new SimpleTrigger(name, group);
37 }
38 else {
39 trigger = new CronTrigger(name, group);
40 }
41 trigger.setJobName(jobName);
42 trigger.setJobGroup(group);
43 trigger.setStartTime(dateTimeService.getCurrentDate());
44 completeTriggerDescription(trigger);
45 return trigger;
46 }
47
48
49
50
51 public void setBeanName(String name) {
52 this.name = name;
53 }
54
55
56
57
58
59
60 public void setGroup(String group) {
61 this.group = group;
62 }
63
64
65
66
67
68
69 public void setJobName(String jobName) {
70 this.jobName = jobName;
71 }
72
73 protected String getJobName() {
74 return jobName;
75 }
76
77
78
79
80
81
82 public void setDateTimeService(DateTimeService dateTimeService) {
83 this.dateTimeService = dateTimeService;
84 }
85
86 protected DateTimeService getDateTimeService() {
87 return dateTimeService;
88 }
89
90 public boolean isTestMode() {
91 return testMode;
92 }
93
94 public void setTestMode(boolean testMode) {
95 this.testMode = testMode;
96 }
97 }