607886c90452f36813e12634441fe19ef0ecbe4c
[so/adapters/so-cnf-adapter.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2023 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
21 package org.onap.so.cnfm.lcm.database.beans;
22
23 import javax.persistence.Column;
24 import javax.persistence.Entity;
25 import javax.persistence.FetchType;
26 import javax.persistence.GeneratedValue;
27 import javax.persistence.GenerationType;
28 import javax.persistence.Id;
29 import javax.persistence.JoinColumn;
30 import javax.persistence.ManyToOne;
31 import javax.persistence.Table;
32 import java.util.Objects;
33 import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.toIndentedString;
34
35 /**
36  *
37  * @author Gerard Nugent (gerard.nugent@est.tech)
38  *
39  */
40 @Entity
41 @Table(name = "AS_LIFECYCLE_PARAM")
42 public class AsLifecycleParam {
43
44     @Id
45     @Column(name = "AS_LCP_ID", nullable = false)
46     @GeneratedValue(strategy = GenerationType.IDENTITY)
47     private Integer asLifecycleParamId;
48
49     @ManyToOne(fetch = FetchType.LAZY)
50     @JoinColumn(name = "AS_DEP_ITEM_INST_ID", nullable = false)
51     private AsDeploymentItem asDeploymentItemInst;
52
53     @Column(name = "LIFECYCLE_PARAM")
54     private String lifecycleParam;
55
56     public AsLifecycleParam() {
57
58     }
59
60     public void setAsLifecycleParamId(final Integer asLifecycleParamId) {
61         this.asLifecycleParamId = asLifecycleParamId;
62     }
63
64     public Integer getAsLifecycleParamId() {
65         return asLifecycleParamId;
66     }
67
68     public AsLifecycleParam asLifecycleParamId(final Integer asLifecycleParamId) {
69         this.asLifecycleParamId = asLifecycleParamId;
70         return this;
71     }
72
73     public AsDeploymentItem getAsDeploymentItemInst() {
74         return asDeploymentItemInst;
75     }
76
77     public void setAsDeploymentItemInst(final AsDeploymentItem asDeploymentItemInst) {
78         this.asDeploymentItemInst = asDeploymentItemInst;
79     }
80
81     public AsLifecycleParam asDeploymentItemInst(final AsDeploymentItem asDeploymentItemInst) {
82         this.asDeploymentItemInst = asDeploymentItemInst;
83         return this;
84     }
85
86     public String getLifecycleParam() {
87         return lifecycleParam;
88     }
89
90     public void setLifecycleParam(final String lifecycleParam) {
91         this.lifecycleParam = lifecycleParam;
92     }
93
94     public AsLifecycleParam asLifecycleParam(final String lifecycleParam) {
95         this.lifecycleParam = lifecycleParam;
96         return this;
97     }
98
99
100     @Override
101     public String toString() {
102         final StringBuilder sb = new StringBuilder();
103         sb.append("class AslifecycleParam {\n");
104         sb.append("    asLifecycleParamId: ").append(toIndentedString(asLifecycleParamId)).append("\n");
105         sb.append("    asDeploymentItemInstId: ")
106                 .append(asDeploymentItemInst != null
107                         ? toIndentedString(asDeploymentItemInst.getAsDeploymentItemInstId())
108                         : null)
109                 .append("\n");
110         sb.append("    lifecycleParam:  ").append(toIndentedString(lifecycleParam)).append("\n");
111         sb.append("}");
112         return sb.toString();
113     }
114
115
116     @Override
117     public boolean equals(final Object o) {
118         if (this == o)
119             return true;
120         if (o == null || getClass() != o.getClass())
121             return false;
122         final AsLifecycleParam that = (AsLifecycleParam) o;
123         return Objects.equals(asLifecycleParamId, that.asLifecycleParamId)
124                 && Objects.equals(asDeploymentItemInst, that.asDeploymentItemInst)
125                 && Objects.equals(lifecycleParam, that.lifecycleParam);
126     }
127
128     @Override
129     public int hashCode() {
130         return Objects.hash(asLifecycleParamId, asDeploymentItemInst, lifecycleParam);
131     }
132
133
134 }