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
7b0a0e12
Commit
7b0a0e12
authored
Jul 31, 2019
by
Ashutosh Mestry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3232: Import Service: Handling RelationshipAttributes during import.
parent
6598c749
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
ImportTypeDefProcessor.java
...pache/atlas/repository/impexp/ImportTypeDefProcessor.java
+5
-0
TypeAttributeDifference.java
...ache/atlas/repository/impexp/TypeAttributeDifference.java
+12
-0
No files found.
repository/src/main/java/org/apache/atlas/repository/impexp/ImportTypeDefProcessor.java
View file @
7b0a0e12
...
@@ -22,6 +22,7 @@ import org.apache.atlas.model.impexp.AtlasImportResult;
...
@@ -22,6 +22,7 @@ import org.apache.atlas.model.impexp.AtlasImportResult;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasRelationshipDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer
;
import
org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer
;
...
@@ -68,6 +69,10 @@ public class ImportTypeDefProcessor {
...
@@ -68,6 +69,10 @@ public class ImportTypeDefProcessor {
for
(
AtlasStructDef
def
:
typesDef
.
getStructDefs
())
{
for
(
AtlasStructDef
def
:
typesDef
.
getStructDefs
())
{
def
.
setGuid
(
null
);
def
.
setGuid
(
null
);
}
}
for
(
AtlasRelationshipDef
def
:
typesDef
.
getRelationshipDefs
())
{
def
.
setGuid
(
null
);
}
}
}
private
void
updateMetricsForTypesDef
(
AtlasTypesDef
typeDefinitionMap
,
AtlasImportResult
result
)
{
private
void
updateMetricsForTypesDef
(
AtlasTypesDef
typeDefinitionMap
,
AtlasImportResult
result
)
{
...
...
repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
View file @
7b0a0e12
...
@@ -24,6 +24,7 @@ import org.apache.atlas.model.impexp.AtlasImportResult;
...
@@ -24,6 +24,7 @@ import org.apache.atlas.model.impexp.AtlasImportResult;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasRelationshipDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
...
@@ -53,6 +54,7 @@ public class TypeAttributeDifference {
...
@@ -53,6 +54,7 @@ public class TypeAttributeDifference {
updateClassificationDef
(
typeDefinitionMap
,
result
);
updateClassificationDef
(
typeDefinitionMap
,
result
);
updateEnumDef
(
typeDefinitionMap
,
result
);
updateEnumDef
(
typeDefinitionMap
,
result
);
updateStructDef
(
typeDefinitionMap
,
result
);
updateStructDef
(
typeDefinitionMap
,
result
);
updateRelationshipDefs
(
typeDefinitionMap
,
result
);
}
}
private
void
updateEntityDef
(
AtlasTypesDef
typeDefinitionMap
,
AtlasImportResult
result
)
throws
AtlasBaseException
{
private
void
updateEntityDef
(
AtlasTypesDef
typeDefinitionMap
,
AtlasImportResult
result
)
throws
AtlasBaseException
{
...
@@ -95,6 +97,16 @@ public class TypeAttributeDifference {
...
@@ -95,6 +97,16 @@ public class TypeAttributeDifference {
}
}
}
}
private
void
updateRelationshipDefs
(
AtlasTypesDef
typeDefinitionMap
,
AtlasImportResult
result
)
throws
AtlasBaseException
{
for
(
AtlasRelationshipDef
def
:
typeDefinitionMap
.
getRelationshipDefs
())
{
AtlasRelationshipDef
existing
=
typeRegistry
.
getRelationshipDefByName
(
def
.
getName
());
if
(
existing
!=
null
&&
addAttributes
(
existing
,
def
))
{
typeDefStore
.
updateRelationshipDefByName
(
existing
.
getName
(),
existing
);
result
.
incrementMeticsCounter
(
"typedef:relationshipdef:update"
);
}
}
}
@VisibleForTesting
@VisibleForTesting
boolean
addElements
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
AtlasBaseException
{
boolean
addElements
(
AtlasEnumDef
existing
,
AtlasEnumDef
incoming
)
throws
AtlasBaseException
{
return
addElements
(
existing
,
getElementsAbsentInExisting
(
existing
,
incoming
));
return
addElements
(
existing
,
getElementsAbsentInExisting
(
existing
,
incoming
));
...
...
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