1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.miloss.fgsms.auxsrv;
23
24 import org.quartz.JobDetail;
25 import org.quartz.Scheduler;
26 import org.quartz.SchedulerException;
27 import org.quartz.Trigger;
28
29
30
31
32
33 public class AuxConstants {
34
35 public static final String VERSION = "7.0 BUILD";
36 public static final String QUARTZ_SCHEDULER_NAME = "fgsmsAuxServicesQuartzScheduler";
37 public static final String QUARTZ_GROUP_NAME = "fgsms Aux Services";
38 public static final String QUARTZ_TRIGGER_GROUP_NAME = "fgsmsAuxServicesTriggers";
39
40 public static boolean QuartzJobExists(String JobName, Scheduler sc) throws SchedulerException {
41 if (sc == null) {
42 return false;
43 }
44 String[] jobNames = sc.getJobNames(QUARTZ_GROUP_NAME);
45 for (int i = 0; i < jobNames.length; i++) {
46 if (jobNames[i].equals(JobName)) {
47 return true;
48 }
49 }
50 return false;
51 }
52
53 public static JobDetail GetQuartzJobReference(String JobName, Scheduler sc) throws SchedulerException {
54 if (sc == null) {
55 return null;
56 }
57 String[] jobNames = sc.getJobNames(QUARTZ_GROUP_NAME);
58 for (int i = 0; i < jobNames.length; i++) {
59 if (jobNames[i].equals(JobName)) {
60 return sc.getJobDetail(JobName, QUARTZ_GROUP_NAME);
61 }
62 }
63 return null;
64 }
65
66 public static Trigger GetQuartzTriggerReference(String JobName, Scheduler sc) throws SchedulerException {
67 if (sc == null) {
68 return null;
69 }
70 String[] jobNames = sc.getJobNames(QUARTZ_GROUP_NAME);
71 for (int i = 0; i < jobNames.length; i++) {
72 if (jobNames[i].equals(JobName)) {
73 return sc.getTrigger(JobName, QUARTZ_GROUP_NAME);
74 }
75 }
76 return null;
77 }
78 }