Commit eef89a77 by sidmishra Committed by Sarath Subramanian

ATLAS-3730: In case of hard delete and purge set the entity status to Purged at classification

parent 80135a8d
...@@ -75,7 +75,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable { ...@@ -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. * 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 guid = null;
private String homeId = null; private String homeId = null;
......
...@@ -35,6 +35,7 @@ import org.apache.atlas.repository.graphdb.AtlasEdgeDirection; ...@@ -35,6 +35,7 @@ import org.apache.atlas.repository.graphdb.AtlasEdgeDirection;
import org.apache.atlas.repository.graphdb.AtlasVertex; import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2; import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2;
import org.apache.atlas.repository.store.graph.v2.EntityGraphRetriever; 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.*;
import org.apache.atlas.type.AtlasStructType.AtlasAttribute; import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
import org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection; import org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection;
...@@ -50,6 +51,7 @@ import java.util.*; ...@@ -50,6 +51,7 @@ import java.util.*;
import static org.apache.atlas.model.TypeCategory.*; 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.ACTIVE;
import static org.apache.atlas.model.instance.AtlasEntity.Status.DELETED; 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.model.typedef.AtlasRelationshipDef.PropagateTags.ONE_TO_TWO;
import static org.apache.atlas.repository.Constants.*; import static org.apache.atlas.repository.Constants.*;
import static org.apache.atlas.repository.graph.GraphHelper.getTypeName; import static org.apache.atlas.repository.graph.GraphHelper.getTypeName;
...@@ -700,7 +702,8 @@ public abstract class DeleteHandlerV1 { ...@@ -700,7 +702,8 @@ public abstract class DeleteHandlerV1 {
if (isClassificationEdge(edge)) { if (isClassificationEdge(edge)) {
AtlasVertex classificationVertex = edge.getInVertex(); 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); deleteEdge(edge, force);
......
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