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 2019/02/10 09:16:33 UTC

[atlas] branch branch-0.8 updated: ATLAS-3044: fixed import to handle entity-delete

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

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


The following commit(s) were added to refs/heads/branch-0.8 by this push:
     new b0e93ab  ATLAS-3044: fixed import to handle entity-delete
b0e93ab is described below

commit b0e93ab045ad5d1b3784820f5155ee9516d05af9
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Wed Feb 6 23:51:36 2019 -0800

    ATLAS-3044: fixed import to handle entity-delete
---
 .../apache/atlas/model/instance/AtlasEntity.java   |   8 +
 .../atlas/model/instance/AtlasEntityHeader.java    |  18 ++
 .../graph/DefaultGraphPersistenceStrategy.java     |   6 +-
 .../graph/GraphBackedDiscoveryService.java         |   4 +-
 .../apache/atlas/repository/graph/GraphHelper.java |  79 +++++--
 .../graph/GraphToTypedInstanceMapper.java          | 231 ++++++++++++++-------
 .../graph/v1/AtlasClassificationDefStoreV1.java    |   2 +-
 .../store/graph/v1/AtlasEntityChangeNotifier.java  |  80 +++++++
 .../store/graph/v1/AtlasEntityDefStoreV1.java      |   2 +-
 .../store/graph/v1/AtlasEntityStoreV1.java         |  97 +++++++--
 .../store/graph/v1/AtlasGraphUtilsV1.java          |  22 +-
 .../store/graph/v1/AtlasStructDefStoreV1.java      |   2 +-
 .../repository/store/graph/v1/DeleteHandlerV1.java |  75 ++++---
 .../store/graph/v1/EntityGraphMapper.java          |  64 +++---
 .../store/graph/v1/EntityMutationContext.java      |  31 ++-
 .../java/org/apache/atlas/RequestContextV1.java    |  22 +-
 .../web/resources/AdminExportImportTestIT.java     |  12 +-
 17 files changed, 535 insertions(+), 220 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 0e277b1..35b5750 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
@@ -99,6 +99,14 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
         init();
     }
 
