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
2ff71e30
Commit
2ff71e30
authored
May 15, 2018
by
apoorvnaik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2686: Term can't be deleted if it's assigned to any entity
Change-Id: I4cddcfe76eabcf7ee705b60848521158bb33a8a5
parent
02448440
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
AtlasErrorCode.java
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+1
-0
GlossaryService.java
.../main/java/org/apache/atlas/glossary/GlossaryService.java
+5
-2
No files found.
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
View file @
2ff71e30
...
...
@@ -146,6 +146,7 @@ public enum AtlasErrorCode {
INVALID_TERM_DISSOCIATION
(
400
,
"ATLAS-400-00-080"
,
"Given term (guid={0}) is not associated to entity(guid={1})"
),
ATTRIBUTE_TYPE_INVALID
(
400
,
"ATLAS-400-00-081"
,
"{0}.{1}: invalid attribute type. Attribute cannot be of type classification"
),
MISSING_CATEGORY_DISPLAY_NAME
(
400
,
"ATLAS-400-00-082"
,
"Category displayName is empty/null"
),
TERM_HAS_ENTITY_ASSOCIATION
(
400
,
"ATLAS-400-00-086"
,
"Term (guid={}) can't be deleted as it has been assigned to {} entities."
),
UNAUTHORIZED_ACCESS
(
403
,
"ATLAS-403-00-001"
,
"{0} is not authorized to perform {1}"
),
...
...
repository/src/main/java/org/apache/atlas/glossary/GlossaryService.java
View file @
2ff71e30
...
...
@@ -413,11 +413,14 @@ public class GlossaryService {
AtlasGlossaryTerm
storeObject
=
dataAccess
.
load
(
getAtlasGlossaryTermSkeleton
(
termGuid
));
// Term can't be deleted if it is assigned to any entity
if
(
CollectionUtils
.
isNotEmpty
(
storeObject
.
getAssignedEntities
()))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TERM_HAS_ENTITY_ASSOCIATION
,
storeObject
.
getGuid
(),
String
.
valueOf
(
storeObject
.
getAssignedEntities
().
size
()));
}
// Remove term from Glossary
glossaryTermUtils
.
processTermRelations
(
storeObject
,
storeObject
,
GlossaryUtils
.
RelationshipOperation
.
DELETE
);
// Remove term associations with Entities
glossaryTermUtils
.
processTermDissociation
(
storeObject
,
storeObject
.
getAssignedEntities
());
// Now delete the term
dataAccess
.
delete
(
termGuid
);
...
...
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