diff options
author | zm330 <zhangminyj@chinamobile.com> | 2020-03-24 11:16:56 +0800 |
---|---|---|
committer | zm330 <zhangminyj@chinamobile.com> | 2020-03-24 11:19:40 +0800 |
commit | 3b6caf9cc8e1341ea000cb55ae277f622c816dda (patch) | |
tree | 7c8c2335b2ba658487fd454c8dde99650a5d8668 /adapters/mso-catalog-db-adapter/src/main/java | |
parent | 745c624081e15d018e221272c5be661d42bff8eb (diff) |
Update Asdc DB table
Issue-ID: SO-2758
Signed-off-by: zm330 <zhangminyj@chinamobile.com>
Change-Id: Ic916e55effe0e3688b8d014fb70ea0e2ad23c16a
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/main/java')
3 files changed, 8 insertions, 8 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java index 6c1c81c6ef..195ada37f7 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java @@ -24,8 +24,11 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.util.CollectionUtils; import javax.xml.bind.annotation.XmlRootElement; +import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; @XmlRootElement(name = "serviceInfo") @@ -45,8 +48,10 @@ public class QueryServiceInfo extends CatalogQuery { this.serviceInfo = new ServiceInfo(); } - public QueryServiceInfo(ServiceInfo serviceInfo) { - this.serviceInfo = serviceInfo; + public QueryServiceInfo(List<ServiceInfo> serviceInfos) { + if (!CollectionUtils.isEmpty(serviceInfos)) { + this.serviceInfo = serviceInfos.get(0); + } } public ServiceInfo getServiceInfo() { diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java index d5aa472c8d..305d52a997 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java @@ -94,7 +94,7 @@ public class QueryServiceMacroHolder extends CatalogQuery { subitem = new QueryAllottedResourceCustomization(service.getAllottedCustomizations()).JSON2(true, true); valueMap.put("_SERVICEALLOTTEDRESOURCES_", subitem.replaceAll(LINE_BEGINNING, "\t")); - subitem = new QueryServiceInfo(serviceMacroHolder.getServiceInfo()).JSON2(true, true); + subitem = new QueryServiceInfo(service.getServiceInfos()).JSON2(true, true); valueMap.put("_SERVICEINFO_", subitem.replaceAll(LINE_BEGINNING, "\t")); subitem = new QueryServiceProxyCustomization(service.getServiceProxyCustomizations()).JSON2(true, true); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java index fca1d3a45e..98abf15645 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java @@ -102,9 +102,6 @@ public class CatalogDbAdapterRest { @Autowired private InstanceGroupRepository instanceGroupRepository; - @Autowired - private ServiceInfoRepository serviceInfoRepository; - private static final String NO_MATCHING_PARAMETERS = "no matching parameters"; public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) { @@ -307,8 +304,6 @@ public class CatalogDbAdapterRest { respStatus = HttpStatus.SC_NOT_FOUND; qryResp = new QueryServiceMacroHolder(); } else { - ServiceInfo serviceInfo = serviceInfoRepository.findByService(ret.getService()); - ret.setServiceInfo(serviceInfo); qryResp = new QueryServiceMacroHolder(ret); logger.debug("serviceMacroHolder qryResp= {}", qryResp); } |