+    public AtlasEntity(AtlasEntityHeader header) {
+        super(header.getTypeName(), header.getAttributes());
+
+        setGuid(header.getGuid());
+        setStatus(header.getStatus());
+        setClassifications(header.getClassifications());
+    }
+
     public AtlasEntity(AtlasEntity other) {
         super(other);
 
diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityHeader.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityHeader.java
index 2b7aa6a..da8b445 100644
--- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityHeader.java
+++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityHeader.java
@@ -18,6 +18,7 @@
 package org.apache.atlas.model.instance;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -31,6 +32,7 @@ import org.apache.atlas.model.PList;
 import org.apache.atlas.model.SearchFilter.SortType;
 import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.apache.commons.collections.CollectionUtils;
 import org.codehaus.jackson.annotate.JsonAutoDetect;
 import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
 import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
@@ -78,11 +80,27 @@ public class AtlasEntityHeader extends AtlasStruct implements Serializable {
 
     public AtlasEntityHeader(String typeName, String guid,  Map<String, Object> attributes) {
         super(typeName, attributes);
+
         setGuid(guid);
         setClassificationNames(null);
         setClassifications(null);
     }
 
+    public AtlasEntityHeader(AtlasEntity entity) {
+        super(entity.getTypeName(), entity.getAttributes());
+
+        setGuid(entity.getGuid());
+        setStatus(entity.getStatus());
+        setClassifications(entity.getClassifications());
+
+        if (CollectionUtils.isNotEmpty(entity.getClassifications())) {
+            this.classificationNames = new ArrayList<>(entity.getClassifications().size());
+
+            for (AtlasClassification classification : entity.getClassifications()) {
+                this.classificationNames.add(classification.getTypeName());
+            }
+        }
+    }
 
     public AtlasEntityHeader(AtlasEntityHeader other) {
         super(other);
diff --git a/repository/src/main/java/org/apache/atlas/discovery/graph/DefaultGraphPersistenceStrategy.java b/repository/src/main/java/org/apache/atlas/discovery/graph/DefaultGraphPersistenceStrategy.java
index 2223224..2ee3c78 100755
--- a/repository/src/main/java/org/apache/atlas/discovery/graph/DefaultGraphPersistenceStrategy.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/graph/DefaultGraphPersistenceStrategy.java
@@ -155,9 +155,9 @@ public class DefaultGraphPersistenceStrategy implements GraphPersistenceStrategi
                 TypeSystem.IdType idType = TypeSystem.getInstance().getIdType();
 
                 if (dataType.getName().equals(idType.getName())) {
-                    structInstance.set(idType.typeNameAttrName(), AtlasGraphUtilsV1.getProperty(structVertex, typeAttributeName(), String.class));
-                    structInstance.set(idType.idAttrName(), AtlasGraphUtilsV1.getProperty(structVertex, idAttributeName(), String.class));
-                    String stateValue = AtlasGraphUtilsV1.getProperty(structVertex, stateAttributeName(), String.class);
+                    structInstance.set(idType.typeNameAttrName(), AtlasGraphUtilsV1.getEncodedProperty(structVertex, typeAttributeName(), String.class));
+                    structInstance.set(idType.idAttrName(), AtlasGraphUtilsV1.getEncodedProperty(structVertex, idAttributeName(), String.class));
+                    String stateValue = AtlasGraphUtilsV1.getEncodedProperty(structVertex, stateAttributeName(), String.class);
                     if (stateValue != null) {
                         structInstance.set(idType.stateAttrName(), stateValue);
                     }
diff --git a/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java b/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
index bcb4030..e5e527f 100755
--- a/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
@@ -235,7 +235,7 @@ public class GraphBackedDiscoveryService implements DiscoveryService {
                 } else if (value instanceof AtlasVertex) {
                     AtlasVertex<?,?> vertex = (AtlasVertex<?,?>)value;
                     for (String key : vertex.getPropertyKeys()) {
-                        Object propertyValue = AtlasGraphUtilsV1.getProperty(vertex,  key);
+                        Object propertyValue = AtlasGraphUtilsV1.getEncodedProperty(vertex,  key);
                         if (propertyValue != null) {
                             oRow.put(key, propertyValue.toString());
                         }
@@ -251,7 +251,7 @@ public class GraphBackedDiscoveryService implements DiscoveryService {
                     oRow.put(GREMLIN_INVERTEX_KEY, edge.getInVertex().getId().toString());
                     oRow.put(GREMLIN_OUTVERTEX_KEY, edge.getOutVertex().getId().toString());
                     for (String propertyKey : edge.getPropertyKeys()) {
-                        oRow.put(propertyKey, AtlasGraphUtilsV1.getProperty(edge, propertyKey).toString());
+                        oRow.put(propertyKey, AtlasGraphUtilsV1.getEncodedProperty(edge, propertyKey).toString());
                     }
                 } else {
                     throw new DiscoveryException(String.format("Cannot process result %s", String.valueOf(value)));
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
index bd8b75e..25cc70f 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
@@ -22,7 +22,9 @@ import com.google.common.annotations.VisibleForTesting;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.RequestContext;
+import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntity.Status;
+import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.RepositoryException;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
@@ -74,6 +76,7 @@ import java.util.Set;
 import java.util.Stack;
 import java.util.UUID;
 
+
 /**
  * Utility class for graph operations.
  */
@@ -89,13 +92,17 @@ public final class GraphHelper {
 
     private static volatile GraphHelper INSTANCE;
 
-    private AtlasGraph graph;
+    private final AtlasGraph                 graph;
+    private final GraphToTypedInstanceMapper graphToInstanceMapper;
+
     private static int maxRetries;
     public static long retrySleepTimeMillis;
 
     @VisibleForTesting
     GraphHelper(AtlasGraph graph) {
-        this.graph = graph;
+        this.graph                 = graph;
+        this.graphToInstanceMapper = new GraphToTypedInstanceMapper(graph);
+
         try {
             maxRetries = ApplicationProperties.get().getInt(RETRY_COUNT, 3);
             retrySleepTimeMillis = ApplicationProperties.get().getLong(RETRY_DELAY, 1000);
@@ -730,24 +737,22 @@ public final class GraphHelper {
      * Guid and AtlasVertex combo
      */
     public static class VertexInfo {
-        private String guid;
-        private AtlasVertex vertex;
-        private String typeName;
+        private final AtlasEntityHeader entity;
+        private final AtlasVertex       vertex;
 
-        public VertexInfo(String guid, AtlasVertex vertex, String typeName) {
-            this.guid = guid;
+        public VertexInfo(AtlasEntityHeader entity, AtlasVertex vertex) {
+            this.entity = entity;
             this.vertex = vertex;
-            this.typeName = typeName;
         }
 
         public String getGuid() {
-            return guid;
+            return entity.getGuid();
         }
         public AtlasVertex getVertex() {
             return vertex;
         }
         public String getTypeName() {
-            return typeName;
+            return entity.getTypeName();
         }
 
         @Override
@@ -755,14 +760,13 @@ public final class GraphHelper {
             if (this == o) return true;
             if (o == null || getClass() != o.getClass()) return false;
             VertexInfo that = (VertexInfo) o;
-            return Objects.equals(guid, that.guid) &&
-                    Objects.equals(vertex, that.vertex) &&
-                    Objects.equals(typeName, that.typeName);
+            return Objects.equals(entity, that.entity) &&
+                    Objects.equals(vertex, that.vertex);
         }
 
         @Override
         public int hashCode() {
-            return Objects.hash(guid, vertex, typeName);
+            return Objects.hash(entity, vertex);
         }
     }
 
@@ -779,16 +783,20 @@ public final class GraphHelper {
         Stack<AtlasVertex> vertices = new Stack<>();
         vertices.push(entityVertex);
         while (vertices.size() > 0) {
-            AtlasVertex vertex = vertices.pop();
-            String typeName = GraphHelper.getTypeName(vertex);
-            String guid = GraphHelper.getGuid(vertex);
-            Id.EntityState state = GraphHelper.getState(vertex);
-            if (state == Id.EntityState.DELETED) {
+            AtlasVertex        vertex   = vertices.pop();
+            AtlasEntityHeader  entity   = toAtlasEntityHeader(vertex);
+            String             typeName = entity.getTypeName();
+            AtlasEntity.Status state    = entity.getStatus();
+
+            if (state == Status.DELETED) {
                 //If the reference vertex is marked for deletion, skip it
                 continue;
             }
-            result.add(new VertexInfo(guid, vertex, typeName));
+
+            result.add(new VertexInfo(entity, vertex));
+
             ClassType classType = typeSystem.getDataType(ClassType.class, typeName);
+
             for (AttributeInfo attributeInfo : classType.fieldMapping().fields.values()) {
                 if (!attributeInfo.isComposite) {
                     continue;
@@ -1066,4 +1074,35 @@ public final class GraphHelper {
 
         return condition.toString();
     }
+
+    private AtlasEntityHeader toAtlasEntityHeader(AtlasVertex vertex) {
+        AtlasEntityHeader ret = new AtlasEntityHeader();
+
+        ret.setGuid(GraphHelper.getGuid(vertex));
+        ret.setTypeName(GraphHelper.getTypeName(vertex));
+        ret.setStatus(GraphHelper.getStatus(vertex));
+
+        try {
+            ClassType      classType = typeSystem.getDataType(ClassType.class, ret.getTypeName());
+            ITypedInstance entity    = classType.createInstance();
+
+            for (AttributeInfo attributeInfo : classType.fieldMapping().fields.values()) {
+                if (attributeInfo.isUnique || "clusterName".equals(attributeInfo.name)) {
+                    try {
+                        Object attrValue = graphToInstanceMapper.mapVertexToAttribute(vertex, entity, attributeInfo);
+
+                        if (attrValue != null) {
+                            ret.setAttribute(attributeInfo.name, attrValue);
+                        }
+                    } catch (AtlasException excp) {
+                        LOG.error("Failed to get uniqueAttribute value: entityGuid={}, attrName={}", ret.getGuid(), attributeInfo.name, excp);
+                    }
+                }
+            }
+        } catch (AtlasException excp) {
+            LOG.error("Failed to create instance of type {}", ret.getTypeName(), excp);
+        }
+
+        return ret;
+    }
 }
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
index 16a7537..638078c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
@@ -138,56 +138,67 @@ public final class GraphToTypedInstanceMapper {
         }
     }
 
-    private void mapVertexToAttribute(AtlasVertex instanceVertex, ITypedInstance typedInstance,
+    public Object mapVertexToAttribute(AtlasVertex instanceVertex, ITypedInstance typedInstance,
         AttributeInfo attributeInfo) throws AtlasException {
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("Mapping attributeInfo {}", attributeInfo.name);
         }
 
+        final Object    ret;
         final IDataType dataType = attributeInfo.dataType();
         final String vertexPropertyName = GraphHelper.getQualifiedFieldName(typedInstance, attributeInfo);
         String relationshipLabel = GraphHelper.getEdgeLabel(typedInstance, attributeInfo);
 
         switch (dataType.getTypeCategory()) {
         case PRIMITIVE:
-            mapVertexToPrimitive(instanceVertex, typedInstance, attributeInfo);
+            ret = mapVertexToPrimitive(instanceVertex, typedInstance, attributeInfo);
             break;  // add only if vertex has this attribute
 
         case ENUM:
-            mapVertexToEnum(instanceVertex, typedInstance, attributeInfo);
+            ret = mapVertexToEnum(instanceVertex, typedInstance, attributeInfo);
             break;
 
         case ARRAY:
-            mapVertexToArrayInstance(instanceVertex, typedInstance, attributeInfo, vertexPropertyName);
+            ret = mapVertexToArrayInstance(instanceVertex, typedInstance, attributeInfo, vertexPropertyName);
             break;
 
         case MAP:
-            mapVertexToMapInstance(instanceVertex, typedInstance, attributeInfo, vertexPropertyName);
+            ret = mapVertexToMapInstance(instanceVertex, typedInstance, attributeInfo, vertexPropertyName);
             break;
 
         case STRUCT:
             ITypedStruct structInstance = mapVertexToStructInstance(instanceVertex,
                     (StructType) attributeInfo.dataType(), relationshipLabel, null);
+
+            ret = structInstance;
+
             typedInstance.set(attributeInfo.name, structInstance);
             break;
 
         case TRAIT:
+            ret = null;
             // do NOTHING - handled in class
             break;
 
         case CLASS:
             AtlasEdge nullEdge = null;
-            Object idOrInstance = mapVertexToClassReference(instanceVertex, attributeInfo, relationshipLabel,
-                attributeInfo.dataType(), nullEdge);
+            Object idOrInstance = mapVertexToClassReference(instanceVertex, attributeInfo, relationshipLabel, attributeInfo.dataType(), nullEdge);
+
+            ret = idOrInstance;
+
             if (idOrInstance != null) {
                 typedInstance.set(attributeInfo.name, idOrInstance);
             }
             break;
 
         default:
+            ret = null;
+
             break;
         }
+
+        return  ret;
     }
 
     private Object mapVertexToClassReference(AtlasVertex instanceVertex, AttributeInfo attributeInfo,
@@ -237,41 +248,45 @@ public final class GraphToTypedInstanceMapper {
     }
 
     @SuppressWarnings("unchecked")
-    private void mapVertexToArrayInstance(AtlasVertex<?,?> instanceVertex, ITypedInstance typedInstance,
+    private List mapVertexToArrayInstance(AtlasVertex<?,?> instanceVertex, ITypedInstance typedInstance,
             AttributeInfo attributeInfo, String propertyName) throws AtlasException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("mapping vertex {} to array {}", instanceVertex, attributeInfo.name);
         }
 
+        final ArrayList           ret;
         final DataTypes.ArrayType arrayType = (DataTypes.ArrayType) attributeInfo.dataType();
         final IDataType elementType = arrayType.getElemType();
 
         List<Object> list = GraphHelper.getArrayElementsProperty(elementType, instanceVertex, propertyName);
 
-        if (list == null || list.size() == 0) {
-            return;
-        }
+        if (list != null && list.size() > 0) {
+            ret = new ArrayList();
 
-        ArrayList values = new ArrayList();
-        if(!attributeInfo.isSoftRef) {
-            String edgeLabel = GraphHelper.EDGE_LABEL_PREFIX + propertyName;
-            for (Object aList : list) {
-                values.add(mapVertexToCollectionEntry(instanceVertex, attributeInfo, elementType, aList,
-                        edgeLabel));
-            }
-        } else {
-            for (Object o : list) {
-                if(o == null) {
-                    continue;
+            if (!attributeInfo.isSoftRef) {
+                String edgeLabel = GraphHelper.EDGE_LABEL_PREFIX + propertyName;
+                for (Object aList : list) {
+                    ret.add(mapVertexToCollectionEntry(instanceVertex, attributeInfo, elementType, aList,
+                            edgeLabel));
                 }
+            } else {
+                for (Object o : list) {
+                    if (o == null) {
+                        continue;
+                    }
 
-                values.add(o);
+                    ret.add(o);
+                }
             }
-        }
 
-        if (values.size() > 0) {
-            typedInstance.set(attributeInfo.name, values);
+            if (ret.size() > 0) {
+                typedInstance.set(attributeInfo.name, ret);
+            }
+        } else {
+            ret = null;
         }
+
+        return ret == null || ret.size() == 0 ? null : ret;
     }
 
     private Object mapVertexToCollectionEntry(AtlasVertex instanceVertex, AttributeInfo attributeInfo,
@@ -301,33 +316,39 @@ public final class GraphToTypedInstanceMapper {
     }
 
     @SuppressWarnings("unchecked")
-    private void mapVertexToMapInstance(AtlasVertex<?,?> instanceVertex, ITypedInstance typedInstance,
+    private Map<String, Object> mapVertexToMapInstance(AtlasVertex<?,?> instanceVertex, ITypedInstance typedInstance,
             AttributeInfo attributeInfo, final String propertyName) throws AtlasException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("mapping vertex {} to array {}", instanceVertex, attributeInfo.name);
         }
 
-        List<String> keys = GraphHelper.getListProperty(instanceVertex, propertyName);
-        if (keys == null || keys.size() == 0) {
-            return;
-        }
-        DataTypes.MapType mapType = (DataTypes.MapType) attributeInfo.dataType();
-        final IDataType valueType = mapType.getValueType();
-
-        HashMap<String,Object> values = new HashMap<>();
-        for (String key : keys) {
-            final String keyPropertyName = propertyName + "." + key;
-            final String edgeLabel = GraphHelper.EDGE_LABEL_PREFIX + keyPropertyName;
-            final Object keyValue = GraphHelper.getMapValueProperty(valueType, instanceVertex, keyPropertyName);
-            Object mapValue = mapVertexToCollectionEntry(instanceVertex, attributeInfo, valueType, keyValue, edgeLabel);
-            if (mapValue != null) {
-                values.put(key, mapValue);
+        final Map<String,Object> ret;
+        List<String>             keys = GraphHelper.getListProperty(instanceVertex, propertyName);
+
+        if (keys != null && keys.size() > 0) {
+            ret = new HashMap<>();
+
+            DataTypes.MapType mapType = (DataTypes.MapType) attributeInfo.dataType();
+            final IDataType valueType = mapType.getValueType();
+
+            for (String key : keys) {
+                final String keyPropertyName = propertyName + "." + key;
+                final String edgeLabel = GraphHelper.EDGE_LABEL_PREFIX + keyPropertyName;
+                final Object keyValue = GraphHelper.getMapValueProperty(valueType, instanceVertex, keyPropertyName);
+                Object mapValue = mapVertexToCollectionEntry(instanceVertex, attributeInfo, valueType, keyValue, edgeLabel);
+                if (mapValue != null) {
+                    ret.put(key, mapValue);
+                }
             }
-        }
 
-        if (!values.isEmpty()) {
-            typedInstance.set(attributeInfo.name, values);
+            if (!ret.isEmpty()) {
+                typedInstance.set(attributeInfo.name, ret);
+            }
+        } else {
+            ret = null;
         }
+
+        return ret == null || ret.size() == 0 ? null : ret;
     }
 
     private  ITypedStruct mapVertexToStructInstance(AtlasVertex instanceVertex, StructType structType,
@@ -387,52 +408,108 @@ public final class GraphToTypedInstanceMapper {
         }
     }
 
-    public static void mapVertexToPrimitive(AtlasVertex<?,?> instanceVertex, ITypedInstance typedInstance,
+    public static Object mapVertexToPrimitive(AtlasVertex<?,?> instanceVertex, ITypedInstance typedInstance,
             AttributeInfo attributeInfo) throws AtlasException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("Adding primitive {} from vertex {}", attributeInfo, instanceVertex);
         }
 
+        final Object ret;
+
         final String vertexPropertyName = GraphHelper.getQualifiedFieldName(typedInstance, attributeInfo);
-        if (AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Object.class) == null) {
-            return;
-        }
 
-        if (attributeInfo.dataType() == DataTypes.STRING_TYPE) {
-            typedInstance.setString(attributeInfo.name, AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, String.class));
-        } else if (attributeInfo.dataType() == DataTypes.SHORT_TYPE) {
-            typedInstance.setShort(attributeInfo.name, AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Short.class));
-        } else if (attributeInfo.dataType() == DataTypes.INT_TYPE) {
-            typedInstance.setInt(attributeInfo.name, AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Integer.class));
-        } else if (attributeInfo.dataType() == DataTypes.BIGINTEGER_TYPE) {
-            typedInstance.setBigInt(attributeInfo.name, AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, BigInteger.class));
-        } else if (attributeInfo.dataType() == DataTypes.BOOLEAN_TYPE) {
-            typedInstance.setBoolean(attributeInfo.name, AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Boolean.class));
-        } else if (attributeInfo.dataType() == DataTypes.BYTE_TYPE) {
-            typedInstance.setByte(attributeInfo.name, AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Byte.class));
-        } else if (attributeInfo.dataType() == DataTypes.LONG_TYPE) {
-            typedInstance.setLong(attributeInfo.name, AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Long.class));
-        } else if (attributeInfo.dataType() == DataTypes.FLOAT_TYPE) {
-            typedInstance.setFloat(attributeInfo.name, AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Float.class));
-        } else if (attributeInfo.dataType() == DataTypes.DOUBLE_TYPE) {
-            typedInstance.setDouble(attributeInfo.name, AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Double.class));
-        } else if (attributeInfo.dataType() == DataTypes.BIGDECIMAL_TYPE) {
-            typedInstance
-            .setBigDecimal(attributeInfo.name, AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, BigDecimal.class));
-        } else if (attributeInfo.dataType() == DataTypes.DATE_TYPE) {
-            final Long dateVal = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Long.class);
-            typedInstance.setDate(attributeInfo.name, new Date(dateVal));
+        if (AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Object.class) != null) {
+            if (attributeInfo.dataType() == DataTypes.STRING_TYPE) {
+                String attrValue = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, String.class);
+
+                typedInstance.setString(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else if (attributeInfo.dataType() == DataTypes.SHORT_TYPE) {
+                Short attrValue = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Short.class);
+
+                typedInstance.setShort(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else if (attributeInfo.dataType() == DataTypes.INT_TYPE) {
+                Integer attrValue = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Integer.class);
+
+                typedInstance.setInt(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else if (attributeInfo.dataType() == DataTypes.BIGINTEGER_TYPE) {
+                BigInteger attrValue = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, BigInteger.class);
+
+                typedInstance.setBigInt(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else if (attributeInfo.dataType() == DataTypes.BOOLEAN_TYPE) {
+                Boolean attrValue = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Boolean.class);
+
+                typedInstance.setBoolean(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else if (attributeInfo.dataType() == DataTypes.BYTE_TYPE) {
+                Byte attrValue = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Byte.class);
+
+                typedInstance.setByte(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else if (attributeInfo.dataType() == DataTypes.LONG_TYPE) {
+                Long attrValue = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Long.class);
+
+                typedInstance.setLong(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else if (attributeInfo.dataType() == DataTypes.FLOAT_TYPE) {
+                Float attrValue = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Float.class);
+
+                typedInstance.setFloat(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else if (attributeInfo.dataType() == DataTypes.DOUBLE_TYPE) {
+                Double attrValue = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Double.class);
+
+                typedInstance.setDouble(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else if (attributeInfo.dataType() == DataTypes.BIGDECIMAL_TYPE) {
+                BigDecimal attrValue = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, BigDecimal.class);
+
+                typedInstance.setBigDecimal(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else if (attributeInfo.dataType() == DataTypes.DATE_TYPE) {
+                final Long dateVal   = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName, Long.class);
+                Date       attrValue = new Date(dateVal);
+
+                typedInstance.setDate(attributeInfo.name, attrValue);
+
+                ret = attrValue;
+            } else {
+                ret = null;
+            }
+        } else {
+            ret = null;
         }
+
+        return ret;
     }
 
-    public static void mapVertexToEnum(AtlasVertex<?,?> instanceVertex, ITypedInstance typedInstance, AttributeInfo attributeInfo) throws AtlasException {
+    public static Object mapVertexToEnum(AtlasVertex<?,?> instanceVertex, ITypedInstance typedInstance, AttributeInfo attributeInfo) throws AtlasException {
         final String vertexPropertyName = GraphHelper.getQualifiedFieldName(typedInstance, attributeInfo);
         final Object propertyValue      = AtlasGraphUtilsV1.getProperty(instanceVertex, vertexPropertyName);
-        if (propertyValue == null) {
-            return;
+        final Object ret;
+
+        if (propertyValue != null) {
+            ret = attributeInfo.dataType().convert(propertyValue, Multiplicity.REQUIRED);
+
+            typedInstance.set(attributeInfo.name, ret);
+        } else {
+            ret = null;
         }
 
-        typedInstance.set(attributeInfo.name, attributeInfo.dataType().convert(propertyValue, Multiplicity.REQUIRED));
+        return ret;
     }
 
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
index e3aa4e0..180c80c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
@@ -281,7 +281,7 @@ class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasClassif
 
         AtlasVertex ret = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.TRAIT);
 
-        String typeName = AtlasGraphUtilsV1.getProperty(ret, Constants.TYPENAME_PROPERTY_KEY, String.class);
+        String typeName = AtlasGraphUtilsV1.getEncodedProperty(ret, Constants.TYPENAME_PROPERTY_KEY, String.class);
 
         if (AtlasGraphUtilsV1.typeHasInstanceVertex(typeName)) {
             throw new AtlasBaseException(AtlasErrorCode.TYPE_HAS_REFERENCES, typeName);
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
index 054ebd1..95fa045 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
@@ -25,6 +25,7 @@ import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.listener.EntityChangeListener;
 import org.apache.atlas.metrics.Metrics.MetricRecorder;
 import org.apache.atlas.model.instance.AtlasClassification;
+import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.EntityMutations.EntityOperation;
@@ -51,6 +52,7 @@ import javax.inject.Inject;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Set;
 
 
@@ -79,6 +81,8 @@ public class AtlasEntityChangeNotifier {
             return;
         }
 
+        pruneResponse(entityMutationResponse);
+
         List<AtlasEntityHeader> createdEntities          = entityMutationResponse.getCreatedEntities();
         List<AtlasEntityHeader> updatedEntities          = entityMutationResponse.getUpdatedEntities();
         List<AtlasEntityHeader> partiallyUpdatedEntities = entityMutationResponse.getPartialUpdatedEntities();
@@ -336,4 +340,80 @@ public class AtlasEntityChangeNotifier {
             throw AtlasInstanceConverter.toAtlasBaseException(excp);
         }
     }
+
+    private void pruneResponse(EntityMutationResponse resp) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> pruneResponse()");
+        }
+
+        List<AtlasEntityHeader> createdEntities        = resp.getCreatedEntities();
+        List<AtlasEntityHeader> updatedEntities        = resp.getUpdatedEntities();
+        List<AtlasEntityHeader> partialUpdatedEntities = resp.getPartialUpdatedEntities();
+        List<AtlasEntityHeader> deletedEntities        = resp.getDeletedEntities();
+
+        // remove entities with DELETED status from created & updated lists
+        purgeDeletedEntities(createdEntities);
+        purgeDeletedEntities(updatedEntities);
+        purgeDeletedEntities(partialUpdatedEntities);
+
+        // remove entities deleted in this mutation from created & updated lists
+        if (deletedEntities != null) {
+            for (AtlasEntityHeader entity : deletedEntities) {
+                purgeEntity(entity.getGuid(), createdEntities);
+                purgeEntity(entity.getGuid(), updatedEntities);
+                purgeEntity(entity.getGuid(), partialUpdatedEntities);
+            }
+        }
+
+        // remove entities created in this mutation from updated lists
+        if (createdEntities != null) {
+            for (AtlasEntityHeader entity : createdEntities) {
+                purgeEntity(entity.getGuid(),updatedEntities);
+                purgeEntity(entity.getGuid(), partialUpdatedEntities);
+            }
+        }
+
+        // remove entities updated in this mutation from partial-updated list
+        if (updatedEntities != null) {
+            for (AtlasEntityHeader entity : updatedEntities) {
+                purgeEntity(entity.getGuid(), partialUpdatedEntities);
+            }
+        }
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== pruneResponse()");
+        }
+    }
+
+    private void purgeDeletedEntities(List<AtlasEntityHeader> entities) {
+        if (entities != null) {
+            for (ListIterator<AtlasEntityHeader> iter = entities.listIterator(); iter.hasNext(); ) {
+                AtlasEntityHeader entity = iter.next();
+
+                if (entity.getStatus() == AtlasEntity.Status.DELETED) {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("purgeDeletedEntities(guid={}, status={}): REMOVED", entity.getGuid(), entity.getStatus());
+                    }
+
+                    iter.remove();
+                }
+            }
+        }
+    }
+
+    private void purgeEntity(String guid, List<AtlasEntityHeader> entities) {
+        if (guid != null && entities != null) {
+            for (ListIterator<AtlasEntityHeader> iter = entities.listIterator(); iter.hasNext(); ) {
+                AtlasEntityHeader entity = iter.next();
+
+                if (org.apache.commons.lang.StringUtils.equals(guid, entity.getGuid())) {
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("purgeEntity(guid={}): REMOVED", entity.getGuid());
+                    }
+
+                    iter.remove();
+                }
+            }
+        }
+    }
 }
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
index 5fca674..c8c6e0a 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
@@ -275,7 +275,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEntityDe
 
         AtlasVertex ret = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.CLASS);
 
-        String typeName = AtlasGraphUtilsV1.getProperty(ret, Constants.TYPENAME_PROPERTY_KEY, String.class);
+        String typeName = AtlasGraphUtilsV1.getEncodedProperty(ret, Constants.TYPENAME_PROPERTY_KEY, String.class);
 
         if (AtlasGraphUtilsV1.typeHasInstanceVertex(typeName)) {
             throw new AtlasBaseException(AtlasErrorCode.TYPE_HAS_REFERENCES, typeName);
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
index c783f81..96b7667 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
@@ -530,6 +530,10 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
     @Override
     @GraphTransaction
     public void addClassifications(final String guid, final List<AtlasClassification> classifications) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Adding classifications={} to entity={}", classifications, guid);
+        }
+
         if (StringUtils.isEmpty(guid)) {
             throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "Guid(s) not specified");
         }
@@ -537,10 +541,17 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
             throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "classifications(s) not specified");
         }
 
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Adding classifications={} to entity={}", classifications, guid);
+        AtlasVertex entityVertex = AtlasGraphUtilsV1.findByGuid(guid);
+
+        if (entityVertex == null) {
+            throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
         }
 
+        String                entityType = AtlasGraphUtilsV1.getTypeName(entityVertex);
+        EntityMutationContext context    = new EntityMutationContext();
+
+        context.cacheEntity(guid, entityVertex, typeRegistry.getEntityTypeByName(entityType));
+
         GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guid);
         for (AtlasClassification classification : classifications) {
             validateAndNormalize(classification);
@@ -549,7 +560,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
         // validate if entity, not already associated with classifications
         validateEntityAssociations(guid, classifications);
 
-        entityGraphMapper.addClassifications(new EntityMutationContext(), guid, classifications);
+        entityGraphMapper.addClassifications(context, guid, classifications);
 
         // notify listeners on classification addition
         entityChangeNotifier.onClassificationAddedToEntity(guid, classifications);
@@ -570,6 +581,17 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
             throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "classifications(s) not specified");
         }
 
+        AtlasVertex entityVertex = AtlasGraphUtilsV1.findByGuid(guid);
+
+        if (entityVertex == null) {
+            throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
+        }
+
+        String                entityType = AtlasGraphUtilsV1.getTypeName(entityVertex);
+        EntityMutationContext context    = new EntityMutationContext();
+
+        context.cacheEntity(guid, entityVertex, typeRegistry.getEntityTypeByName(entityType));
+
         GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guid);
         List<AtlasClassification> updatedClassifications = new ArrayList<>();
 
@@ -591,7 +613,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
                 }
             }
 
-            entityGraphMapper.updateClassification(new EntityMutationContext(), guid, oldClassification);
+            entityGraphMapper.updateClassification(context, guid, oldClassification);
 
             updatedClassifications.add(oldClassification);
         }
@@ -603,6 +625,10 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
     @Override
     @GraphTransaction
     public void addClassification(final List<String> guids, final AtlasClassification classification) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Adding classification={} to entities={}", classification, guids);
+        }
+
         if (CollectionUtils.isEmpty(guids)) {
             throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "Guid(s) not specified");
         }
