Merge "Removing so-monitoring module"
[so.git] / so-etsi-nfvo / so-etsi-nfvo-ns-lcm / so-etsi-nfvo-ns-lcm-database-service / src / main / java / org / onap / so / etsi / nfvo / ns / lcm / database / beans / NfvoJobStatus.java
1 /*-
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.etsi.nfvo.ns.lcm.database.beans;
21
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;
36
37 @Entity
38 @Table(name = "JOB_STATUS")
39 public class NfvoJobStatus {
40
41     @Id
42     @GeneratedValue(strategy = GenerationType.IDENTITY)
43     @Column(name = "ID")
44     private int id;
45
46     @Enumerated(EnumType.STRING)
47     @Column(name = "STATUS", nullable = false)
48     private JobStatusEnum status;
49
50     @Column(name = "DESCRIPTION", columnDefinition = "LONGTEXT")
51     private String description;
52
53     @Column(name = "UPDATED_TIME", nullable = false)
54     private LocalDateTime updatedTime;
55
56     @ManyToOne(fetch = FetchType.LAZY)
57     @JoinColumn(name = "JOB_ID", nullable = false)
58     private NfvoJob nfvoJob;
59
60     public int getId() {
61         return id;
62     }
63
64     public JobStatusEnum getStatus() {
65         return status;
66     }
67
68     public void setStatus(final JobStatusEnum status) {
69         this.status = status;
70     }
71
72     public NfvoJobStatus status(final JobStatusEnum status) {
73         this.status = status;
74         return this;
75     }
76
77     public String getDescription() {
78         return description;
79     }
80
81     public void setDescription(final String description) {
82         this.description = description;
83     }
84
85     public NfvoJobStatus description(final String description) {
86         this.description = description;
87         return this;
88     }
89
90     public LocalDateTime getUpdatedTime() {
91         return updatedTime;
92     }
93
94     public void setUpdatedTime(final LocalDateTime updatedTime) {
95         this.updatedTime = updatedTime;
96     }
97
98     public NfvoJobStatus updatedTime(final LocalDateTime addTime) {
99         this.updatedTime = addTime;
100         return this;
101     }
102
103     public NfvoJob getNfvoJob() {
104         return nfvoJob;
105     }
106
107     public void setNfvoJob(final NfvoJob nfvoJob) {
108         this.nfvoJob = nfvoJob;
109     }
110
111     public NfvoJobStatus nfvoJob(final NfvoJob nfvoJob) {
112         this.nfvoJob = nfvoJob;
113         return this;
114     }
115
116
117     @Override
118     public int hashCode() {
119         return Objects.hash(id, status, updatedTime, description, nfvoJob != null ? nfvoJob.getJobId() : 0);
120     }
121
122     @Override
123     public boolean equals(final Object obj) {
124         if (this == obj)
125             return true;
126         if (obj == null || getClass() != obj.getClass())
127             return false;
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()));
134         }
135         return false;
136     }
137
138     @Override
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");
147         sb.append("}");
148         return sb.toString();
149     }
150
151 }