aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-10-19 18:37:01 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-10-26 09:23:55 +0000
commit8220d912803cecb22af967173e228867569450c4 (patch)
tree9f0c9b4e9aa4628309c9e061bde46ed756350514 /catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java
parent15c891ef4198a94ebcdf888a6d09e6f5817ae225 (diff)
Fix import policy issues
The following issues are addressed: When a service is imported containing polices, a new name for the policy is generated instead of using the name from the imported service When a service is imported containing policies with a string value set for a property of a policy, then the value is created in the new service surrounded with quotes NPE when service imported with no instances NPE when service imported with instances with no requirements Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-4224 Change-Id: I8403c0564796a045816ae28e52961688ca7804db
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java7
1 files changed, 6 insertions, 1 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 3171277172..9734a0acdb 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
@@ -91,6 +91,7 @@ import org.openecomp.sdc.be.components.impl.ImportUtils;
import org.openecomp.sdc.be.components.impl.NodeFilterUploadCreator;
import org.openecomp.sdc.be.components.impl.PolicyTypeBusinessLogic;
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
+import org.openecomp.sdc.be.components.utils.PropertiesUtils;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao;
@@ -367,11 +368,15 @@ public class YamlTemplateParsingHandler {
}
final UploadPropInfo uploadPropInfo = buildProperty(propertyJson.getKey(), propertyJson.getValue());
final PropertyDefinition propertyDefinition = new PropertyDefinition(originalProperty);
- propertyDefinition.setValue(gson.toJson(uploadPropInfo.getValue()));
propertyDefinition.setToscaFunction(uploadPropInfo.getToscaFunction());
propertyDefinition.setSubPropertyToscaFunctions(uploadPropInfo.getSubPropertyToscaFunctions());
propertyDefinition.setGetInputValues(uploadPropInfo.getGet_input());
propertyDefinition.setDescription(uploadPropInfo.getDescription());
+ String propertyValue = gson.toJson(uploadPropInfo.getValue());
+ if (!propertyDefinition.isToscaFunction()) {
+ propertyValue = PropertiesUtils.trimQuotes(propertyValue);
+ }
+ propertyDefinition.setValue(propertyValue);
return propertyDefinition;
})
.filter(Objects::nonNull)