You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sa...@apache.org on 2020/04/14 22:08:03 UTC

[atlas] branch branch-2.0 updated: ATLAS-3730: In case of hard delete and purge set the entity status to Purged at classification

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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 3659d51  ATLAS-3730: In case of hard delete and purge set the entity status to Purged at classification
3659d51 is described below

commit 3659d51dc57be396a97850792312a32b6c3c1e90
Author: sidmishra <si...@cloudera.com>
AuthorDate: Mon Apr 13 16:16:52 2020 -0700

    ATLAS-3730: In case of hard delete and purge set the entity status to Purged at classification
    
    Signed-off-by: Sarath Subramanian <sa...@apache.org>
    (cherry picked from commit eef89a77f8400f32009c226021ec869f427066b6)
---
 intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java  | 2 +-
 .../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);