summaryrefslogtreecommitdiffstats
path: root/catalog-model/src
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2023-08-29 15:29:59 +0100
committerMichael Morris <michael.morris@est.tech>2023-09-05 09:50:12 +0000
commit438650c3a958c9176db3720204ec1ff9af94fc3a (patch)
treef0dc5b6b5bd837a6f689245e8a41d36d0a488f9b /catalog-model/src
parent0c47a1b7118b45eecbbb0064b635efb026173ec4 (diff)
Improve handling 'empty'/null string in Service fields
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: Ib301280fe1be2896e2d80e208349ac3c4ff763ec Issue-ID: SDC-4608
Diffstat (limited to 'catalog-model/src')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java6
2 files changed, 5 insertions, 3 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
index 22548dbf92..f75c7a6b06 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
@@ -1497,7 +1497,7 @@ public class NodeTemplateOperation extends BaseOperation {
String instanceNewName, boolean generateUid,
ToscaElement originToscaElement) {
String ciOriginComponentUid = resourceInstance.getComponentUid();
- if (!ValidationUtils.validateStringNotEmpty(resourceInstance.getCustomizationUUID())) {
+ if (StringUtils.isEmpty(resourceInstance.getCustomizationUUID())) {
resourceInstance.setCustomizationUUID(generateCustomizationUUID());
}
ComponentInstanceDataDefinition dataDefinition = new ComponentInstanceDataDefinition(resourceInstance);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
index 13729bf0b1..24e1e910d3 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
@@ -39,6 +39,7 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -475,10 +476,11 @@ public abstract class ToscaElementOperation extends BaseOperation {
protected StorageOperationStatus associateComponentToModel(final GraphVertex nodeTypeVertex, final ToscaElement nodeType,
final EdgeLabelEnum edgeLabelEnum) {
- if (nodeType.getMetadataValue(JsonPresentationFields.MODEL) == null) {
+ Object metadataValue = nodeType.getMetadataValue(JsonPresentationFields.MODEL);
+ if (metadataValue == null || StringUtils.isEmpty((String) metadataValue)) {
return StorageOperationStatus.OK;
}
- final String model = ((String) nodeType.getMetadataValue(JsonPresentationFields.MODEL));
+ final String model = ((String) metadataValue);
final JanusGraphOperationStatus createEdge = janusGraphDao.createEdge(getModelVertex(model), nodeTypeVertex, edgeLabelEnum, new HashMap<>());
if (createEdge != JanusGraphOperationStatus.OK) {
log.trace("Failed to associate resource {} to model {}", nodeType.getUniqueId(), model);