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 2019/11/08 17:22:53 UTC
[atlas] branch branch-2.0 updated: ATLAS-3515: Migration import now
creates new types and then updates existing types.
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 77dbea4 ATLAS-3515: Migration import now creates new types and then updates existing types.
77dbea4 is described below
commit 77dbea47bf42daceefea6bd03b81116aefa2f755
Author: Ashutosh Mestry <am...@hortonworks.com>
AuthorDate: Thu Nov 7 15:45:30 2019 -0800
ATLAS-3515: Migration import now creates new types and then updates existing types.
---
.../repository/impexp/ImportTypeDefProcessor.java | 5 ++--
.../repository/impexp/TypeAttributeDifference.java | 33 +++++++++++-----------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/ImportTypeDefProcessor.java b/repository/src/main/java/org/apache/atlas/repository/impexp/ImportTypeDefProcessor.java
index 4fc70bc..b658077 100644
--- a/repository/src/main/java/org/apache/atlas/repository/impexp/ImportTypeDefProcessor.java
+++ b/repository/src/main/java/org/apache/atlas/repository/impexp/ImportTypeDefProcessor.java
@@ -43,14 +43,13 @@ public class ImportTypeDefProcessor {
public void processTypes(AtlasTypesDef typeDefinitionMap, AtlasImportResult result) throws AtlasBaseException {
setGuidToEmpty(typeDefinitionMap);
- typeAttributeDifference.updateTypes(typeDefinitionMap, result);
-
AtlasTypesDef typesToCreate = AtlasTypeDefStoreInitializer.getTypesToCreate(typeDefinitionMap, this.typeRegistry);
if (!typesToCreate.isEmpty()) {
typeDefStore.createTypesDef(typesToCreate);
updateMetricsForTypesDef(typesToCreate, result);
-
}
+
+ typeAttributeDifference.updateTypes(typeDefinitionMap, result);
}
private void setGuidToEmpty(AtlasTypesDef typesDef) {
diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java b/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
index b811b5a..0d78dbe 100644
--- a/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
+++ b/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
@@ -49,16 +49,15 @@ public class TypeAttributeDifference {
}
public void updateTypes(AtlasTypesDef typeDefinitionMap, AtlasImportResult result) throws AtlasBaseException {
-
- updateEntityDef(typeDefinitionMap, result);
- updateClassificationDef(typeDefinitionMap, result);
- updateEnumDef(typeDefinitionMap, result);
- updateStructDef(typeDefinitionMap, result);
- updateRelationshipDefs(typeDefinitionMap, result);
+ updateEnumDef(typeDefinitionMap.getEnumDefs(), result);
+ updateStructDef(typeDefinitionMap.getStructDefs(), result);
+ updateClassificationDef(typeDefinitionMap.getClassificationDefs(), result);
+ updateEntityDef(typeDefinitionMap.getEntityDefs(), result);
+ updateRelationshipDefs(typeDefinitionMap.getRelationshipDefs(), result);
}
- private void updateEntityDef(AtlasTypesDef typeDefinitionMap, AtlasImportResult result) throws AtlasBaseException {
- for (AtlasEntityDef def : typeDefinitionMap.getEntityDefs()) {
+ private void updateEntityDef(List<AtlasEntityDef> entityDefs, AtlasImportResult result) throws AtlasBaseException {
+ for (AtlasEntityDef def : entityDefs) {
AtlasEntityDef existing = typeRegistry.getEntityDefByName(def.getName());
if (existing != null && addAttributes(existing, def)) {
typeDefStore.updateEntityDefByName(existing.getName(), existing);
@@ -67,8 +66,8 @@ public class TypeAttributeDifference {
}
}
- private void updateClassificationDef(AtlasTypesDef typeDefinitionMap, AtlasImportResult result) throws AtlasBaseException {
- for (AtlasClassificationDef def : typeDefinitionMap.getClassificationDefs()) {
+ private void updateClassificationDef(List<AtlasClassificationDef> classificationDefs, AtlasImportResult result) throws AtlasBaseException {
+ for (AtlasClassificationDef def : classificationDefs) {
AtlasClassificationDef existing = typeRegistry.getClassificationDefByName(def.getName());
if (existing != null && addAttributes(existing, def)) {
typeDefStore.updateClassificationDefByName(existing.getName(), existing);
@@ -77,18 +76,20 @@ public class TypeAttributeDifference {
}
}
- private void updateEnumDef(AtlasTypesDef typeDefinitionMap, AtlasImportResult result) throws AtlasBaseException {
- for (AtlasEnumDef def : typeDefinitionMap.getEnumDefs()) {
+ private void updateEnumDef(List<AtlasEnumDef> enumDefs, AtlasImportResult result) throws AtlasBaseException {
+ for (AtlasEnumDef def : enumDefs) {
AtlasEnumDef existing = typeRegistry.getEnumDefByName(def.getName());
if (existing != null && addElements(existing, def)) {
typeDefStore.updateEnumDefByName(existing.getName(), existing);
result.incrementMeticsCounter("typedef:enum:update");
+ } else {
+
}
}
}
- private void updateStructDef(AtlasTypesDef typeDefinitionMap, AtlasImportResult result) throws AtlasBaseException {
- for (AtlasStructDef def : typeDefinitionMap.getStructDefs()) {
+ private void updateStructDef(List<AtlasStructDef> structDefs, AtlasImportResult result) throws AtlasBaseException {
+ for (AtlasStructDef def : structDefs) {
AtlasStructDef existing = typeRegistry.getStructDefByName(def.getName());
if (existing != null && addAttributes(existing, def)) {
typeDefStore.updateStructDefByName(existing.getName(), existing);
@@ -97,8 +98,8 @@ public class TypeAttributeDifference {
}
}
- private void updateRelationshipDefs(AtlasTypesDef typeDefinitionMap, AtlasImportResult result) throws AtlasBaseException {
- for (AtlasRelationshipDef def : typeDefinitionMap.getRelationshipDefs()) {
+ private void updateRelationshipDefs(List<AtlasRelationshipDef> relationshipDefs, AtlasImportResult result) throws AtlasBaseException {
+ for (AtlasRelationshipDef def : relationshipDefs) {
AtlasRelationshipDef existing = typeRegistry.getRelationshipDefByName(def.getName());
if (existing != null && addAttributes(existing, def)) {
typeDefStore.updateRelationshipDefByName(existing.getName(), existing);