From 3b6caf9cc8e1341ea000cb55ae277f622c816dda Mon Sep 17 00:00:00 2001 From: zm330 Date: Tue, 24 Mar 2020 11:16:56 +0800 Subject: Update Asdc DB table Issue-ID: SO-2758 Signed-off-by: zm330 Change-Id: Ic916e55effe0e3688b8d014fb70ea0e2ad23c16a --- .../java/org/onap/so/db/catalog/beans/Service.java | 14 +++++++++ .../org/onap/so/db/catalog/beans/ServiceInfo.java | 5 ++-- .../data/repository/ServiceInfoRepository.java | 33 ---------------------- .../db/catalog/rest/beans/ServiceMacroHolder.java | 15 ---------- 4 files changed, 16 insertions(+), 51 deletions(-) delete mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java (limited to 'mso-catalog-db') diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java index 0d7a6dbd1f..3f3742f699 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java @@ -139,6 +139,9 @@ public class Service implements Serializable { @OneToMany(cascade = CascadeType.ALL, mappedBy = "service") private List serviceArtifactList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "service") + private List serviceInfos; + @Column(name = "NAMING_POLICY") private String namingPolicy; @@ -385,6 +388,17 @@ public class Service implements Serializable { this.serviceArtifactList = serviceArtifactList; } + public List getServiceInfos() { + if (serviceInfos == null) { + serviceInfos = new ArrayList<>(); + } + return serviceInfos; + } + + public void setServiceInfos(List serviceInfos) { + this.serviceInfos = serviceInfos; + } + public String getWorkloadContext() { return this.workloadContext; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java index f9c95767f6..d11a112c80 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java @@ -45,9 +45,8 @@ public class ServiceInfo implements Serializable { @Column(name = "SERVICE_PROPERTIES") private String serviceProperties; - @OneToOne(cascade = CascadeType.ALL) - @JoinTable(name = "service_to_service_info", joinColumns = @JoinColumn(name = "SERVICE_INFO_ID"), - inverseJoinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID")) + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "SERVICE_MODEL_UUID") private Service service; public Integer getId() { diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java deleted file mode 100644 index e3a4ca264e..0000000000 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (c) 2019, CMCC Technologies Co., Ltd. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.catalog.data.repository; - -import org.onap.so.db.catalog.beans.Service; -import org.onap.so.db.catalog.beans.ServiceInfo; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; - -@RepositoryRestResource(collectionResourceRel = "serviceInfo", path = "serviceInfo") -public interface ServiceInfoRepository extends JpaRepository { - - ServiceInfo findByService(Service service); - -} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java index ec4e922c8f..65cbb5253e 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java @@ -39,7 +39,6 @@ public class ServiceMacroHolder implements Serializable { private ArrayList allottedResourceCustomizations; private ArrayList vnfResourceCustomizations; private ArrayList serviceProxyResourceCustomizations; - private ServiceInfo serviceInfo; public ServiceMacroHolder() { @@ -50,7 +49,6 @@ public class ServiceMacroHolder implements Serializable { this.allottedResourceCustomizations = new ArrayList<>(); this.vnfResourceCustomizations = new ArrayList<>(); this.serviceProxyResourceCustomizations = new ArrayList<>(); - this.serviceInfo = null; } public ServiceMacroHolder(Service service) { @@ -66,14 +64,6 @@ public class ServiceMacroHolder implements Serializable { this.service = service; } - public ServiceInfo getServiceInfo() { - return serviceInfo; - } - - public void setServiceInfo(ServiceInfo serviceInfo) { - this.serviceInfo = serviceInfo; - } - public void setVnfResources(ArrayList vnfResources) { this.vnfResources = vnfResources; } @@ -165,11 +155,6 @@ public class ServiceMacroHolder implements Serializable { } else { sb.append("service: null"); } - if (this.serviceInfo != null) { - sb.append("serviceInfo: " + this.serviceInfo.toString()); - } else { - sb.append("serviceInfo: null"); - } if (this.vnfResourceCustomizations != null && this.vnfResourceCustomizations.size() > 0) { int i = 0; sb.append("VnfResources: "); -- cgit 1.2.3-korg