Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 44dd6a1a7 -> a1b6ba39c


ATLAS-2805: Applying classification updates modificationTimestamp


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/a1b6ba39
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/a1b6ba39
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/a1b6ba39

Branch: refs/heads/branch-0.8
Commit: a1b6ba39c649abf1f0af1402afc8b0c270180081
Parents: 44dd6a1
Author: Ashutosh Mestry <[email protected]>
Authored: Mon Aug 6 10:25:33 2018 -0700
Committer: Ashutosh Mestry <[email protected]>
Committed: Mon Aug 6 10:25:33 2018 -0700

----------------------------------------------------------------------
 .../store/graph/v1/EntityGraphMapper.java       | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/a1b6ba39/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
----------------------------------------------------------------------
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 25c91be..9e7a119 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
@@ -924,21 +924,26 @@ public class EntityGraphMapper {
             final AtlasEntityType entityType = 
typeRegistry.getEntityTypeByName(entityTypeName);
 
             for (AtlasClassification classification : classifications) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("mapping classification {}", classification);
-                }
+                addClassificationWithNoMetadataUpdate(context, instanceVertex, 
entityType, classification);
+            }
+            updateModificationMetadata(instanceVertex);
+        }
+    }
 
-                GraphHelper.addProperty(instanceVertex, 
Constants.TRAIT_NAMES_PROPERTY_KEY, classification.getTypeName());
-                // add a new AtlasVertex for the struct or trait instance
-                AtlasVertex classificationVertex = 
createClassificationVertex(classification);
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("created vertex {} for trait {}", 
string(classificationVertex), classification.getTypeName());
-                }
+    private void addClassificationWithNoMetadataUpdate(EntityMutationContext 
context, AtlasVertex instanceVertex, AtlasEntityType entityType, 
AtlasClassification classification) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("mapping classification {}", classification);
+        }
 
-                // add the attributes for the trait instance
-                mapClassification(EntityOperation.CREATE, context, 
classification, entityType, instanceVertex, classificationVertex);
-            }
+        GraphHelper.addProperty(instanceVertex, 
Constants.TRAIT_NAMES_PROPERTY_KEY, classification.getTypeName());
+        // add a new AtlasVertex for the struct or trait instance
+        AtlasVertex classificationVertex = 
createClassificationVertex(classification);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("created vertex {} for trait {}", 
string(classificationVertex), classification.getTypeName());
         }
+
+        // add the attributes for the trait instance
+        mapClassification(EntityOperation.CREATE, context, classification, 
entityType, instanceVertex, classificationVertex);
     }
 
     public void updateClassification(final EntityMutationContext context, 
String guid, AtlasClassification classification)
@@ -968,6 +973,7 @@ public class EntityGraphMapper {
         }
 
         mapClassification(EntityOperation.UPDATE, context, classification, 
entityType, instanceVertex, classificationVertex);
+        updateModificationMetadata(instanceVertex);
     }
 
     private AtlasEdge mapClassification(EntityOperation operation,  final 
EntityMutationContext context, AtlasClassification classification, 
AtlasEntityType entityType, AtlasVertex parentInstanceVertex, AtlasVertex 
traitInstanceVertex)

Reply via email to