You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by am...@apache.org on 2020/07/24 16:59:34 UTC

[atlas] branch branch-2.0 updated: ATLAS-3902: Import Service: UpdateVertexGuid Now Makes Updates to AtlasEntityWithExtInfo

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

amestry 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 addb04e  ATLAS-3902: Import Service: UpdateVertexGuid Now Makes Updates to AtlasEntityWithExtInfo
addb04e is described below

commit addb04e31e912a70829ed59730edd28ee6d80fae
Author: Ashutosh Mestry <am...@cloudera.com>
AuthorDate: Fri Jul 24 08:44:50 2020 -0700

    ATLAS-3902: Import Service: UpdateVertexGuid Now Makes Updates to AtlasEntityWithExtInfo
---
 .../repository/store/graph/v2/bulkimport/RegularImport.java  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/bulkimport/RegularImport.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/bulkimport/RegularImport.java
index 3f7e861..eca6b0e 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/bulkimport/RegularImport.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/bulkimport/RegularImport.java
@@ -42,6 +42,7 @@ import org.apache.atlas.repository.store.graph.v2.EntityGraphRetriever;
 import org.apache.atlas.repository.store.graph.v2.EntityImportStream;
 import org.apache.atlas.type.AtlasEntityType;
 import org.apache.atlas.type.AtlasTypeRegistry;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -127,7 +128,7 @@ public class RegularImport extends ImportStrategy {
                     }
 
                     if (attempt == 0) {
-                        updateVertexGuid(entity);
+                        updateVertexGuid(entityWithExtInfo);
                     } else {
                         LOG.error("Guid update failed: {}", entityWithExtInfo.getEntity().getGuid());
                         throw e;
@@ -153,6 +154,15 @@ public class RegularImport extends ImportStrategy {
     }
 
     @GraphTransaction
+    public void updateVertexGuid(AtlasEntityWithExtInfo entityWithExtInfo) {
+        updateVertexGuid(entityWithExtInfo.getEntity());
+        if (MapUtils.isEmpty(entityWithExtInfo.getReferredEntities())) {
+            return;
+        }
+        for (AtlasEntity entity : entityWithExtInfo.getReferredEntities().values()) {
+            updateVertexGuid(entity);
+        }
+    }
     public void updateVertexGuid(AtlasEntity entity) {
         String entityGuid = entity.getGuid();
         AtlasObjectId objectId = entityGraphRetriever.toAtlasObjectIdWithoutGuid(entity);