aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/main')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java9
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5__AddServiceArtifact.sql14
4 files changed, 12 insertions, 18 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);
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5__AddServiceArtifact.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5__AddServiceArtifact.sql
index d32c4666c5..6ef8446a9f 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5__AddServiceArtifact.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5__AddServiceArtifact.sql
@@ -4,7 +4,9 @@ CREATE TABLE IF NOT EXISTS `service_info` (
`ID` int (11) AUTO_INCREMENT,
`SERVICE_INPUT` varchar (5000),
`SERVICE_PROPERTIES` varchar (5000),
- PRIMARY KEY (`ID`)
+ `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ CONSTRAINT `fk_service_info_service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `service_artifact`(
@@ -18,13 +20,5 @@ CREATE TABLE IF NOT EXISTS `service_artifact`(
`CREATION_TIMESTAMP` DATETIME DEFAULT CURRENT_TIMESTAMP,
`SERVICE_MODEL_UUID` varchar (200) NOT NULL,
PRIMARY KEY (`ARTIFACT_UUID`),
- CONSTRAINT `fk_service_artifact_service_info1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+ CONSTRAINT `fk_service_artifact_service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-CREATE TABLE IF NOT EXISTS `service_to_service_info` (
- `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
- `SERVICE_INFO_ID` INT (11) NOT NULL,
- PRIMARY KEY (`SERVICE_MODEL_UUID`,`SERVICE_INFO_ID`),
- CONSTRAINT `fk_service_to_service_info__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `fk_service_to_service_info__service_info1` FOREIGN KEY (`SERVICE_INFO_ID`) REFERENCES `service_info` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
-) \ No newline at end of file