summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-09-19 08:28:39 +0100
committerAndr� Schmid <andre.schmid@est.tech>2022-09-28 07:45:09 +0000
commitafc5d600db7ee9aed67ffc08b4704f3f77653f03 (patch)
tree51dcd3983e89aebf9230d5c5bb78638332baf92a
parentb98438ba7b85ca3e384cf5579daa5be9144f9dc4 (diff)
Fix service import with capability node filters
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-4182 Change-Id: Iafbc59764741ae1164ea2cd43aa2ed9f5208a3cf
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java21
1 files changed, 6 insertions, 15 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
index b57e2cb2cb..3171277172 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
@@ -1023,21 +1023,12 @@ public class YamlTemplateParsingHandler {
@SuppressWarnings("unchecked")
private Map<String, List<UploadCapInfo>> createCapModuleFromYaml(Map<String, Object> nodeTemplateJsonMap) {
Map<String, List<UploadCapInfo>> moduleCap = new HashMap<>();
- Either<List<Object>, ResultStatusEnum> capabilitiesListRes = findFirstToscaListElement(nodeTemplateJsonMap, CAPABILITIES);
- if (capabilitiesListRes.isLeft()) {
- for (Object jsonCapObj : capabilitiesListRes.left().value()) {
- String key = ((Map<String, Object>) jsonCapObj).keySet().iterator().next();
- Object capJson = ((Map<String, Object>) jsonCapObj).get(key);
- addModuleNodeTemplateCap(moduleCap, capJson, key);
- }
- } else {
- Either<Map<String, Object>, ResultStatusEnum> capabilitiesMapRes = findFirstToscaMapElement(nodeTemplateJsonMap, CAPABILITIES);
- if (capabilitiesMapRes.isLeft()) {
- for (Map.Entry<String, Object> entry : capabilitiesMapRes.left().value().entrySet()) {
- String capName = entry.getKey();
- Object capJson = entry.getValue();
- addModuleNodeTemplateCap(moduleCap, capJson, capName);
- }
+ Map<String, Object> capabilities = (Map<String, Object>) nodeTemplateJsonMap.get(CAPABILITIES.getElementName());
+ if (MapUtils.isNotEmpty(capabilities)) {
+ for (Map.Entry<String, Object> entry : capabilities.entrySet()) {
+ String capName = entry.getKey();
+ Object capJson = entry.getValue();
+ addModuleNodeTemplateCap(moduleCap, capJson, capName);
}
}
return moduleCap;