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
7a1d3dc5
Commit
7a1d3dc5
authored
6 years ago
by
apoorvnaik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2746: Term/Category create shouldn't require UPDATE privilege for simple cases.
Change-Id: I914d81dab968c28b1684953d3b077bfa046c96bb
parent
ecc4e4d2
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
44 deletions
+29
-44
GlossaryCategoryUtils.java
...java/org/apache/atlas/glossary/GlossaryCategoryUtils.java
+0
-8
GlossaryService.java
.../main/java/org/apache/atlas/glossary/GlossaryService.java
+29
-27
GlossaryTermUtils.java
...ain/java/org/apache/atlas/glossary/GlossaryTermUtils.java
+0
-9
No files found.
repository/src/main/java/org/apache/atlas/glossary/GlossaryCategoryUtils.java
View file @
7a1d3dc5
...
...
@@ -89,15 +89,7 @@ public class GlossaryCategoryUtils extends GlossaryUtils {
LOG
.
debug
(
"Creating new category anchor, category = {}, glossary = {}"
,
storeObject
.
getGuid
(),
updatedCategory
.
getAnchor
().
getGlossaryGuid
());
}
// Derive the qualifiedName
String
anchorGlossaryGuid
=
updatedCategory
.
getAnchor
().
getGlossaryGuid
();
AtlasGlossary
glossary
=
dataAccess
.
load
(
getGlossarySkeleton
(
anchorGlossaryGuid
));
storeObject
.
setQualifiedName
(
storeObject
.
getName
()+
"@"
+
glossary
.
getQualifiedName
());
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Derived qualifiedName = {}"
,
storeObject
.
getQualifiedName
());
}
createRelationship
(
defineCategoryAnchorRelation
(
anchorGlossaryGuid
,
storeObject
.
getGuid
()));
}
break
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/glossary/GlossaryService.java
View file @
7a1d3dc5
...
...
@@ -330,15 +330,20 @@ public class GlossaryService {
if
(
Objects
.
isNull
(
glossaryTerm
.
getAnchor
()))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
MISSING_MANDATORY_ANCHOR
);
}
if
(
StringUtils
.
isEmpty
(
glossaryTerm
.
getQualifiedName
()))
{
if
(
StringUtils
.
isEmpty
(
glossaryTerm
.
getName
()))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED
);
}
if
(
StringUtils
.
isEmpty
(
glossaryTerm
.
getName
()))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED
);
}
if
(
isNameInvalid
(
glossaryTerm
.
getName
())){
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_DISPLAY_NAME
);
}
else
{
glossaryTerm
.
setQualifiedName
(
glossaryTerm
.
getName
());
if
(
isNameInvalid
(
glossaryTerm
.
getName
())){
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_DISPLAY_NAME
);
}
else
{
// Derive the qualifiedName
String
anchorGlossaryGuid
=
glossaryTerm
.
getAnchor
().
getGlossaryGuid
();
AtlasGlossary
glossary
=
dataAccess
.
load
(
getGlossarySkeleton
(
anchorGlossaryGuid
));
glossaryTerm
.
setQualifiedName
(
glossaryTerm
.
getName
()
+
"@"
+
glossary
.
getQualifiedName
());
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Derived qualifiedName = {}"
,
glossaryTerm
.
getQualifiedName
());
}
}
...
...
@@ -351,17 +356,7 @@ public class GlossaryService {
glossaryTermUtils
.
processTermRelations
(
storeObject
,
glossaryTerm
,
GlossaryUtils
.
RelationshipOperation
.
CREATE
);
// Re-load term after handling relations
if
(
StringUtils
.
equals
(
storeObject
.
getQualifiedName
(),
glossaryTerm
.
getQualifiedName
()))
{
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
);
}
storeObject
=
dataAccess
.
load
(
glossaryTerm
);
setInfoForRelations
(
storeObject
);
if
(
DEBUG_ENABLED
)
{
...
...
@@ -545,15 +540,22 @@ public class GlossaryService {
if
(
Objects
.
isNull
(
glossaryCategory
.
getAnchor
()))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
MISSING_MANDATORY_ANCHOR
);
}
if
(
StringUtils
.
isEmpty
(
glossaryCategory
.
getQualifiedName
()))
{
if
(
StringUtils
.
isEmpty
(
glossaryCategory
.
getName
()))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
GLOSSARY_CATEGORY_QUALIFIED_NAME_CANT_BE_DERIVED
);
}
if
(
isNameInvalid
(
glossaryCategory
.
getName
())){
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_DISPLAY_NAME
);
}
else
{
glossaryCategory
.
setQualifiedName
(
glossaryCategory
.
getName
());
if
(
StringUtils
.
isEmpty
(
glossaryCategory
.
getName
()))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
GLOSSARY_CATEGORY_QUALIFIED_NAME_CANT_BE_DERIVED
);
}
if
(
isNameInvalid
(
glossaryCategory
.
getName
())){
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_DISPLAY_NAME
);
}
else
{
// Derive the qualifiedName
String
anchorGlossaryGuid
=
glossaryCategory
.
getAnchor
().
getGlossaryGuid
();
AtlasGlossary
glossary
=
dataAccess
.
load
(
getGlossarySkeleton
(
anchorGlossaryGuid
));
glossaryCategory
.
setQualifiedName
(
glossaryCategory
.
getName
()+
"@"
+
glossary
.
getQualifiedName
());
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Derived qualifiedName = {}"
,
glossaryCategory
.
getQualifiedName
());
}
}
// This might fail for the case when the category's qualifiedName has been updated during a hierarchy change
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/glossary/GlossaryTermUtils.java
View file @
7a1d3dc5
...
...
@@ -152,15 +152,6 @@ public class GlossaryTermUtils extends GlossaryUtils {
LOG
.
debug
(
"Creating new term anchor, category = {}, glossary = {}"
,
storeObject
.
getGuid
(),
updatedTerm
.
getAnchor
().
getGlossaryGuid
());
}
// Derive the qualifiedName
String
anchorGlossaryGuid
=
updatedTermAnchor
.
getGlossaryGuid
();
AtlasGlossary
glossary
=
dataAccess
.
load
(
getGlossarySkeleton
(
anchorGlossaryGuid
));
storeObject
.
setQualifiedName
(
storeObject
.
getName
()
+
"@"
+
glossary
.
getQualifiedName
());
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Derived qualifiedName = {}"
,
storeObject
.
getQualifiedName
());
}
createRelationship
(
defineTermAnchorRelation
(
updatedTermAnchor
.
getGlossaryGuid
(),
storeObject
.
getGuid
()));
}
break
;
...
...
This diff is collapsed.
Click to expand it.
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