forked from apache/incubator-kie-kogito-runtimes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Job.java
161 lines (131 loc) · 5.23 KB
/
Job.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.kogito.jobs.api;
import java.time.ZonedDateTime;
import java.util.Objects;
/**
* Job describes the actual entity that should be scheduled and executed
* upon given expiration time. The job requires following information
* <ul>
* <li>id - unique UUID based identifier</li>
* <li>expirationTime - the time when this job should be executed</li>
* <li>callbackEndpoint - the callback endpoint (http/https) that will be invoked upon expiration</li>
* </ul>
*
* On top of that there are additional meta data that points the job to the owner - such as process instance.
* <ul>
* <li>processInstanceId - process instance that owns the job</li>
* <li>rootProcessInstanceId - root process instance that the job is part of - is owned as one of the subprocesses of the root process instance</li>
* <li>processId - process id of the process instance owning the job</li>
* <li>rootProcessId - root process id of the process instance that owns the job</li>
* </ul>
*/
public class Job {
private String id;
private ZonedDateTime expirationTime;
private Integer priority;
private String callbackEndpoint;
private String processInstanceId;
private String rootProcessInstanceId;
private String processId;
private String rootProcessId;
public Job() {
}
public Job(String id, ZonedDateTime expirationTime, Integer priority, String callbackEndpoint, String processInstanceId, String rootProcessInstanceId, String processId, String rootProcessId) {
this.id = id;
this.expirationTime = expirationTime;
this.priority = priority;
this.callbackEndpoint = callbackEndpoint;
this.processInstanceId = processInstanceId;
this.rootProcessInstanceId = rootProcessInstanceId;
this.processId = processId;
this.rootProcessId = rootProcessId;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public ZonedDateTime getExpirationTime() {
return expirationTime;
}
public void setExpirationTime(ZonedDateTime expirationTime) {
this.expirationTime = expirationTime;
}
public Integer getPriority() {
return priority;
}
public void setPriority(Integer priority) {
this.priority = priority;
}
public String getCallbackEndpoint() {
return callbackEndpoint;
}
public void setCallbackEndpoint(String callbackEndpoint) {
this.callbackEndpoint = callbackEndpoint;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
public String getProcessId() {
return processId;
}
public void setProcessId(String processId) {
this.processId = processId;
}
public String getRootProcessId() {
return rootProcessId;
}
public void setRootProcessId(String rootProcessId) {
this.rootProcessId = rootProcessId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Job)) {
return false;
}
Job job = (Job) o;
return Objects.equals(getId(), job.getId()) &&
Objects.equals(getExpirationTime(), job.getExpirationTime()) &&
Objects.equals(getPriority(), job.getPriority()) &&
Objects.equals(getCallbackEndpoint(), job.getCallbackEndpoint()) &&
Objects.equals(getProcessInstanceId(), job.getProcessInstanceId()) &&
Objects.equals(getRootProcessInstanceId(), job.getRootProcessInstanceId()) &&
Objects.equals(getProcessId(), job.getProcessId()) &&
Objects.equals(getRootProcessId(), job.getRootProcessId());
}
@Override
public int hashCode() {
return Objects.hash(getId(), getExpirationTime(), getPriority(), getCallbackEndpoint(), getProcessInstanceId(), getRootProcessInstanceId(), getProcessId(), getRootProcessId());
}
@Override
public String toString() {
return "Job [id=" + id + ", expirationTime=" + expirationTime + ", priority=" + priority + ", callbackEndpoint=" + callbackEndpoint + ", processInstanceId=" + processInstanceId + ", rootProcessInstanceId=" +
rootProcessInstanceId + ", processId=" + processId + ", rootProcessId=" + rootProcessId + "]";
}
}