You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2020/05/30 17:08:44 UTC
[atlas] branch master updated: ATLAS-3806: Classifications
information missing in notification events during entity update/delete
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new ac0cd87 ATLAS-3806: Classifications information missing in notification events during entity update/delete
ac0cd87 is described below
commit ac0cd87ad4818020d012ae5265759891c3860a9a
Author: sidmishra <si...@cloudera.com>
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 <ma...@apache.org>
---
.../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 2ed524f..14876b1 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
@@ -277,7 +277,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());
@@ -299,7 +299,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);
@@ -1853,15 +1853,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;