@@ -610,21 +636,28 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
             throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "classification not specified");
         }
 
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Adding classification={} to entities={}", classification, guids);
-        }
-
         GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guids);
 
         validateAndNormalize(classification);
 
         List<AtlasClassification> classifications = Collections.singletonList(classification);
+        EntityMutationContext context = new EntityMutationContext();
 
         for (String guid : guids) {
+            AtlasVertex entityVertex = AtlasGraphUtilsV1.findByGuid(guid);
+
+            if (entityVertex == null) {
+                throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
+            }
+
+            String entityType = AtlasGraphUtilsV1.getTypeName(entityVertex);
+
+            context.cacheEntity(guid, entityVertex, typeRegistry.getEntityTypeByName(entityType));
+
             // validate if entity, not already associated with classifications
             validateEntityAssociations(guid, classifications);
 
-            entityGraphMapper.addClassifications(new EntityMutationContext(), guid, classifications);
+            entityGraphMapper.addClassifications(context, guid, classifications);
 
             // notify listeners on classification addition
             entityChangeNotifier.onClassificationAddedToEntity(guid, classifications);
@@ -635,6 +668,10 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
     @Override
     @GraphTransaction
     public void deleteClassifications(final String guid, final List<String> classificationNames) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Deleting classifications={} from entity={}", classificationNames, guid);
+        }
+
         if (StringUtils.isEmpty(guid)) {
             throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "Guid(s) not specified");
         }
