aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2021-09-17 18:07:50 +0100
committerMichael Morris <michael.morris@est.tech>2021-09-23 09:25:39 +0000
commitaf35b7126cd14e2a8c3a6b0d33d142a7760216c8 (patch)
tree42e0cfaf4968f7a5b9d1f4f1f0916fdbe8fd372f /catalog-model
parent366d0b7509b7f619eb3c2b1202660e81d1b94486 (diff)
Fix certify VFC with Model
Issue-ID: SDC-3732 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Change-Id: Ic0dc8f86101ce303d01c51c7711c1cbad9308a3c
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java16
1 files changed, 11 insertions, 5 deletions
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 a288953a71..1037935ab5 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
@@ -206,7 +206,10 @@ public abstract class ToscaElementOperation extends BaseOperation {
}
}
if (result == null) {
- result = createModelEdge(previousToscaElement, nextToscaElement, user, createdToscaElementVertex);
+ result =
+ VertexTypeEnum.TOPOLOGY_TEMPLATE.equals(previousToscaElement.getLabel())
+ ? createModelEdge(previousToscaElement, nextToscaElement, user, createdToscaElementVertex, EdgeLabelEnum.MODEL)
+ : createModelEdge(previousToscaElement, nextToscaElement, user, createdToscaElementVertex, EdgeLabelEnum.MODEL_ELEMENT);
}
if (result == null) {
status = janusGraphDao.createEdge(user.getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.LAST_MODIFIER, new HashMap<>());
@@ -269,20 +272,23 @@ public abstract class ToscaElementOperation extends BaseOperation {
* @param nextToscaElement latest element version
* @param user user
* @param createdToscaElementVertex created tosca element
+ * @param edgeLabelEnum
* @return
*/
private Either<GraphVertex, StorageOperationStatus> createModelEdge(final GraphVertex previousToscaElement,
final GraphVertex nextToscaElement, GraphVertex user,
- final GraphVertex createdToscaElementVertex) {
+ final GraphVertex createdToscaElementVertex,
+ final EdgeLabelEnum edgeLabelEnum) {
Either<GraphVertex, StorageOperationStatus> result = null;
final Either<GraphVertex, JanusGraphOperationStatus> modelElementVertexResponse = janusGraphDao
- .getParentVertex(previousToscaElement, EdgeLabelEnum.MODEL, JsonParseFlagEnum.NoParse);
+ .getParentVertex(previousToscaElement, edgeLabelEnum, JsonParseFlagEnum.NoParse);
if (modelElementVertexResponse.isLeft()) {
final JanusGraphOperationStatus status = janusGraphDao
- .createEdge(modelElementVertexResponse.left().value().getVertex(), createdToscaElementVertex.getVertex(), EdgeLabelEnum.MODEL, new HashMap<>());
+ .createEdge(modelElementVertexResponse.left().value().getVertex(), createdToscaElementVertex.getVertex(), edgeLabelEnum,
+ new HashMap<>());
if (JanusGraphOperationStatus.OK != status) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG,
- FAILED_TO_CREATE_EDGE_WITH_LABEL_FROM_USER_VERTEX_TO_TOSCA_ELEMENT_VERTEX_ON_GRAPH_STATUS_IS, EdgeLabelEnum.MODEL,
+ FAILED_TO_CREATE_EDGE_WITH_LABEL_FROM_USER_VERTEX_TO_TOSCA_ELEMENT_VERTEX_ON_GRAPH_STATUS_IS, edgeLabelEnum,
user.getUniqueId(), nextToscaElement.getMetadataProperty(GraphPropertyEnum.NORMALIZED_NAME), status);
result = Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}