From 5b93d0c04c2c68cf0e76b958b533673d71cb9219 Mon Sep 17 00:00:00 2001 From: Suman Das <59254445+sumandas0@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:11:29 +0530 Subject: [PATCH 1/3] feat: updated the method by which we were verifying reference --- .../org/apache/atlas/repository/graph/GraphHelper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java index 179d915df9..72b7bd0f7a 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java @@ -540,7 +540,12 @@ public static List getPropagatedVerticesIds (AtlasVertex classificationV } public static boolean hasEntityReferences(AtlasVertex classificationVertex) { - return classificationVertex.hasEdges(AtlasEdgeDirection.IN, CLASSIFICATION_LABEL); + boolean ret = false; + Iterator edgeIterator = classificationVertex.query().direction(AtlasEdgeDirection.IN).label(CLASSIFICATION_LABEL).edges(1).iterator(); + if (edgeIterator != null && edgeIterator.hasNext()) { + ret = true; + } + return ret; } public static List getAllPropagatedEntityVertices(AtlasVertex classificationVertex) { From 7433f402e30088f8a80e450afc0de0af72a18e4b Mon Sep 17 00:00:00 2001 From: Suman Das <59254445+sumandas0@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:13:56 +0530 Subject: [PATCH 2/3] nit: refactor the return --- .../java/org/apache/atlas/repository/graph/GraphHelper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java index 72b7bd0f7a..9ecba372b4 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java @@ -540,12 +540,11 @@ public static List getPropagatedVerticesIds (AtlasVertex classificationV } public static boolean hasEntityReferences(AtlasVertex classificationVertex) { - boolean ret = false; Iterator edgeIterator = classificationVertex.query().direction(AtlasEdgeDirection.IN).label(CLASSIFICATION_LABEL).edges(1).iterator(); if (edgeIterator != null && edgeIterator.hasNext()) { - ret = true; + return true; } - return ret; + return false; } public static List getAllPropagatedEntityVertices(AtlasVertex classificationVertex) { From 2e107006cfaa5cb29fd538b94959377edb775ab5 Mon Sep 17 00:00:00 2001 From: Suman Das <59254445+sumandas0@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:16:07 +0530 Subject: [PATCH 3/3] nit: refactor the return --- .../java/org/apache/atlas/repository/graph/GraphHelper.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java index 9ecba372b4..d5926e8a00 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java @@ -541,10 +541,7 @@ public static List getPropagatedVerticesIds (AtlasVertex classificationV public static boolean hasEntityReferences(AtlasVertex classificationVertex) { Iterator edgeIterator = classificationVertex.query().direction(AtlasEdgeDirection.IN).label(CLASSIFICATION_LABEL).edges(1).iterator(); - if (edgeIterator != null && edgeIterator.hasNext()) { - return true; - } - return false; + return edgeIterator != null && edgeIterator.hasNext(); } public static List getAllPropagatedEntityVertices(AtlasVertex classificationVertex) {