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
96e5f1cb
Commit
96e5f1cb
authored
May 21, 2018
by
apoorvnaik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2711: Fix duplicate qualifiedName issue
Change-Id: I23b53086b2bb2380f451e7d85b59096edc610181
parent
d218fb4f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
12 deletions
+33
-12
GlossaryService.java
.../main/java/org/apache/atlas/glossary/GlossaryService.java
+33
-12
No files found.
repository/src/main/java/org/apache/atlas/glossary/GlossaryService.java
View file @
96e5f1cb
...
...
@@ -352,6 +352,11 @@ public class GlossaryService {
storeObject
=
dataAccess
.
load
(
glossaryTerm
);
}
else
{
glossaryTerm
.
setQualifiedName
(
storeObject
.
getQualifiedName
());
if
(
termExists
(
glossaryTerm
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
GLOSSARY_TERM_ALREADY_EXISTS
,
glossaryTerm
.
getQualifiedName
());
}
storeObject
=
dataAccess
.
save
(
glossaryTerm
);
}
setInfoForRelations
(
storeObject
);
...
...
@@ -412,7 +417,8 @@ public class GlossaryService {
storeObject
=
dataAccess
.
save
(
atlasGlossaryTerm
);
}
catch
(
AtlasBaseException
e
)
{
LOG
.
debug
(
"Glossary term had no immediate attr updates. Exception: {}"
,
e
.
getMessage
());
}
finally
{
}
glossaryTermUtils
.
processTermRelations
(
storeObject
,
atlasGlossaryTerm
,
GlossaryUtils
.
RelationshipOperation
.
UPDATE
);
// If qualifiedName changes due to anchor change, we need to persist the term again with updated qualifiedName
...
...
@@ -420,8 +426,12 @@ public class GlossaryService {
storeObject
=
dataAccess
.
load
(
atlasGlossaryTerm
);
}
else
{
atlasGlossaryTerm
.
setQualifiedName
(
storeObject
.
getQualifiedName
());
storeObject
=
dataAccess
.
save
(
atlasGlossaryTerm
);
if
(
termExists
(
atlasGlossaryTerm
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
GLOSSARY_TERM_ALREADY_EXISTS
,
atlasGlossaryTerm
.
getQualifiedName
());
}
storeObject
=
dataAccess
.
save
(
atlasGlossaryTerm
);
}
}
...
...
@@ -546,17 +556,22 @@ public class GlossaryService {
// Attempt relation creation and gather all impacted categories
Map
<
String
,
AtlasGlossaryCategory
>
impactedCategories
=
glossaryCategoryUtils
.
processCategoryRelations
(
storeObject
,
glossaryCategory
,
GlossaryUtils
.
RelationshipOperation
.
CREATE
);
// Re save the categories in case any qualifiedName change has occurred
dataAccess
.
save
(
impactedCategories
.
values
());
// Since the current category is also affected, we need to update qualifiedName and save again
if
(
StringUtils
.
equals
(
glossaryCategory
.
getQualifiedName
(),
storeObject
.
getQualifiedName
()))
{
storeObject
=
dataAccess
.
load
(
glossaryCategory
);
}
else
{
glossaryCategory
.
setQualifiedName
(
storeObject
.
getQualifiedName
());
if
(
categoryExists
(
glossaryCategory
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
GLOSSARY_CATEGORY_ALREADY_EXISTS
,
glossaryCategory
.
getQualifiedName
());
}
storeObject
=
dataAccess
.
save
(
glossaryCategory
);
}
// Re save the categories in case any qualifiedName change has occurred
dataAccess
.
save
(
impactedCategories
.
values
());
setInfoForRelations
(
storeObject
);
if
(
DEBUG_ENABLED
)
{
...
...
@@ -575,7 +590,6 @@ public class GlossaryService {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
BAD_REQUEST
,
"glossaryCategory is null/empty"
);
}
List
<
AtlasGlossaryCategory
>
ret
=
new
ArrayList
<>();
for
(
AtlasGlossaryCategory
category
:
glossaryCategory
)
{
ret
.
add
(
createCategory
(
category
));
...
...
@@ -614,17 +628,24 @@ public class GlossaryService {
storeObject
=
dataAccess
.
save
(
glossaryCategory
);
}
catch
(
AtlasBaseException
e
)
{
LOG
.
debug
(
"No immediate attribute update. Exception: {}"
,
e
.
getMessage
());
}
finally
{
}
Map
<
String
,
AtlasGlossaryCategory
>
impactedCategories
=
glossaryCategoryUtils
.
processCategoryRelations
(
storeObject
,
glossaryCategory
,
GlossaryUtils
.
RelationshipOperation
.
UPDATE
);
dataAccess
.
save
(
impactedCategories
.
values
());
// Since the current category is also affected, we need to update qualifiedName and save again
if
(!
StringUtils
.
equals
(
glossaryCategory
.
getQualifiedName
(),
storeObject
.
getQualifiedName
())){
glossaryCategory
.
setQualifiedName
(
storeObject
.
getQualifiedName
());
storeObject
=
dataAccess
.
save
(
glossaryCategory
);
}
else
{
if
(
StringUtils
.
equals
(
glossaryCategory
.
getQualifiedName
(),
storeObject
.
getQualifiedName
()))
{
storeObject
=
dataAccess
.
load
(
glossaryCategory
);
}
else
{
glossaryCategory
.
setQualifiedName
(
storeObject
.
getQualifiedName
());
if
(
categoryExists
(
glossaryCategory
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
GLOSSARY_CATEGORY_ALREADY_EXISTS
,
glossaryCategory
.
getQualifiedName
());
}
storeObject
=
dataAccess
.
save
(
glossaryCategory
);
}
dataAccess
.
save
(
impactedCategories
.
values
());
}
if
(
DEBUG_ENABLED
)
{
...
...
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