This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit ac3fd280914d266e1180b1c2413a9874eec9a06a
Author: sidmishra <[email protected]>
AuthorDate: Fri May 22 15:49:28 2020 -0700

    ATLAS-3806: Classifications information missing in notification events 
during entity update/delete
    
    Signed-off-by: Madhan Neethiraj <[email protected]>
    (cherry picked from commit ac0cd87ad4818020d012ae5265759891c3860a9a)
---
 .../atlas/model/instance/EntityMutationResponse.java    |  4 ++--
 .../repository/store/graph/v2/EntityGraphMapper.java    | 17 ++++++-----------
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git 
a/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
 
b/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
index d83f0e0..aa5e8a3 100644
--- 
a/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
+++ 
b/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
@@ -215,10 +215,10 @@ public class EntityMutationResponse {
 
     @JsonIgnore
     public void addEntity(EntityOperation op, AtlasEntityHeader header) {
-        // if an entity is already included in CREATE, ignore subsequent 
UPDATE, PARTIAL_UPDATE
+        // if an entity is already included in CREATE, update the header, to 
capture propagated classifications
         if (op == EntityOperation.UPDATE || op == 
EntityOperation.PARTIAL_UPDATE) {
             if (entityHeaderExists(getCreatedEntities(), header.getGuid())) {
-                return;
+                op = EntityOperation.CREATE;
             }
         }
 
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 ec23db4..779de2a 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
@@ -275,7 +275,7 @@ public class EntityGraphMapper {
                 mapAttributes(createdEntity, entityType, vertex, CREATE, 
context);
                 setCustomAttributes(vertex,createdEntity);
 
-                resp.addEntity(CREATE, constructHeader(createdEntity, 
entityType, vertex));
+                resp.addEntity(CREATE, constructHeader(createdEntity, vertex));
                 addClassifications(context, guid, 
createdEntity.getClassifications());
 
                 addOrUpdateBusinessAttributes(vertex, entityType, 
createdEntity.getBusinessAttributes());
@@ -297,7 +297,7 @@ public class EntityGraphMapper {
                 mapAttributes(updatedEntity, entityType, vertex, updateType, 
context);
                 setCustomAttributes(vertex,updatedEntity);
 
-                resp.addEntity(updateType, constructHeader(updatedEntity, 
entityType, vertex));
+                resp.addEntity(updateType, constructHeader(updatedEntity, 
vertex));
 
                 if (replaceClassifications) {
                     deleteClassifications(guid);
@@ -1843,15 +1843,10 @@ public class EntityGraphMapper {
         }
     }
 
-    private AtlasEntityHeader constructHeader(AtlasEntity entity, final 
AtlasEntityType type, AtlasVertex vertex) {
-        AtlasEntityHeader header = new AtlasEntityHeader(entity.getTypeName());
-
-        header.setGuid(getIdFromVertex(vertex));
-        header.setStatus(entity.getStatus());
-        header.setIsIncomplete(entity.getIsIncomplete());
-
-        for (AtlasAttribute attribute : type.getUniqAttributes().values()) {
-            header.setAttribute(attribute.getName(), 
entity.getAttribute(attribute.getName()));
+    private AtlasEntityHeader constructHeader(AtlasEntity entity, AtlasVertex 
vertex) throws AtlasBaseException {
+        AtlasEntityHeader header = 
entityRetriever.toAtlasEntityHeaderWithClassifications(vertex);
+        if (entity.getClassifications() == null) {
+            entity.setClassifications(header.getClassifications());
         }
 
         return header;

Reply via email to