From fea7d5df41ff656a83e67f7b44b08079a09b68f5 Mon Sep 17 00:00:00 2001 From: PRATHAM2002-DS Date: Mon, 22 Jul 2024 10:57:36 +0530 Subject: [PATCH] skip deleting Titles with active stakeholders --- .../v2/preprocessor/datamesh/DataDomainPreProcessor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataDomainPreProcessor.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataDomainPreProcessor.java index d0317be91d..1aaf69ef75 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataDomainPreProcessor.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataDomainPreProcessor.java @@ -460,9 +460,13 @@ public void processDelete(AtlasVertex vertex) throws AtlasBaseException { AtlasVertex stakeholderTitleVertex = entityRetriever.getEntityVertex(stakeholderTitle.getGuid()); AtlasGraphUtilsV2.removeItemFromListPropertyValue(stakeholderTitleVertex, ATTR_DOMAIN_QUALIFIED_NAMES, vertex.getProperty(QUALIFIED_NAME, String.class)); List domainQualifiedNames = stakeholderTitleVertex.getMultiValuedProperty(ATTR_DOMAIN_QUALIFIED_NAMES, String.class); + if (CollectionUtils.isEmpty(domainQualifiedNames)) { - entityStore.deleteById(stakeholderTitle.getGuid()); - LOG.info("Deleted Stakeholder Title: {}", stakeholderTitle.getGuid()); + Iterator stakeholders = getActiveChildrenVertices(stakeholderTitleVertex, STAKEHOLDER_TITLE_EDGE_LABEL); + if (!stakeholders.hasNext()) { + entityStore.deleteById(stakeholderTitle.getGuid()); + LOG.info("Deleted Stakeholder Title: {}", stakeholderTitle.getGuid()); + } } } }