aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/job/impl/JobSharedData.java
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/job/impl/JobSharedData.java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/impl/JobSharedData.java84
1 files changed, 84 insertions, 0 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobSharedData.java b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobSharedData.java
new file mode 100644
index 000000000..8f1e45736
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobSharedData.java
@@ -0,0 +1,84 @@
+package org.onap.vid.job.impl;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import org.onap.vid.job.JobAdapter;
+
+import java.util.Objects;
+import java.util.UUID;
+
+public class JobSharedData {
+
+ protected UUID jobUuid;
+ protected String userId;
+ protected Class requestType;
+ protected UUID rootJobId;
+
+ @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, property="class")
+ protected JobAdapter.AsyncJobRequest request;
+
+ public JobSharedData() {
+ }
+
+ public JobSharedData(UUID jobUuid, String userId, JobAdapter.AsyncJobRequest request) {
+ this.jobUuid = jobUuid;
+ this.userId = userId;
+ this.requestType = request.getClass();
+ this.request = request;
+ this.rootJobId = jobUuid;
+ }
+
+ public JobSharedData(UUID jobUuid, JobAdapter.AsyncJobRequest request, JobSharedData parentData) {
+ this(jobUuid, parentData.getUserId(), request);
+ rootJobId = parentData.getRootJobId() != null ? parentData.getRootJobId() : parentData.getJobUuid();
+ }
+
+
+ public UUID getJobUuid() {
+ return jobUuid;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public Class getRequestType() {
+ return requestType;
+ }
+
+ public void setRequestType(Class requestType) {
+ this.requestType = requestType;
+ }
+
+ public JobAdapter.AsyncJobRequest getRequest() {
+ return request;
+ }
+
+ public void setRequest(JobAdapter.AsyncJobRequest request) {
+ this.request = request;
+ }
+
+ public UUID getRootJobId() {
+ return rootJobId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof JobSharedData)) return false;
+ JobSharedData that = (JobSharedData) o;
+ return Objects.equals(getJobUuid(), that.getJobUuid()) &&
+ Objects.equals(getUserId(), that.getUserId()) &&
+ Objects.equals(getRequestType(), that.getRequestType()) &&
+ Objects.equals(getRootJobId(), that.getRootJobId()) &&
+ Objects.equals(getRequest(), that.getRequest());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getJobUuid(), getUserId(), getRequestType(), getRootJobId(), getRequest());
+ }
+}