summaryrefslogtreecommitdiffstats
path: root/catalog-dao
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2021-08-12 09:14:21 +0100
committerAnderson Ribeiro <anderson.ribeiro@est.tech>2021-08-13 18:53:24 +0000
commit276117aaa383b16a0b62e2666a612e669b8f27c8 (patch)
tree6e34078c50b768569bf97ebb8ae578c8ac9d5e0a /catalog-dao
parentb8bfef3a009922db72c1a618211ce03c07683e58 (diff)
Support models extending models
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3668 Change-Id: Iad4d2a28c1c982e55e8835d4f30a9a212aefb6be
Diffstat (limited to 'catalog-dao')
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
index b2492cdb1a..2116dcc27e 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java
@@ -693,7 +693,23 @@ public class JanusGraphGenericDao {
if (modelVertices.isLeft()) {
for (ImmutablePair<JanusGraphVertex, Edge> vertexPair : modelVertices.left().value()) {
- if (model.equals((String)vertexPair.getLeft().property("name").value())) {
+ if (modelVertexMatchesModel(vertexPair.getLeft(), model)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean modelVertexMatchesModel(final JanusGraphVertex modelVertex, final String model) {
+ if (model.equals((String)modelVertex.property("name").value())) {
+ return true;
+ }
+ final Either<List<ImmutablePair<JanusGraphVertex, Edge>>, JanusGraphOperationStatus> derivedModels =
+ getParentVerticies(modelVertex, GraphEdgeLabels.DERIVED_FROM);
+ if (derivedModels.isLeft()) {
+ for (final ImmutablePair<JanusGraphVertex, Edge> derivedModel : derivedModels.left().value()) {
+ if (modelVertexMatchesModel(derivedModel.left, model)) {
return true;
}
}