@@ -642,13 +679,20 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
             throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "classifications(s) not specified");
         }
 
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Deleting classifications={} from entity={}", classificationNames, guid);
+        AtlasVertex entityVertex = AtlasGraphUtilsV1.findByGuid(guid);
+
+        if (entityVertex == null) {
+            throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
         }
 
+        String                entityType = AtlasGraphUtilsV1.getTypeName(entityVertex);
+        EntityMutationContext context    = new EntityMutationContext();
+
+        context.cacheEntity(guid, entityVertex, typeRegistry.getEntityTypeByName(entityType));
+
         GraphTransactionInterceptor.lockObjectAndReleasePostCommit(guid);
 
-        entityGraphMapper.deleteClassifications(guid, classificationNames);
+        entityGraphMapper.deleteClassifications(context, guid, classificationNames);
 
         // notify listeners on classification deletion
         entityChangeNotifier.onClassificationDeletedFromEntity(guid, classificationNames);
@@ -699,8 +743,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
                     }
 
                     AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entity.getTypeName());
-
-                    String guidVertex = AtlasGraphUtilsV1.getIdFromVertex(vertex);
+                    String          guidVertex = AtlasGraphUtilsV1.getIdFromVertex(vertex);
 
                     if (!StringUtils.equals(guidVertex, guid)) { // if entity was found by unique attribute
                         entity.setGuid(guidVertex);
@@ -736,6 +779,24 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
 
                 // during import, update the system attributes
                 if (entityStream instanceof EntityImportStream) {
+                    AtlasEntity.Status newStatus = entity.getStatus();
+
+                    if (newStatus != null) {
+                        AtlasEntity.Status currStatus = AtlasGraphUtilsV1.getState(vertex);
+
+                        if (currStatus == AtlasEntity.Status.ACTIVE && newStatus == AtlasEntity.Status.DELETED) {
+                            if (LOG.isDebugEnabled()) {
+                                LOG.debug("entity-delete via import - guid={}", guid);
+                            }
+
+                            context.addEntityToDelete(vertex);
+                        } else if (currStatus == AtlasEntity.Status.DELETED && newStatus == AtlasEntity.Status.ACTIVE) {
+                            LOG.warn("attempt to activate deleted entity (guid={}). Ignored", guid);
+
+                            entity.setStatus(currStatus);
+                        }
+                    }
+
                     entityGraphMapper.updateSystemAttributes(vertex, entity);
                 }
             }
