2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
20 package org.onap.so.etsi.nfvo.ns.lcm.database.beans;
22 import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.utils.Utils.toIndentedString;
23 import java.time.LocalDateTime;
24 import java.util.Objects;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.EnumType;
28 import javax.persistence.Enumerated;
29 import javax.persistence.FetchType;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.ManyToOne;
35 import javax.persistence.Table;
38 @Table(name = "JOB_STATUS")
39 public class NfvoJobStatus {
42 @GeneratedValue(strategy = GenerationType.IDENTITY)
46 @Enumerated(EnumType.STRING)
47 @Column(name = "STATUS", nullable = false)
48 private JobStatusEnum status;
50 @Column(name = "DESCRIPTION", columnDefinition = "LONGTEXT")
51 private String description;
53 @Column(name = "UPDATED_TIME", nullable = false)
54 private LocalDateTime updatedTime;
56 @ManyToOne(fetch = FetchType.LAZY)
57 @JoinColumn(name = "JOB_ID", nullable = false)
58 private NfvoJob nfvoJob;
64 public JobStatusEnum getStatus() {
68 public void setStatus(final JobStatusEnum status) {
72 public NfvoJobStatus status(final JobStatusEnum status) {
77 public String getDescription() {
81 public void setDescription(final String description) {
82 this.description = description;
85 public NfvoJobStatus description(final String description) {
86 this.description = description;
90 public LocalDateTime getUpdatedTime() {
94 public void setUpdatedTime(final LocalDateTime updatedTime) {
95 this.updatedTime = updatedTime;
98 public NfvoJobStatus updatedTime(final LocalDateTime addTime) {
99 this.updatedTime = addTime;
103 public NfvoJob getNfvoJob() {
107 public void setNfvoJob(final NfvoJob nfvoJob) {
108 this.nfvoJob = nfvoJob;
111 public NfvoJobStatus nfvoJob(final NfvoJob nfvoJob) {
112 this.nfvoJob = nfvoJob;
118 public int hashCode() {
119 return Objects.hash(id, status, updatedTime, description, nfvoJob != null ? nfvoJob.getJobId() : 0);
123 public boolean equals(final Object obj) {
126 if (obj == null || getClass() != obj.getClass())
128 if (obj instanceof NfvoJobStatus) {
129 final NfvoJobStatus other = (NfvoJobStatus) obj;
130 return Objects.equals(id, other.id) && Objects.equals(status, other.status)
131 && Objects.equals(updatedTime, other.updatedTime) && Objects.equals(description, other.description)
132 && (nfvoJob == null ? other.nfvoJob == null
133 : other.nfvoJob != null && Objects.equals(nfvoJob.getJobId(), other.nfvoJob.getJobId()));
139 public String toString() {
140 final StringBuilder sb = new StringBuilder();
141 sb.append("class NfvoJobStatus {\n");
142 sb.append(" Id: ").append(toIndentedString(id)).append("\n");
143 sb.append(" status: ").append(toIndentedString(status)).append("\n");
144 sb.append(" descp: ").append(toIndentedString(description)).append("\n");
145 sb.append(" updatedTime: ").append(toIndentedString(updatedTime)).append("\n");
146 sb.append(" jobId: ").append(nfvoJob != null ? toIndentedString(nfvoJob.getJobId()) : "").append("\n");
148 return sb.toString();