diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-01-10 12:42:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-01-10 12:42:59 +0000 |
commit | 659874df80409170e57b6dd6197eb3a81eb3468e (patch) | |
tree | 08e79fd57aa0ed299586fd88f69f87a5a2f5ded1 /vid-app-common/src/main/java/org/onap/vid/job/impl/JobSharedData.java | |
parent | 143784a849ece4fc35cc290e33f829b72bf1fc79 (diff) | |
parent | 6ad41e3ccd398a2721f41ad61c80b7bb03f7d127 (diff) |
Merge "Merge from ECOMP's repository"
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.java | 84 |
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()); + } +} |