@@ -775,12 +836,12 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
         EntityMutationResponse response = new EntityMutationResponse();
         deleteDelegate.getHandlerV1().deleteEntities(deletionCandidates);
         RequestContextV1 req = RequestContextV1.get();
-        for (AtlasObjectId id : req.getDeletedEntities()) {
-            response.addEntity(DELETE, EntityGraphMapper.constructHeader(id));
+        for (AtlasEntityHeader entity : req.getDeletedEntities()) {
+            response.addEntity(DELETE, entity);
         }
 
-        for (AtlasObjectId id : req.getUpdatedEntities()) {
-            response.addEntity(UPDATE, EntityGraphMapper.constructHeader(id));
+        for (AtlasEntityHeader entity : req.getUpdatedEntities()) {
+            response.addEntity(UPDATE, entity);
         }
 
         return response;
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
index 03d94ce..bd3ba3c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
@@ -209,11 +209,7 @@ public class AtlasGraphUtilsV1 {
             return vertex.getPropertyValues(encodePropertyName, String.class);
         }
 
-        return vertex.getProperty(encodePropertyKey(propertyName), Object.class);
-    }
-
-    public static <T extends AtlasElement> Object getProperty(T element, String propertyName) {
-        return element.getProperty(encodePropertyKey(propertyName), Object.class);
+        return vertex.getProperty(encodePropertyName, Object.class);
     }
 
     public static <T extends AtlasElement, O> O getProperty(T element, String propertyName, Class<O> returnType) {
@@ -230,6 +226,22 @@ public class AtlasGraphUtilsV1 {
         return returnType.cast(property);
     }
 
+    public static <T extends AtlasVertex> Object getEncodedProperty(T vertex, String propertyName) {
+        if(AtlasGraphProvider.getGraphInstance().isMultiProperty(propertyName)) {
+            return vertex.getPropertyValues(propertyName, String.class);
+        }
+
+        return vertex.getProperty(propertyName, Object.class);
+    }
+
+    public static <T extends AtlasEdge> Object getEncodedProperty(T edge, String propertyName) {
+        if(AtlasGraphProvider.getGraphInstance().isMultiProperty(propertyName)) {
+            return edge.getPropertyValues(propertyName, String.class);
+        }
+
+        return edge.getProperty(propertyName, Object.class);
+    }
+
     public static AtlasVertex getVertexByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> attrValues) throws AtlasBaseException {
         AtlasVertex vertex = findByUniqueAttributes(entityType, attrValues);
 
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
index 9b2350d..7167b6c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
@@ -289,7 +289,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
 
         AtlasVertex ret = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.STRUCT);
 
-        String typeName = AtlasGraphUtilsV1.getProperty(ret, Constants.TYPENAME_PROPERTY_KEY, String.class);
+        String typeName = AtlasGraphUtilsV1.getEncodedProperty(ret, Constants.TYPENAME_PROPERTY_KEY, String.class);
 
         if (AtlasGraphUtilsV1.typeHasInstanceVertex(typeName)) {
             throw new AtlasBaseException(AtlasErrorCode.TYPE_HAS_REFERENCES, typeName);
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 579758a..f70e845 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
@@ -25,6 +25,7 @@ import org.apache.atlas.RequestContextV1;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.TypeCategory;
 import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.atlas.model.instance.AtlasObjectId;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
 import org.apache.atlas.repository.Constants;
@@ -115,21 +116,11 @@ public abstract class DeleteHandlerV1 {
             // Record all deletion candidate GUIDs in RequestContext
             // and gather deletion candidate vertices.
             for (GraphHelper.VertexInfo vertexInfo : compositeVertices) {
-                AtlasEntityType     entityType = typeRegistry.getEntityTypeByName(vertexInfo.getTypeName());
-                AtlasEntity         entity     = entityGraphRetriever.toAtlasEntity(vertexInfo.getVertex());
-                Map<String, Object> attributes = null;
-
-                if (entityType != null && MapUtils.isNotEmpty(entityType.getUniqAttributes())) {
-                    attributes = new HashMap<>();
-
-                    for (AtlasAttribute attribute : entityType.getUniqAttributes().values()) {
-                        Object attrVal = entity.getAttribute(attribute.getName());
-
-                        if (attrVal != null) {
-                            attributes.put(attribute.getName(), attrVal);
-                        }
-                    }
+                AtlasEntityType     entityType   = typeRegistry.getEntityTypeByName(vertexInfo.getTypeName());
+                AtlasEntity         entity       = entityGraphRetriever.toAtlasEntity(vertexInfo.getVertex());
+                AtlasEntityHeader   entityHeader = new AtlasEntityHeader(entity);
 
+                if (entityType != null) {
                     // include clusterName attribute as well, if it is defined in the entity-type
                     AtlasAttribute attrClusterName = entityType.getAttribute(AtlasConstants.CLUSTER_NAME_ATTRIBUTE);
 
@@ -137,13 +128,13 @@ public abstract class DeleteHandlerV1 {
                         Object clusterName = entity.getAttribute(AtlasConstants.CLUSTER_NAME_ATTRIBUTE);
 
                         if (clusterName != null) {
-                            attributes.put(attrClusterName.getName(), clusterName);
+                            entityHeader.setAttribute(attrClusterName.getName(), clusterName);
                         }
                     }
                 }
 
                 requestContext.cache(entity);
-                requestContext.recordEntityDelete(new AtlasObjectId(vertexInfo.getGuid(), vertexInfo.getTypeName(), attributes));
+                requestContext.recordEntityDelete(entityHeader);
                 deletionCandidateVertices.add(vertexInfo.getVertex());
             }
         }
@@ -176,11 +167,11 @@ public abstract class DeleteHandlerV1 {
                 continue;
             }
 
-            String typeName = GraphHelper.getTypeName(vertex);
-            String guid = GraphHelper.getGuid(vertex);
+            AtlasEntityHeader entity     = entityGraphRetriever.toAtlasEntityHeader(vertex);
+            String            typeName   = entity.getTypeName();
+            AtlasEntityType   entityType = typeRegistry.getEntityTypeByName(typeName);
 
-            result.add(new GraphHelper.VertexInfo(guid, vertex, typeName));
-            AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName);
+            result.add(new GraphHelper.VertexInfo(entity, vertex));
 
             if (entityType == null) {
                 throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, TypeCategory.ENTITY.name(), typeName);
@@ -297,7 +288,11 @@ public abstract class DeleteHandlerV1 {
      */
     public boolean deleteEdgeReference(AtlasEdge edge, TypeCategory typeCategory, boolean isOwned,
         boolean forceDeleteStructTrait) throws AtlasBaseException {
-        LOG.debug("Deleting {}", string(edge));
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Deleting {}", string(edge));
+        }
+
         boolean forceDelete =
             (typeCategory == TypeCategory.STRUCT || typeCategory == TypeCategory.CLASSIFICATION) && forceDeleteStructTrait;
 
@@ -366,7 +361,10 @@ public abstract class DeleteHandlerV1 {
      * @throws AtlasException
      */
     protected void deleteTypeVertex(AtlasVertex instanceVertex, boolean force) throws AtlasBaseException {
-        LOG.debug("Deleting {}", string(instanceVertex));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Deleting {}", string(instanceVertex));
+        }
+
         String typeName = GraphHelper.getTypeName(instanceVertex);
 
 
@@ -377,7 +375,10 @@ public abstract class DeleteHandlerV1 {
             boolean         isEntityType = (parentType instanceof AtlasEntityType);
 
             for (AtlasStructType.AtlasAttribute attributeInfo : structType.getAllAttributes().values()) {
-                LOG.debug("Deleting attribute {} for {}", attributeInfo.getName(), string(instanceVertex));
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Deleting attribute {} for {}", attributeInfo.getName(), string(instanceVertex));
+                }
+
                 boolean isOwned = isEntityType && attributeInfo.isOwnedRef();
 
                 AtlasType attrType = attributeInfo.getAttributeType();
@@ -448,7 +449,11 @@ public abstract class DeleteHandlerV1 {
      */
     private void deleteAllTraits(AtlasVertex instanceVertex) throws AtlasBaseException {
         List<String> traitNames = GraphHelper.getTraitNames(instanceVertex);
-        LOG.debug("Deleting traits {} for {}", traitNames, string(instanceVertex));
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Deleting traits {} for {}", traitNames, string(instanceVertex));
+        }
+
         String typeName = GraphHelper.getTypeName(instanceVertex);
 
         for (String traitNameToBeDeleted : traitNames) {
@@ -478,15 +483,17 @@ public abstract class DeleteHandlerV1 {
      * @throws AtlasException
      */
     protected void deleteEdgeBetweenVertices(AtlasVertex outVertex, AtlasVertex inVertex, AtlasAttribute attribute) throws AtlasBaseException {
-        LOG.debug("Removing edge from {} to {} with attribute name {}", string(outVertex), string(inVertex),
-            attribute.getName());
-        String typeName = GraphHelper.getTypeName(outVertex);
-        String outId = GraphHelper.getGuid(outVertex);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Removing edge from {} to {} with attribute name {}", string(outVertex), string(inVertex),
+                    attribute.getName());
+        }
 
-        AtlasObjectId objId = new AtlasObjectId(outId, typeName);
-        AtlasEntity.Status state = AtlasGraphUtilsV1.getState(outVertex);
+        AtlasEntityHeader  entity   = entityGraphRetriever.toAtlasEntityHeader(outVertex);
+        String             typeName = entity.getTypeName();
+        String             outId    = entity.getGuid();
+        AtlasEntity.Status state    = entity.getStatus();
 
-        if (state == AtlasEntity.Status.DELETED || (outId != null && RequestContextV1.get().isDeletedEntity(objId.getGuid()))) {
+        if (state == AtlasEntity.Status.DELETED || (outId != null && RequestContextV1.get().isDeletedEntity(outId))) {
             //If the reference vertex is marked for deletion, skip updating the reference
             return;
         }
@@ -610,13 +617,15 @@ public abstract class DeleteHandlerV1 {
             AtlasGraphUtilsV1.setEncodedProperty(outVertex, Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY,
                 requestContext.getRequestTime());
             AtlasGraphUtilsV1.setEncodedProperty(outVertex, Constants.MODIFIED_BY_KEY, requestContext.getUser());
-            requestContext.recordEntityUpdate(new AtlasObjectId(outId, typeName));
+            requestContext.recordEntityUpdate(entity);
         }
     }
 
     protected void deleteVertex(AtlasVertex instanceVertex, boolean force) throws AtlasBaseException {
         //Update external references(incoming edges) to this vertex
-        LOG.debug("Setting the external references to {} to null(removing edges)", string(instanceVertex));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Setting the external references to {} to null(removing edges)", string(instanceVertex));
+        }
 
         for (AtlasEdge edge : (Iterable<AtlasEdge>) instanceVertex.getEdges(AtlasEdgeDirection.IN)) {
             AtlasEntity.Status edgeState = AtlasGraphUtilsV1.getState(edge);
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
index 0f9f763..7e3f027 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
@@ -80,13 +80,15 @@ public class EntityGraphMapper {
     private final AtlasGraph              graph;
     private final DeleteHandlerDelegateV1 deleteDelegate;
     private final AtlasTypeRegistry       typeRegistry;
+    private final EntityGraphRetriever    entityGraphRetriever;
 
 
     @Inject
     public EntityGraphMapper(DeleteHandlerDelegateV1 deleteDelegate, AtlasTypeRegistry typeRegistry, AtlasGraph atlasGraph) {
-        this.deleteDelegate = deleteDelegate;
-        this.typeRegistry   = typeRegistry;
-        this.graph          = atlasGraph;
+        this.deleteDelegate       = deleteDelegate;
+        this.typeRegistry         = typeRegistry;
+        this.graph                = atlasGraph;
+        this.entityGraphRetriever = new EntityGraphRetriever(typeRegistry);
     }
 
     public AtlasVertex createVertex(AtlasEntity entity) {
@@ -114,10 +116,6 @@ public class EntityGraphMapper {
     }
 
     public void updateSystemAttributes(AtlasVertex vertex, AtlasEntity entity) {
-        if (entity.getStatus() != null) {
-            AtlasGraphUtilsV1.setEncodedProperty(vertex, Constants.STATE_PROPERTY_KEY, entity.getStatus().name());
-        }
-
         if (entity.getCreateTime() != null) {
             AtlasGraphUtilsV1.setEncodedProperty(vertex, Constants.TIMESTAMP_PROPERTY_KEY, entity.getCreateTime().getTime());
         }
@@ -171,24 +169,28 @@ public class EntityGraphMapper {
                 }
 
                 if ( replaceClassifications ) {
-                    deleteClassifications(guid);
+                    deleteClassifications(context, guid);
                     addClassifications(context, guid, updatedEntity.getClassifications());
                 }
             }
         }
 
+        if (CollectionUtils.isNotEmpty(context.getEntitiesToDelete())) {
+            deleteDelegate.getHandlerV1().deleteEntities(context.getEntitiesToDelete());
+        }
+
         RequestContextV1 req = RequestContextV1.get();
 
-        for (AtlasObjectId id : req.getDeletedEntities()) {
-            resp.addEntity(DELETE, constructHeader(id));
+        for (AtlasEntityHeader entity : req.getDeletedEntities()) {
+            resp.addEntity(DELETE, entity);
         }
 
-        for (AtlasObjectId id : req.getUpdatedEntities()) {
+        for (AtlasEntityHeader entity : req.getUpdatedEntities()) {
             if (isPartialUpdate) {
-                resp.addEntity(PARTIAL_UPDATE, constructHeader(id));
+                resp.addEntity(PARTIAL_UPDATE, entity);
             }
             else {
-                resp.addEntity(UPDATE, constructHeader(id));
+                resp.addEntity(UPDATE, entity);
             }
         }
 
@@ -429,8 +431,8 @@ public class EntityGraphMapper {
 
         if (inverseUpdated) {
             updateModificationMetadata(inverseVertex);
-            AtlasObjectId inverseEntityId = new AtlasObjectId(AtlasGraphUtilsV1.getIdFromVertex(inverseVertex), inverseType.getTypeName());
-            RequestContextV1.get().recordEntityUpdate(inverseEntityId);
+
+            RequestContextV1.get().recordEntityUpdate(entityGraphRetriever.toAtlasEntityHeader(inverseVertex));
         }
     }
 
@@ -966,6 +968,7 @@ public class EntityGraphMapper {
         AtlasEntityHeader header = new AtlasEntityHeader(entity.getTypeName());
 
         header.setGuid(AtlasGraphUtilsV1.getIdFromVertex(vertex));
+        header.setStatus(entity.getStatus());
 
         for (AtlasAttribute attribute : type.getUniqAttributes().values()) {
             header.setAttribute(attribute.getName(), entity.getAttribute(attribute.getName()));
@@ -974,10 +977,6 @@ public class EntityGraphMapper {
         return header;
     }
 
-    public static AtlasEntityHeader constructHeader(AtlasObjectId id) {
-        return new AtlasEntityHeader(id.getTypeName(), id.getGuid(), id.getUniqueAttributes());
-    }
-
     private void updateInConsistentOwnedMapVertices(AttributeMutationContext ctx, AtlasMapType mapType, Object val) {
         if (mapType.getValueType().getTypeCategory() == TypeCategory.OBJECT_ID_TYPE && !ctx.getAttributeDef().isSoftReferenced()) {
             AtlasEdge edge = (AtlasEdge) val;
@@ -995,16 +994,13 @@ public class EntityGraphMapper {
         throws AtlasBaseException {
 
         if ( CollectionUtils.isNotEmpty(classifications)) {
+            AtlasVertex     instanceVertex = context.getVertex(guid);
+            AtlasEntityType entityType     = context.getType(guid);
 
-            AtlasVertex instanceVertex = AtlasGraphUtilsV1.findByGuid(guid);
             if (instanceVertex == null) {
                 throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
             }
 
-            String entityTypeName = AtlasGraphUtilsV1.getTypeName(instanceVertex);
-
-            final AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityTypeName);
-
             for (AtlasClassification classification : classifications) {
                 addClassificationWithNoMetadataUpdate(context, instanceVertex, entityType, classification);
             }
@@ -1031,23 +1027,19 @@ public class EntityGraphMapper {
 
     public void updateClassification(final EntityMutationContext context, String guid, AtlasClassification classification)
                                      throws AtlasBaseException {
-
-        AtlasVertex instanceVertex = AtlasGraphUtilsV1.findByGuid(guid);
+        AtlasVertex     instanceVertex = context.getVertex(guid);
+        AtlasEntityType entityType     = context.getType(guid);
 
         if (instanceVertex == null) {
             throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
         }
 
-        String entityTypeName = AtlasGraphUtilsV1.getTypeName(instanceVertex);
-
-        final AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entityTypeName);
-
         if (LOG.isDebugEnabled()) {
             LOG.debug("Updating classification {} for entity {}", classification, guid);
         }
 
         // get the classification vertex from entity
-        String      relationshipLabel    = GraphHelper.getTraitLabel(entityTypeName, classification.getTypeName());
+        String      relationshipLabel    = GraphHelper.getTraitLabel(entityType.getTypeName(), classification.getTypeName());
         AtlasEdge   classificationEdge   = graphHelper.getEdgeForLabel(instanceVertex, relationshipLabel);
         AtlasVertex classificationVertex = classificationEdge.getInVertex();
 
@@ -1074,21 +1066,21 @@ public class EntityGraphMapper {
         }
     }
 
-    public void deleteClassifications(String guid) throws AtlasBaseException {
+    public void deleteClassifications(EntityMutationContext context, String guid) throws AtlasBaseException {
+        AtlasVertex instanceVertex = context.getVertex(guid);
 
-        AtlasVertex instanceVertex = AtlasGraphUtilsV1.findByGuid(guid);
         if (instanceVertex == null) {
             throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
         }
 
         List<String> traitNames = GraphHelper.getTraitNames(instanceVertex);
 
-        deleteClassifications(guid, traitNames);
+        deleteClassifications(context, guid, traitNames);
     }
 
-    public void deleteClassifications(String guid, List<String> classificationNames) throws AtlasBaseException {
+    public void deleteClassifications(EntityMutationContext context, String guid, List<String> classificationNames) throws AtlasBaseException {
+        AtlasVertex instanceVertex = context.getVertex(guid);
 
-        AtlasVertex instanceVertex = AtlasGraphUtilsV1.findByGuid(guid);
         if (instanceVertex == null) {
             throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
         }
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityMutationContext.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityMutationContext.java
index 9465b8e..aa905c4 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityMutationContext.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityMutationContext.java
@@ -27,18 +27,20 @@ import org.apache.commons.lang.StringUtils;
 import java.util.*;
 
 public class EntityMutationContext {
-    private EntityGraphDiscoveryContext  context = null;
-    private final List<AtlasEntity>            entitiesCreated = new ArrayList<>();
-    private final List<AtlasEntity>            entitiesUpdated = new ArrayList<>();
-    private final Map<String, AtlasEntityType> entityVsType    = new HashMap<>();
-    private final Map<String, AtlasVertex>     entityVsVertex  = new HashMap<>();
-    private final Map<String, String>          guidAssignments = new HashMap<>();
+    private final EntityGraphDiscoveryContext  context;
+    private final List<AtlasEntity>            entitiesCreated  = new ArrayList<>();
+    private final List<AtlasEntity>            entitiesUpdated  = new ArrayList<>();
+    private final Map<String, AtlasEntityType> entityVsType     = new HashMap<>();
+    private final Map<String, AtlasVertex>     entityVsVertex   = new HashMap<>();
+    private final Map<String, String>          guidAssignments  = new HashMap<>();
+    private       List<AtlasVertex>            entitiesToDelete = null;
 
     public EntityMutationContext(final EntityGraphDiscoveryContext context) {
         this.context = context;
     }
 
     public EntityMutationContext() {
+        this.context = null;
     }
 
     public void addCreated(String internalGuid, AtlasEntity entity, AtlasEntityType type, AtlasVertex atlasVertex) {
@@ -79,12 +81,29 @@ public class EntityMutationContext {
         return guidAssignments;
     }
 
+    public List<AtlasVertex> getEntitiesToDelete() {
+        return entitiesToDelete;
+    }
+
     public AtlasEntityType getType(String guid) {
         return entityVsType.get(guid);
     }
 
     public AtlasVertex getVertex(String guid) { return entityVsVertex.get(guid); }
 
+    public void addEntityToDelete(AtlasVertex vertex) {
+        if (entitiesToDelete == null) {
+            entitiesToDelete = new ArrayList<>();
+        }
+
+        entitiesToDelete.add(vertex);
+    }
+
+    public void cacheEntity(String guid, AtlasVertex vertex, AtlasEntityType entityType) {
+        entityVsType.put(guid, entityType);
+        entityVsVertex.put(guid, vertex);
+    }
+
 
     @Override
     public boolean equals(final Object o) {
diff --git a/server-api/src/main/java/org/apache/atlas/RequestContextV1.java b/server-api/src/main/java/org/apache/atlas/RequestContextV1.java
index 5ae8055..f74dc5d 100644
--- a/server-api/src/main/java/org/apache/atlas/RequestContextV1.java
+++ b/server-api/src/main/java/org/apache/atlas/RequestContextV1.java
@@ -21,7 +21,7 @@ package org.apache.atlas;
 import org.apache.atlas.metrics.Metrics;
 import org.apache.atlas.metrics.Metrics.MetricRecorder;
 import org.apache.atlas.model.instance.AtlasEntity;
-import org.apache.atlas.model.instance.AtlasObjectId;
+import org.apache.atlas.model.instance.AtlasEntityHeader;
 import org.apache.atlas.store.DeleteType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -40,12 +40,12 @@ public class RequestContextV1 {
     private static final ThreadLocal<RequestContextV1> CURRENT_CONTEXT = new ThreadLocal<>();
     private static final Set<RequestContextV1>         ACTIVE_REQUESTS = new HashSet<>();
 
-    private final long                       requestTime     = System.currentTimeMillis();
-    private final Map<String, AtlasObjectId> updatedEntities = new HashMap<>();
-    private final Map<String, AtlasObjectId> deletedEntities = new HashMap<>();
-    private final Map<String, AtlasEntity>   entityCacheV2   = new HashMap<>();
-    private final Metrics                    metrics         = new Metrics();
-    private       List<EntityGuidPair>       entityGuidInRequest = null;
+    private final long                           requestTime         = System.currentTimeMillis();
+    private final Map<String, AtlasEntityHeader> updatedEntities     = new HashMap<>();
+    private final Map<String, AtlasEntityHeader> deletedEntities     = new HashMap<>();
+    private final Map<String, AtlasEntity>       entityCacheV2       = new HashMap<>();
+    private final Metrics                        metrics             = new Metrics();
+    private       List<EntityGuidPair>           entityGuidInRequest = null;
 
     private String     user;
     private DeleteType deleteType = DeleteType.DEFAULT;
@@ -135,13 +135,13 @@ public class RequestContextV1 {
 
     public void setDeleteType(DeleteType deleteType) { this.deleteType = (deleteType == null) ? DeleteType.DEFAULT : deleteType; }
 
-    public void recordEntityUpdate(AtlasObjectId entity) {
+    public void recordEntityUpdate(AtlasEntityHeader entity) {
         if (entity != null && entity.getGuid() != null) {
             updatedEntities.put(entity.getGuid(), entity);
         }
     }
 
-    public void recordEntityDelete(AtlasObjectId entity) {
+    public void recordEntityDelete(AtlasEntityHeader entity) {
         if (entity != null && entity.getGuid() != null) {
             deletedEntities.put(entity.getGuid(), entity);
         }
@@ -157,11 +157,11 @@ public class RequestContextV1 {
         }
     }
 
-    public Collection<AtlasObjectId> getUpdatedEntities() {
+    public Collection<AtlasEntityHeader> getUpdatedEntities() {
         return updatedEntities.values();
     }
 
-    public Collection<AtlasObjectId> getDeletedEntities() {
+    public Collection<AtlasEntityHeader> getDeletedEntities() {
         return deletedEntities.values();
     }
 
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/AdminExportImportTestIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/AdminExportImportTestIT.java
index 9cc5498..8e6ac75 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/AdminExportImportTestIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/AdminExportImportTestIT.java
@@ -60,7 +60,7 @@ public class AdminExportImportTestIT extends BaseResourceIT {
 
     @Test(dependsOnMethods = "isActive")
     public void importData() throws AtlasServiceException {
-        performImport(FILE_TO_IMPORT);
+        performImport(FILE_TO_IMPORT, 37);
         assertReplicationData("cl1");
     }
 
@@ -84,21 +84,21 @@ public class AdminExportImportTestIT extends BaseResourceIT {
         assertTrue(zs.getCreationOrder().size() > EXPECTED_CREATION_ORDER_SIZE);
     }
 
-    private void performImport(String fileToImport) throws AtlasServiceException {
+    private void performImport(String fileToImport, int expectedProcessedEntitiesCount) throws AtlasServiceException {
         AtlasImportRequest request = new AtlasImportRequest();
         request.getOptions().put(AtlasImportRequest.OPTION_KEY_REPLICATED_FROM, SOURCE_SERVER_NAME);
         request.getOptions().put(AtlasImportRequest.TRANSFORMS_KEY, IMPORT_TRANSFORM_CLEAR_ATTRS);
 
-        performImport(fileToImport, request);
+        performImport(fileToImport, request, expectedProcessedEntitiesCount);
     }
 
-    private void performImport(String fileToImport, AtlasImportRequest request) throws AtlasServiceException {
+    private void performImport(String fileToImport, AtlasImportRequest request, int expectedProcessedEntitiesCount) throws AtlasServiceException {
 
         AtlasImportResult result = performImportUsing(fileToImport, request);
         assertNotNull(result);
         assertEquals(result.getOperationStatus(), AtlasImportResult.OperationStatus.SUCCESS);
         assertNotNull(result.getMetrics());
-        assertEquals(result.getProcessedEntities().size(), 37);
+        assertEquals(result.getProcessedEntities().size(), expectedProcessedEntitiesCount);
     }
 
     private AtlasImportResult performImportUsing(String fileToImport, AtlasImportRequest request) throws AtlasServiceException {
@@ -126,7 +126,7 @@ public class AdminExportImportTestIT extends BaseResourceIT {
         request.getOptions().put(AtlasImportRequest.TRANSFORMS_KEY, IMPORT_TRANSFORM_SET_DELETED);
 
         try {
-            performImport(FILE_TO_IMPORT, request);
+            performImport(FILE_TO_IMPORT, request, 32); // initial import has 5 entities already in deleted state, hence current import will have 32 processed-entities
         } catch (AtlasServiceException e) {
             throw new SkipException("performTeardown: failed! Subsequent tests results may be affected.");
         }