1
2
3
4
5
6 package org.tailormap.api.scheduling;
7
8 import org.quartz.InterruptableJob;
9 import org.tailormap.api.admin.model.TaskProgressEvent;
10
11 public interface Task {
12
13 String TYPE_KEY = "type";
14 String DESCRIPTION_KEY = "description";
15 String UUID_KEY = "uuid";
16 String CRON_EXPRESSION_KEY = "cronExpression";
17 String PRIORITY_KEY = "priority";
18 String STATE_KEY = "state";
19 String LAST_RESULT_KEY = "lastResult";
20 String INTERRUPTABLE_KEY = "interruptable";
21
22
23
24
25
26
27
28 TaskType getType();
29
30
31
32
33
34
35 String getDescription();
36
37
38
39
40
41
42 void setDescription(String description);
43
44
45
46
47
48
49
50 default void taskProgress(TaskProgressEvent event) {
51
52 }
53
54
55
56
57
58
59
60 default boolean isInterruptable() {
61 return InterruptableJob.class.isAssignableFrom(this.getClass());
62 }
63 }