From eef89a77f8400f32009c226021ec869f427066b6 Mon Sep 17 00:00:00 2001 From: sidmishra <sidmishra@cloudera.com> Date: Mon, 13 Apr 2020 16:16:52 -0700 Subject: [PATCH] ATLAS-3730: In case of hard delete and purge set the entity status to Purged at classification Signed-off-by: Sarath Subramanian <sarath@apache.org> --- intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java | 2 +- repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java index c534fd0..4d8c948 100644 --- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java +++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java @@ -75,7 +75,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable { /** * Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store. */ - public enum Status { ACTIVE, DELETED } + public enum Status { ACTIVE, DELETED, PURGED } private String guid = null; private String homeId = null; diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java index 7b43860..540defc 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java @@ -35,6 +35,7 @@ import org.apache.atlas.repository.graphdb.AtlasEdgeDirection; import org.apache.atlas.repository.graphdb.AtlasVertex; import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2; import org.apache.atlas.repository.store.graph.v2.EntityGraphRetriever; +import org.apache.atlas.store.DeleteType; import org.apache.atlas.type.*; import org.apache.atlas.type.AtlasStructType.AtlasAttribute; import org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection; @@ -50,6 +51,7 @@ import java.util.*; import static org.apache.atlas.model.TypeCategory.*; import static org.apache.atlas.model.instance.AtlasEntity.Status.ACTIVE; import static org.apache.atlas.model.instance.AtlasEntity.Status.DELETED; +import static org.apache.atlas.model.instance.AtlasEntity.Status.PURGED; import static org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags.ONE_TO_TWO; import static org.apache.atlas.repository.Constants.*; import static org.apache.atlas.repository.graph.GraphHelper.getTypeName; @@ -700,7 +702,8 @@ public abstract class DeleteHandlerV1 { if (isClassificationEdge(edge)) { AtlasVertex classificationVertex = edge.getInVertex(); - AtlasGraphUtilsV2.setEncodedProperty(classificationVertex, CLASSIFICATION_ENTITY_STATUS, DELETED.name()); + AtlasGraphUtilsV2.setEncodedProperty(classificationVertex, CLASSIFICATION_ENTITY_STATUS, + RequestContext.get().getDeleteType() == DeleteType.HARD ? PURGED.name() : DELETED.name()); } deleteEdge(edge, force); -- libgit2 0.27.1