diff options
Diffstat (limited to 'catalog-dao/src/main/java')
-rw-r--r-- | catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphGenericDao.java | 18 |
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; } } |