aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-dao/src/main/java
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2021-08-16 17:28:10 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2021-08-25 11:02:32 +0000
commitf7776389f137cb881033d77d89cc3f1eb4974077 (patch)
tree2f084f62801873351bcbd851aa382fee96393110 /catalog-dao/src/main/java
parent35841a655443834474b48d94ae8b124d6f0896ff (diff)
Import VSP with non-standard data types
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3673 Change-Id: I0fd16410788da3a82c74b1d38ffa4458e85e6ccc
Diffstat (limited to 'catalog-dao/src/main/java')
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java21
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java1
2 files changed, 14 insertions, 8 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
index 76fddc070b..8614f4beb4 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java
@@ -587,16 +587,21 @@ public class JanusGraphDao {
}
private boolean vertexValidForModel(final JanusGraphVertex vertex, final String model) {
- final Either<List<ImmutablePair<JanusGraphVertex, Edge>>, JanusGraphOperationStatus> modelVertices = getParentVerticies(vertex, GraphEdgeLabels.MODEL_ELEMENT);
+ final String vertexLabel = (String)vertex.property(GraphPropertyEnum.LABEL.getProperty()).value();
+ final VertexTypeEnum vertexType = VertexTypeEnum.getByName(vertexLabel);
+ final GraphEdgeLabels edgeLabel = vertexType.equals(VertexTypeEnum.TOPOLOGY_TEMPLATE) ? GraphEdgeLabels.MODEL : GraphEdgeLabels.MODEL_ELEMENT;
+ final Either<List<ImmutablePair<JanusGraphVertex, Edge>>, JanusGraphOperationStatus> modelVertices = getParentVerticies(vertex, edgeLabel);
- if (modelVertices.isLeft()) {
- for (ImmutablePair<JanusGraphVertex, Edge> vertexPair : modelVertices.left().value()) {
- if (model.equals((String)vertexPair.getLeft().property("name").value())) {
- return true;
- }
- }
+ return modelVertices.isLeft() && modelVertices.left().value().stream().anyMatch(vertexPair -> modelVertexMatchesModel(vertexPair.getLeft(), model));
+ }
+
+ private boolean modelVertexMatchesModel(final JanusGraphVertex modelVertex, final String model) {
+ if (model.equals((String)modelVertex.property("name").value())) {
+ return true;
}
- return false;
+ final Either<List<ImmutablePair<JanusGraphVertex, Edge>>, JanusGraphOperationStatus> derivedModels =
+ getParentVerticies(modelVertex, GraphEdgeLabels.DERIVED_FROM);
+ return derivedModels.isLeft() && derivedModels.left().value().stream().anyMatch(derivedModel ->modelVertexMatchesModel(derivedModel.left, model));
}
private Either<List<ImmutablePair<JanusGraphVertex, Edge>>, JanusGraphOperationStatus> getParentVerticies(
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java
index 7dbcc87eb4..4ed16a42ec 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java
@@ -71,6 +71,7 @@ public enum GraphEdgeLabels {
PARAMETER_VALUE("PARAMETER_VALUE"),
PARAMETER_IMPL("PARAMETER_IMPL"),
MODEL_ELEMENT("MODEL_ELEMENT"),
+ MODEL("MODEL"),
// VF additions
CALCULATED_REQUIREMENT("CALCULATED_REQUIREMENT"),
CALCULATED_CAPABILITY("CALCULATED_CAPABILITY"),