Commit ac0cd87a by sidmishra Committed by Madhan Neethiraj

ATLAS-3806: Classifications information missing in notification events during entity update/delete

parent 00bef883
...@@ -215,10 +215,10 @@ public class EntityMutationResponse { ...@@ -215,10 +215,10 @@ public class EntityMutationResponse {
@JsonIgnore @JsonIgnore
public void addEntity(EntityOperation op, AtlasEntityHeader header) { 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 (op == EntityOperation.UPDATE || op == EntityOperation.PARTIAL_UPDATE) {
if (entityHeaderExists(getCreatedEntities(), header.getGuid())) { if (entityHeaderExists(getCreatedEntities(), header.getGuid())) {
return; op = EntityOperation.CREATE;
} }
} }
......
...@@ -277,7 +277,7 @@ public class EntityGraphMapper { ...@@ -277,7 +277,7 @@ public class EntityGraphMapper {
mapAttributes(createdEntity, entityType, vertex, CREATE, context); mapAttributes(createdEntity, entityType, vertex, CREATE, context);
setCustomAttributes(vertex,createdEntity); setCustomAttributes(vertex,createdEntity);
resp.addEntity(CREATE, constructHeader(createdEntity, entityType, vertex)); resp.addEntity(CREATE, constructHeader(createdEntity, vertex));
addClassifications(context, guid, createdEntity.getClassifications()); addClassifications(context, guid, createdEntity.getClassifications());
addOrUpdateBusinessAttributes(vertex, entityType, createdEntity.getBusinessAttributes()); addOrUpdateBusinessAttributes(vertex, entityType, createdEntity.getBusinessAttributes());
...@@ -299,7 +299,7 @@ public class EntityGraphMapper { ...@@ -299,7 +299,7 @@ public class EntityGraphMapper {
mapAttributes(updatedEntity, entityType, vertex, updateType, context); mapAttributes(updatedEntity, entityType, vertex, updateType, context);
setCustomAttributes(vertex,updatedEntity); setCustomAttributes(vertex,updatedEntity);
resp.addEntity(updateType, constructHeader(updatedEntity, entityType, vertex)); resp.addEntity(updateType, constructHeader(updatedEntity, vertex));
if (replaceClassifications) { if (replaceClassifications) {
deleteClassifications(guid); deleteClassifications(guid);
...@@ -1853,15 +1853,10 @@ public class EntityGraphMapper { ...@@ -1853,15 +1853,10 @@ public class EntityGraphMapper {
} }
} }
private AtlasEntityHeader constructHeader(AtlasEntity entity, final AtlasEntityType type, AtlasVertex vertex) { private AtlasEntityHeader constructHeader(AtlasEntity entity, AtlasVertex vertex) throws AtlasBaseException {
AtlasEntityHeader header = new AtlasEntityHeader(entity.getTypeName()); AtlasEntityHeader header = entityRetriever.toAtlasEntityHeaderWithClassifications(vertex);
if (entity.getClassifications() == null) {
header.setGuid(getIdFromVertex(vertex)); entity.setClassifications(header.getClassifications());
header.setStatus(entity.getStatus());
header.setIsIncomplete(entity.getIsIncomplete());
for (AtlasAttribute attribute : type.getUniqAttributes().values()) {
header.setAttribute(attribute.getName(), entity.getAttribute(attribute.getName()));
} }
return header; return header;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment