From 76ce1864df8831a7a8ee9e9b14dd4e22f6c03c74 Mon Sep 17 00:00:00 2001 From: PRATHAM2002-DS Date: Thu, 6 Mar 2025 22:45:12 +0530 Subject: [PATCH] mesh-363: resolved PR comments --- .../store/graph/v2/EntityGraphMapper.java | 7 +++++-- .../java/org/apache/atlas/RequestContext.java | 21 ------------------- .../EntityNotificationListenerV2.java | 7 ------- 3 files changed, 5 insertions(+), 30 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java index 3c80ef5c6d..a06cc83cbc 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java @@ -2353,8 +2353,11 @@ private void addOrRemoveDaapInternalAttr(AtlasVertex toVertex, String internalAt .filter(guid -> !currentElementGuids.contains(guid)) .collect(Collectors.toList()); } - RequestContext.get().setAddedOutputPorts(addedGuids); - RequestContext.get().setRemovedOutputPorts(removedGuids); + + String productGuid = toVertex.getProperty("__guid", String.class); + AtlasEntity diffEntity = RequestContext.get().getDifferentialEntity(productGuid); + diffEntity.setAddedRelationshipAttribute(OUTPUT_PORTS, addedGuids); + diffEntity.setRemovedRelationshipAttribute(OUTPUT_PORTS, removedGuids); } } diff --git a/server-api/src/main/java/org/apache/atlas/RequestContext.java b/server-api/src/main/java/org/apache/atlas/RequestContext.java index b3ffadd437..7a9f54036b 100644 --- a/server-api/src/main/java/org/apache/atlas/RequestContext.java +++ b/server-api/src/main/java/org/apache/atlas/RequestContext.java @@ -110,8 +110,6 @@ public class RequestContext { private boolean delayTagNotifications = false; private Map> deletedClassificationAndVertices = new HashMap<>(); private Map> addedClassificationAndVertices = new HashMap<>(); - private final List addedOutputPorts = new ArrayList<>(); - private final List removedOutputPorts = new ArrayList<>(); private RequestContext() { @@ -177,8 +175,6 @@ public void clearCache() { this.delayTagNotifications = false; deletedClassificationAndVertices.clear(); addedClassificationAndVertices.clear(); - this.addedOutputPorts.clear(); - this.removedOutputPorts.clear(); if (metrics != null && !metrics.isEmpty()) { METRICS.debug(metrics.toString()); @@ -832,21 +828,4 @@ public void addEdgeLabel(String processEdgeLabel) { public boolean isEdgeLabelAlreadyProcessed(String processEdgeLabel) { return edgeLabels.contains(processEdgeLabel); } - - public void setAddedOutputPorts(List addedOutputPorts) { - this.addedOutputPorts.addAll(addedOutputPorts); - } - - public List getAddedOutputPorts() { - return addedOutputPorts; - } - - public void setRemovedOutputPorts(List removedOutputPorts) { - this.removedOutputPorts.addAll(removedOutputPorts); - } - - public List getRemovedOutputPorts() { - return removedOutputPorts; - } - } \ No newline at end of file diff --git a/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java b/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java index 7d58ed1122..f5fff2ec1f 100644 --- a/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java +++ b/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java @@ -153,9 +153,6 @@ private void notifyEntityEvents(List entities, OperationType operat Map differentialEntities = RequestContext.get().getDifferentialEntitiesMap(); Map requestContextHeaders = RequestContext.get().getRequestContextHeaders(); - List addedOutputPorts = RequestContext.get().getAddedOutputPorts(); - List removedOutputPorts = RequestContext.get().getRemovedOutputPorts(); - List messages = new ArrayList<>(); for (AtlasEntity entity : entities) { @@ -166,10 +163,6 @@ private void notifyEntityEvents(List entities, OperationType operat if(differentialEntities != null){ if (differentialEntities.containsKey(entityGuid)) { - if (differentialEntities.get(entityGuid).hasRelationshipAttribute(OUTPUT_PORTS)) { - differentialEntities.get(entityGuid).setAddedRelationshipAttribute(OUTPUT_PORTS, addedOutputPorts); - differentialEntities.get(entityGuid).setRemovedRelationshipAttribute(OUTPUT_PORTS, removedOutputPorts); - } messages.add(new EntityNotificationV2(toNotificationHeader(entity), differentialEntities.get(entityGuid), operationType, RequestContext.get().getRequestTime(), requestContextHeaders)); }else {