2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.vid.job.impl;
23 import com.fasterxml.jackson.annotation.JsonTypeInfo;
24 import org.onap.vid.job.JobAdapter;
26 import java.util.Objects;
27 import java.util.UUID;
29 public class JobSharedData {
31 protected UUID jobUuid;
32 protected String userId;
33 protected Class requestType;
34 protected UUID rootJobId;
36 @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, property="class")
37 protected JobAdapter.AsyncJobRequest request;
39 public JobSharedData() {
42 public JobSharedData(UUID jobUuid, String userId, JobAdapter.AsyncJobRequest request) {
43 this.jobUuid = jobUuid;
45 this.requestType = request.getClass();
46 this.request = request;
47 this.rootJobId = jobUuid;
50 public JobSharedData(UUID jobUuid, JobAdapter.AsyncJobRequest request, JobSharedData parentData) {
51 this(jobUuid, parentData.getUserId(), request);
52 rootJobId = parentData.getRootJobId() != null ? parentData.getRootJobId() : parentData.getJobUuid();
56 public UUID getJobUuid() {
60 public String getUserId() {
64 public void setUserId(String userId) {
68 public Class getRequestType() {
72 public void setRequestType(Class requestType) {
73 this.requestType = requestType;
76 public JobAdapter.AsyncJobRequest getRequest() {
80 public void setRequest(JobAdapter.AsyncJobRequest request) {
81 this.request = request;
84 public UUID getRootJobId() {
89 public boolean equals(Object o) {
90 if (this == o) return true;
91 if (!(o instanceof JobSharedData)) return false;
92 JobSharedData that = (JobSharedData) o;
93 return Objects.equals(getJobUuid(), that.getJobUuid()) &&
94 Objects.equals(getUserId(), that.getUserId()) &&
95 Objects.equals(getRequestType(), that.getRequestType()) &&
96 Objects.equals(getRootJobId(), that.getRootJobId()) &&
97 Objects.equals(getRequest(), that.getRequest());
101 public int hashCode() {
102 return Objects.hash(getJobUuid(), getUserId(), getRequestType(), getRootJobId(), getRequest());