aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2018-08-03 10:04:46 +0200
committerromaingimbert <romain.gimbert@orange.com>2018-08-03 10:04:46 +0200
commit9e34db4166287c48d8aaccc680eee0f0d5714f8b (patch)
tree58a3552e3c1e44f5e0217b5876da83ff710fdff2 /src/main
parent048e7e70e305279fc9cdcba4ae70d116f1f1c8b6 (diff)
rollback EXTAPI-108 call tosca
Change-Id: Icfe3594f7b34b7dabdc7941ce5fff3b52fd4703f Issue-ID: EXTAPI-108 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java7
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java17
-rw-r--r--src/main/resources/jolt/getServiceCatalog.json8
3 files changed, 20 insertions, 12 deletions
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java
index d4a53a4..e8ef9e3 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java
@@ -43,7 +43,12 @@ public class ServiceSpecificationResource extends ResourceManagement {
@RequestParam MultiValueMap<String, String> params) {
Map response = serviceSpecificationService.get(serviceSpecId);
JsonRepresentation filter = new JsonRepresentation(params);
- return this.getResponse(response, filter);
+ if (response.get("serviceSpecCharacteristic") != null) {
+ return this.getResponse(response, filter);
+ } else {
+ return this.getPartialResponse(response, filter);
+
+ }
}
@GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java
index 3094f7b..69e4a51 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java
@@ -23,6 +23,8 @@ import org.apache.commons.collections.CollectionUtils;
import org.onap.nbi.apis.servicecatalog.jolt.FindServiceSpecJsonTransformer;
import org.onap.nbi.apis.servicecatalog.jolt.GetServiceSpecJsonTransformer;
import org.onap.nbi.apis.serviceorder.ServiceCatalogUrl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.MultiValueMap;
@@ -45,16 +47,23 @@ public class ServiceSpecificationService {
@Autowired
private ServiceCatalogUrl serviceCatalogUrl;
- private static final String SERVICE_SPEC_INPUT_SCHEMA = "serviceSpecInputSchema";
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ServiceSpecificationService.class);
public Map get(String serviceSpecId) {
Map sdcResponse = sdcClient.callGet(serviceSpecId);
- sdcResponse.put(SERVICE_SPEC_INPUT_SCHEMA,serviceCatalogUrl.getServiceCatalogUrl()+serviceSpecId+"/"+SERVICE_SPEC_INPUT_SCHEMA);
- return (LinkedHashMap) getServiceSpecJsonTransformer.transform(sdcResponse);
+ LinkedHashMap serviceCatalogResponse = (LinkedHashMap) getServiceSpecJsonTransformer.transform(sdcResponse);
+ Map toscaInfosTopologyTemplate = toscaInfosProcessor.getToscaInfos(serviceCatalogResponse);
+ if (toscaInfosTopologyTemplate != null) {
+ LOGGER.debug("tosca file found, retrieving informations");
+ toscaInfosProcessor.buildResponseWithToscaInfos(toscaInfosTopologyTemplate, serviceCatalogResponse);
+ } else {
+ LOGGER.debug("no tosca file found, partial response");
+ }
+ return serviceCatalogResponse;
}
-
public List<LinkedHashMap> find(MultiValueMap<String, String> parametersMap) {
List<LinkedHashMap> sdcResponse = sdcClient.callFind(parametersMap);
List<LinkedHashMap> serviceCatalogResponse = new ArrayList<>();
diff --git a/src/main/resources/jolt/getServiceCatalog.json b/src/main/resources/jolt/getServiceCatalog.json
index 6b260b6..6fdadd6 100644
--- a/src/main/resources/jolt/getServiceCatalog.json
+++ b/src/main/resources/jolt/getServiceCatalog.json
@@ -42,8 +42,7 @@
}
- },
- "serviceSpecInputSchema" : "serviceSpecCharacteristic.serviceSpecInputSchema"
+ }
}
},
{
@@ -70,11 +69,6 @@
"@type": "ONAPresource"
}
- },
- "serviceSpecCharacteristic" : {
- "valueType": "complex",
- "@type": "serviceSpecInputSchema"
-
}
}
}