1 package org.onap.vid.job.impl;
3 import com.fasterxml.jackson.annotation.JsonTypeInfo;
4 import org.onap.vid.job.JobAdapter;
6 import java.util.Objects;
9 public class JobSharedData {
11 protected UUID jobUuid;
12 protected String userId;
13 protected Class requestType;
14 protected UUID rootJobId;
16 @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, property="class")
17 protected JobAdapter.AsyncJobRequest request;
19 public JobSharedData() {
22 public JobSharedData(UUID jobUuid, String userId, JobAdapter.AsyncJobRequest request) {
23 this.jobUuid = jobUuid;
25 this.requestType = request.getClass();
26 this.request = request;
27 this.rootJobId = jobUuid;
30 public JobSharedData(UUID jobUuid, JobAdapter.AsyncJobRequest request, JobSharedData parentData) {
31 this(jobUuid, parentData.getUserId(), request);
32 rootJobId = parentData.getRootJobId() != null ? parentData.getRootJobId() : parentData.getJobUuid();
36 public UUID getJobUuid() {
40 public String getUserId() {
44 public void setUserId(String userId) {
48 public Class getRequestType() {
52 public void setRequestType(Class requestType) {
53 this.requestType = requestType;
56 public JobAdapter.AsyncJobRequest getRequest() {
60 public void setRequest(JobAdapter.AsyncJobRequest request) {
61 this.request = request;
64 public UUID getRootJobId() {
69 public boolean equals(Object o) {
70 if (this == o) return true;
71 if (!(o instanceof JobSharedData)) return false;
72 JobSharedData that = (JobSharedData) o;
73 return Objects.equals(getJobUuid(), that.getJobUuid()) &&
74 Objects.equals(getUserId(), that.getUserId()) &&
75 Objects.equals(getRequestType(), that.getRequestType()) &&
76 Objects.equals(getRootJobId(), that.getRootJobId()) &&
77 Objects.equals(getRequest(), that.getRequest());
81 public int hashCode() {
82 return Objects.hash(getJobUuid(), getUserId(), getRequestType(), getRootJobId(), getRequest());