From 0a7b22fee76a128cdc235664550c98415087b0ee Mon Sep 17 00:00:00 2001 From: aarshi Date: Fri, 1 Dec 2023 10:07:00 +0530 Subject: [PATCH 1/4] Fix updatedBy field in event stream --- .../atlas/repository/store/graph/v2/EntityGraphRetriever.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java index 288764e424..d1af0ad2c3 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java @@ -990,7 +990,7 @@ private AtlasEntityHeader mapVertexToAtlasEntityHeader(AtlasVertex entityVertex, ret.setLabels(getLabels(entityVertex)); ret.setCreatedBy(GraphHelper.getCreatedByAsString(entityVertex)); - ret.setUpdatedBy(GraphHelper.getModifiedByAsString(entityVertex)); + ret.setUpdatedBy(RequestContext.get().getUser()); ret.setCreateTime(new Date(GraphHelper.getCreatedTime(entityVertex))); ret.setUpdateTime(new Date(GraphHelper.getModifiedTime(entityVertex))); From 996cc912a86b686241f5d391f056d61b24c0fff4 Mon Sep 17 00:00:00 2001 From: aarshi Date: Mon, 4 Dec 2023 14:45:55 +0530 Subject: [PATCH 2/4] Move entityHeader update logic in deleteVertices util --- .../atlas/repository/store/graph/v2/AtlasEntityStoreV2.java | 3 +++ .../atlas/repository/store/graph/v2/EntityGraphRetriever.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java index 124ad92218..2b98e2adcb 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java @@ -585,6 +585,7 @@ public EntityMutationResponse deleteById(final String guid) throws AtlasBaseExce AtlasAuthorizationUtils.verifyDeleteEntityAccess(typeRegistry, entityHeader, "delete entity: guid=" + guid); deletionCandidates.add(vertex); + } else { if (LOG.isDebugEnabled()) { // Entity does not exist - treat as non-error, since the caller @@ -1917,6 +1918,8 @@ private EntityMutationResponse deleteVertices(Collection deletionCa } entity.setDeleteHandler(handler); entity.setStatus(Status.DELETED); + // PLT-373 : set current user name + entity.setUpdatedBy(RequestContext.get().getUser()); response.addEntity(DELETE, entity); } diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java index d1af0ad2c3..288764e424 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java @@ -990,7 +990,7 @@ private AtlasEntityHeader mapVertexToAtlasEntityHeader(AtlasVertex entityVertex, ret.setLabels(getLabels(entityVertex)); ret.setCreatedBy(GraphHelper.getCreatedByAsString(entityVertex)); - ret.setUpdatedBy(RequestContext.get().getUser()); + ret.setUpdatedBy(GraphHelper.getModifiedByAsString(entityVertex)); ret.setCreateTime(new Date(GraphHelper.getCreatedTime(entityVertex))); ret.setUpdateTime(new Date(GraphHelper.getModifiedTime(entityVertex))); From 9e58411b4ee3854e1f010d3f07318ba8b7a0b5c4 Mon Sep 17 00:00:00 2001 From: aarshi Date: Mon, 4 Dec 2023 14:47:29 +0530 Subject: [PATCH 3/4] Minor formatting --- .../atlas/repository/store/graph/v2/AtlasEntityStoreV2.java | 1 - 1 file changed, 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java index 2b98e2adcb..befc01785c 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java @@ -585,7 +585,6 @@ public EntityMutationResponse deleteById(final String guid) throws AtlasBaseExce AtlasAuthorizationUtils.verifyDeleteEntityAccess(typeRegistry, entityHeader, "delete entity: guid=" + guid); deletionCandidates.add(vertex); - } else { if (LOG.isDebugEnabled()) { // Entity does not exist - treat as non-error, since the caller From c7db88d6d7627931afacf389caadfe0e9826ca96 Mon Sep 17 00:00:00 2001 From: aarshi Date: Mon, 4 Dec 2023 16:04:49 +0530 Subject: [PATCH 4/4] Remove comments --- .../atlas/repository/store/graph/v2/AtlasEntityStoreV2.java | 1 - 1 file changed, 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java index befc01785c..90702c2808 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java @@ -1917,7 +1917,6 @@ private EntityMutationResponse deleteVertices(Collection deletionCa } entity.setDeleteHandler(handler); entity.setStatus(Status.DELETED); - // PLT-373 : set current user name entity.setUpdatedBy(RequestContext.get().getUser()); response.addEntity(DELETE, entity); }