Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
98163440
Commit
98163440
authored
Nov 07, 2019
by
Ashutosh Mestry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3515: Migration import now creates new types and then updates existing types.
parent
d5c8bf40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
19 deletions
+19
-19
ImportTypeDefProcessor.java
...pache/atlas/repository/impexp/ImportTypeDefProcessor.java
+2
-3
TypeAttributeDifference.java
...ache/atlas/repository/impexp/TypeAttributeDifference.java
+17
-16
No files found.
repository/src/main/java/org/apache/atlas/repository/impexp/ImportTypeDefProcessor.java
View file @
98163440
...
...
@@ -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
)
{
...
...
repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
View file @
98163440
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment