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
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.cnfm.lcm.database.beans;
22 import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.toIndentedString;
23 import java.time.LocalDateTime;
24 import java.util.ArrayList;
25 import java.util.List;
26 import java.util.Objects;
27 import java.util.UUID;
28 import javax.persistence.CascadeType;
29 import javax.persistence.Column;
30 import javax.persistence.Entity;
31 import javax.persistence.EnumType;
32 import javax.persistence.Enumerated;
33 import javax.persistence.FetchType;
34 import javax.persistence.Id;
35 import javax.persistence.OneToMany;
36 import javax.persistence.Table;
39 * @author Waqas Ikram (waqas.ikram@est.tech)
43 @Table(name = "AS_INST")
47 @Column(name = "AS_INST_ID", nullable = false)
48 private String asInstId;
50 @Column(name = "NAME", nullable = false)
53 @Column(name = "DESCRIPTION", columnDefinition = "LONGTEXT")
54 private String description;
56 @Column(name = "AS_PACKAGE_ID")
57 private String asPackageId;
59 @Column(name = "ASD_ID", nullable = false)
62 @Column(name = "ASD_INVARIANT_ID", nullable = false)
63 private String asdInvariantId;
65 @Column(name = "AS_PROVIDER", nullable = false)
66 private String asProvider;
68 @Column(name = "AS_APPLICATION_NAME", nullable = false)
69 private String asApplicationName;
71 @Column(name = "AS_APPLICATION_VERSION", nullable = false)
72 private String asApplicationVersion;
74 @Column(name = "SERVICE_INSTANCE_ID", nullable = false)
75 private String serviceInstanceId;
77 @Column(name = "SERVICE_INSTANCE_NAME", nullable = false)
78 private String serviceInstanceName;
80 @Column(name = "CLOUD_OWNER", nullable = false)
81 private String cloudOwner;
83 @Column(name = "CLOUD_REGION", nullable = false)
84 private String cloudRegion;
86 @Column(name = "TENANT_ID", nullable = false)
87 private String tenantId;
89 @Enumerated(EnumType.STRING)
90 @Column(name = "STATUS", nullable = false)
93 @Column(name = "STATUS_UPDATED_TIME", nullable = false)
94 private LocalDateTime statusUpdatedTime;
96 @OneToMany(mappedBy = "asInst", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
97 private List<AsDeploymentItem> asdeploymentItems = new ArrayList<>();
100 this.asInstId = UUID.randomUUID().toString();
103 public String getAsInstId() {
107 public void setAsInstId(final String asInstId) {
108 this.asInstId = asInstId;
111 public AsInst asInstId(final String asInstId) {
112 this.asInstId = asInstId;
116 public String getName() {
120 public void setName(final String name) {
124 public AsInst name(final String name) {
129 public String getDescription() {
133 public void setDescription(final String description) {
134 this.description = description;
137 public AsInst description(final String description) {
138 this.description = description;
142 public String getAsPackageId() {
146 public void setAsPackageId(final String asPackageId) {
147 this.asPackageId = asPackageId;
150 public AsInst asPackageId(final String asPackageId) {
151 this.asPackageId = asPackageId;
155 public String getAsdId() {
159 public void setAsdId(final String asdId) {
163 public AsInst asdId(final String asdId) {
168 public String getAsdInvariantId() {
169 return asdInvariantId;
172 public void setAsdInvariantId(final String asdInvariantId) {
173 this.asdInvariantId = asdInvariantId;
176 public AsInst asdInvariantId(final String nsdInvariantId) {
177 this.asdInvariantId = nsdInvariantId;
181 public String getAsProvider() {
185 public void setAsProvider(final String asProvider) {
186 this.asProvider = asProvider;
189 public AsInst asProvider(final String asProvider) {
190 this.asProvider = asProvider;
194 public String getAsApplicationName() {
195 return asApplicationName;
198 public void setAsApplicationName(final String asApplicationName) {
199 this.asApplicationName = asApplicationName;
202 public AsInst asApplicationName(final String asApplicationName) {
203 this.asApplicationName = asApplicationName;
207 public String getAsApplicationVersion() {
208 return asApplicationVersion;
211 public void setAsApplicationVersion(final String asApplicationVersion) {
212 this.asApplicationVersion = asApplicationVersion;
215 public AsInst asApplicationVersion(final String asApplicationVersion) {
216 this.asApplicationVersion = asApplicationVersion;
220 public String getServiceInstanceId() {
221 return serviceInstanceId;
224 public void setServiceInstanceId(final String serviceInstanceId) {
225 this.serviceInstanceId = serviceInstanceId;
228 public AsInst serviceInstanceId(final String serviceInstanceId) {
229 this.serviceInstanceId = serviceInstanceId;
233 public String getServiceInstanceName() {
234 return serviceInstanceName;
237 public void setServiceInstanceName(final String serviceInstanceName) {
238 this.serviceInstanceName = serviceInstanceName;
241 public AsInst serviceInstanceName(final String serviceInstanceName) {
242 this.serviceInstanceName = serviceInstanceName;
246 public String getCloudOwner() {
250 public void setCloudOwner(final String cloudOwner) {
251 this.cloudOwner = cloudOwner;
254 public AsInst cloudOwner(final String cloudOwner) {
255 this.cloudOwner = cloudOwner;
259 public String getCloudRegion() {
263 public void setCloudRegion(final String cloudRegion) {
264 this.cloudRegion = cloudRegion;
267 public AsInst cloudRegion(final String cloudRegion) {
268 this.cloudRegion = cloudRegion;
272 public String getTenantId() {
276 public void setTenantId(final String tenantId) {
277 this.tenantId = tenantId;
280 public AsInst tenantId(final String tenantId) {
281 this.tenantId = tenantId;
285 public State getStatus() {
289 public void setStatus(final State status) {
290 this.status = status;
293 public AsInst status(final State status) {
294 this.status = status;
298 public LocalDateTime getStatusUpdatedTime() {
299 return statusUpdatedTime;
302 public void setStatusUpdatedTime(final LocalDateTime statusUpdatedTime) {
303 this.statusUpdatedTime = statusUpdatedTime;
306 public AsInst statusUpdatedTime(final LocalDateTime statusUpdatedTime) {
307 this.statusUpdatedTime = statusUpdatedTime;
311 public List<AsDeploymentItem> getAsdeploymentItems() {
312 return asdeploymentItems;
315 public void setAsdeploymentItems(final List<AsDeploymentItem> asdeploymentItems) {
316 this.asdeploymentItems = asdeploymentItems;
319 public AsInst asdeploymentItems(final AsDeploymentItem asdeploymentItem) {
320 asdeploymentItem.asInst(this);
321 this.asdeploymentItems.add(asdeploymentItem);
326 public int hashCode() {
327 return Objects.hash(asInstId, name, description, asPackageId, asdId, asdInvariantId, asProvider,
328 asApplicationName, asApplicationVersion, serviceInstanceId, serviceInstanceName, cloudOwner,
329 cloudRegion, tenantId, status, statusUpdatedTime, asdeploymentItems);
333 public boolean equals(final Object obj) {
336 if (obj == null || getClass() != obj.getClass())
338 if (obj instanceof AsInst) {
339 final AsInst other = (AsInst) obj;
340 return Objects.equals(asInstId, other.asInstId) && Objects.equals(name, other.name)
341 && Objects.equals(description, other.description) && Objects.equals(asPackageId, other.asPackageId)
342 && Objects.equals(asdId, other.asdId) && Objects.equals(asdInvariantId, other.asdInvariantId)
343 && Objects.equals(asProvider, other.asProvider)
344 && Objects.equals(asApplicationName, other.asApplicationName)
345 && Objects.equals(asApplicationVersion, other.asApplicationVersion)
346 && Objects.equals(serviceInstanceId, other.serviceInstanceId)
347 && Objects.equals(serviceInstanceName, other.serviceInstanceName)
348 && Objects.equals(cloudOwner, other.cloudOwner) && Objects.equals(cloudRegion, other.cloudRegion)
349 && Objects.equals(tenantId, other.tenantId) && Objects.equals(status, other.status)
350 && Objects.equals(statusUpdatedTime, other.statusUpdatedTime)
351 && Objects.equals(asdeploymentItems, other.asdeploymentItems);
357 public String toString() {
358 final StringBuilder sb = new StringBuilder();
359 sb.append("class AsInst {\n");
360 sb.append(" asInstId: ").append(toIndentedString(asInstId)).append("\n");
361 sb.append(" name: ").append(toIndentedString(name)).append("\n");
362 sb.append(" description: ").append(toIndentedString(description)).append("\n");
363 sb.append(" asPackageId: ").append(toIndentedString(asPackageId)).append("\n");
364 sb.append(" asdId: ").append(toIndentedString(asdId)).append("\n");
365 sb.append(" asProvider: ").append(toIndentedString(asProvider)).append("\n");
366 sb.append(" asApplicationName: ").append(toIndentedString(asApplicationName)).append("\n");
367 sb.append(" asApplicationVersion: ").append(toIndentedString(asApplicationVersion)).append("\n");
368 sb.append(" serviceInstanceId: ").append(toIndentedString(serviceInstanceId)).append("\n");
369 sb.append(" serviceInstanceName: ").append(toIndentedString(serviceInstanceName)).append("\n");
370 sb.append(" cloudOwner: ").append(toIndentedString(cloudOwner)).append("\n");
371 sb.append(" cloudRegion: ").append(toIndentedString(cloudRegion)).append("\n");
372 sb.append(" tenantId: ").append(toIndentedString(tenantId)).append("\n");
373 sb.append(" status: ").append(toIndentedString(status)).append("\n");
374 sb.append(" statusUpdatedTime: ").append(toIndentedString(statusUpdatedTime)).append("\n");
375 sb.append(" asdeploymentItems: ").append(toIndentedString(asdeploymentItems)).append("\n");
378 return sb.toString();