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
c76afbe2
Commit
c76afbe2
authored
Apr 18, 2018
by
apoorvnaik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2582: Hard delete of internal types
Change-Id: Id5dfd66840f9916958cc91a7230ab086151c4232
parent
801aea9a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
77 additions
and
52 deletions
+77
-52
AtlasEntityType.java
.../src/main/java/org/apache/atlas/type/AtlasEntityType.java
+11
-0
GraphHelper.java
...n/java/org/apache/atlas/repository/graph/GraphHelper.java
+11
-19
AbstractGlossaryDTO.java
...he/atlas/repository/ogm/glossary/AbstractGlossaryDTO.java
+1
-4
AtlasGlossaryCategoryDTO.java
...las/repository/ogm/glossary/AtlasGlossaryCategoryDTO.java
+3
-9
AtlasGlossaryDTO.java
...pache/atlas/repository/ogm/glossary/AtlasGlossaryDTO.java
+2
-7
AtlasGlossaryTermDTO.java
...e/atlas/repository/ogm/glossary/AtlasGlossaryTermDTO.java
+3
-10
AtlasEntityChangeNotifier.java
.../repository/store/graph/v1/AtlasEntityChangeNotifier.java
+21
-2
DeleteHandlerV1.java
...ache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
+0
-0
EntityGraphRetriever.java
...atlas/repository/store/graph/v1/EntityGraphRetriever.java
+7
-0
HardDeleteHandlerV1.java
.../atlas/repository/store/graph/v1/HardDeleteHandlerV1.java
+9
-0
SoftDeleteHandlerV1.java
.../atlas/repository/store/graph/v1/SoftDeleteHandlerV1.java
+8
-0
GlossaryServiceTest.java
...t/java/org/apache/atlas/glossary/GlossaryServiceTest.java
+1
-1
No files found.
intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
View file @
c76afbe2
...
@@ -50,6 +50,8 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -50,6 +50,8 @@ public class AtlasEntityType extends AtlasStructType {
private
final
AtlasEntityDef
entityDef
;
private
final
AtlasEntityDef
entityDef
;
private
final
String
typeQryStr
;
private
final
String
typeQryStr
;
private
static
final
String
INTERNAL_TYPENAME
=
"__internal"
;
private
List
<
AtlasEntityType
>
superTypes
=
Collections
.
emptyList
();
private
List
<
AtlasEntityType
>
superTypes
=
Collections
.
emptyList
();
private
Set
<
String
>
allSuperTypes
=
Collections
.
emptySet
();
private
Set
<
String
>
allSuperTypes
=
Collections
.
emptySet
();
private
Set
<
String
>
subTypes
=
Collections
.
emptySet
();
private
Set
<
String
>
subTypes
=
Collections
.
emptySet
();
...
@@ -59,6 +61,7 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -59,6 +61,7 @@ public class AtlasEntityType extends AtlasStructType {
private
Map
<
String
,
AtlasAttribute
>
relationshipAttributes
=
Collections
.
emptyMap
();
private
Map
<
String
,
AtlasAttribute
>
relationshipAttributes
=
Collections
.
emptyMap
();
private
Map
<
String
,
List
<
AtlasRelationshipType
>>
relationshipAttributesType
=
Collections
.
emptyMap
();
private
Map
<
String
,
List
<
AtlasRelationshipType
>>
relationshipAttributesType
=
Collections
.
emptyMap
();
private
String
typeAndAllSubTypesQryStr
=
""
;
private
String
typeAndAllSubTypesQryStr
=
""
;
private
boolean
isInternalType
=
false
;
public
AtlasEntityType
(
AtlasEntityDef
entityDef
)
{
public
AtlasEntityType
(
AtlasEntityDef
entityDef
)
{
...
@@ -145,6 +148,10 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -145,6 +148,10 @@ public class AtlasEntityType extends AtlasStructType {
}
}
for
(
String
superTypeName
:
allSuperTypes
)
{
for
(
String
superTypeName
:
allSuperTypes
)
{
if
(
INTERNAL_TYPENAME
.
equals
(
superTypeName
))
{
isInternalType
=
true
;
}
AtlasEntityType
superType
=
typeRegistry
.
getEntityTypeByName
(
superTypeName
);
AtlasEntityType
superType
=
typeRegistry
.
getEntityTypeByName
(
superTypeName
);
Map
<
String
,
AtlasAttribute
>
superTypeRelationshipAttributes
=
superType
.
getRelationshipAttributes
();
Map
<
String
,
AtlasAttribute
>
superTypeRelationshipAttributes
=
superType
.
getRelationshipAttributes
();
...
@@ -206,6 +213,10 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -206,6 +213,10 @@ public class AtlasEntityType extends AtlasStructType {
return
StringUtils
.
isNotEmpty
(
entityTypeName
)
&&
allSuperTypes
.
contains
(
entityTypeName
);
return
StringUtils
.
isNotEmpty
(
entityTypeName
)
&&
allSuperTypes
.
contains
(
entityTypeName
);
}
}
public
boolean
isInternalType
()
{
return
isInternalType
;
}
public
Map
<
String
,
AtlasAttribute
>
getRelationshipAttributes
()
{
return
relationshipAttributes
;
}
public
Map
<
String
,
AtlasAttribute
>
getRelationshipAttributes
()
{
return
relationshipAttributes
;
}
public
AtlasAttribute
getRelationshipAttribute
(
String
attributeName
)
{
return
relationshipAttributes
.
get
(
attributeName
);
}
public
AtlasAttribute
getRelationshipAttribute
(
String
attributeName
)
{
return
relationshipAttributes
.
get
(
attributeName
);
}
...
...
repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
View file @
c76afbe2
...
@@ -647,8 +647,8 @@ public final class GraphHelper {
...
@@ -647,8 +647,8 @@ public final class GraphHelper {
public
static
<
T
>
T
getSingleValuedProperty
(
AtlasElement
element
,
String
propertyName
,
Class
<
T
>
clazz
)
{
public
static
<
T
>
T
getSingleValuedProperty
(
AtlasElement
element
,
String
propertyName
,
Class
<
T
>
clazz
)
{
String
actualPropertyName
=
GraphHelper
.
encodePropertyKey
(
propertyName
);
String
actualPropertyName
=
GraphHelper
.
encodePropertyKey
(
propertyName
);
if
(
LOG
.
is
Debug
Enabled
())
{
if
(
LOG
.
is
Trace
Enabled
())
{
LOG
.
debug
(
"Reading property {} from {}"
,
actualPropertyName
,
string
(
element
));
LOG
.
trace
(
"Reading property {} from {}"
,
actualPropertyName
,
string
(
element
));
}
}
return
element
.
getProperty
(
actualPropertyName
,
clazz
);
return
element
.
getProperty
(
actualPropertyName
,
clazz
);
...
@@ -658,8 +658,8 @@ public final class GraphHelper {
...
@@ -658,8 +658,8 @@ public final class GraphHelper {
public
static
Object
getProperty
(
AtlasVertex
<?,?>
vertex
,
String
propertyName
)
{
public
static
Object
getProperty
(
AtlasVertex
<?,?>
vertex
,
String
propertyName
)
{
String
actualPropertyName
=
GraphHelper
.
encodePropertyKey
(
propertyName
);
String
actualPropertyName
=
GraphHelper
.
encodePropertyKey
(
propertyName
);
if
(
LOG
.
is
Debug
Enabled
())
{
if
(
LOG
.
is
Trace
Enabled
())
{
LOG
.
debug
(
"Reading property {} from {}"
,
actualPropertyName
,
string
(
vertex
));
LOG
.
trace
(
"Reading property {} from {}"
,
actualPropertyName
,
string
(
vertex
));
}
}
if
(
AtlasGraphProvider
.
getGraphInstance
().
isMultiProperty
(
actualPropertyName
))
{
if
(
AtlasGraphProvider
.
getGraphInstance
().
isMultiProperty
(
actualPropertyName
))
{
...
@@ -673,8 +673,8 @@ public final class GraphHelper {
...
@@ -673,8 +673,8 @@ public final class GraphHelper {
public
static
Object
getProperty
(
AtlasEdge
<?,?>
edge
,
String
propertyName
)
{
public
static
Object
getProperty
(
AtlasEdge
<?,?>
edge
,
String
propertyName
)
{
String
actualPropertyName
=
GraphHelper
.
encodePropertyKey
(
propertyName
);
String
actualPropertyName
=
GraphHelper
.
encodePropertyKey
(
propertyName
);
if
(
LOG
.
is
Debug
Enabled
())
{
if
(
LOG
.
is
Trace
Enabled
())
{
LOG
.
debug
(
"Reading property {} from {}"
,
actualPropertyName
,
string
(
edge
));
LOG
.
trace
(
"Reading property {} from {}"
,
actualPropertyName
,
string
(
edge
));
}
}
return
edge
.
getProperty
(
actualPropertyName
,
Object
.
class
);
return
edge
.
getProperty
(
actualPropertyName
,
Object
.
class
);
...
@@ -736,18 +736,14 @@ public final class GraphHelper {
...
@@ -736,18 +736,14 @@ public final class GraphHelper {
* @param edge
* @param edge
*/
*/
public
void
removeEdge
(
AtlasEdge
edge
)
{
public
void
removeEdge
(
AtlasEdge
edge
)
{
String
edgeString
=
null
;
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
edgeString
=
string
(
edge
);
LOG
.
debug
(
"==> removeEdge({})"
,
string
(
edge
));
LOG
.
debug
(
"Removing {}"
,
edgeString
);
}
}
graph
.
removeEdge
(
edge
);
graph
.
removeEdge
(
edge
);
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
info
(
"
Removed {}"
,
edgeString
);
LOG
.
info
(
"
<== removeEdge()"
);
}
}
}
}
...
@@ -757,18 +753,14 @@ public final class GraphHelper {
...
@@ -757,18 +753,14 @@ public final class GraphHelper {
* @param vertex
* @param vertex
*/
*/
public
void
removeVertex
(
AtlasVertex
vertex
)
{
public
void
removeVertex
(
AtlasVertex
vertex
)
{
String
vertexString
=
null
;
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
vertexString
=
string
(
vertex
);
LOG
.
debug
(
"==> GraphHelper.removeVertex({})"
,
string
(
vertex
));
LOG
.
debug
(
"Removing {}"
,
vertexString
);
}
}
graph
.
removeVertex
(
vertex
);
graph
.
removeVertex
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
info
(
"Removed {}"
,
vertexString
);
LOG
.
debug
(
"<== GraphHelper.removeVertex()"
);
}
}
}
}
...
@@ -1580,7 +1572,7 @@ public final class GraphHelper {
...
@@ -1580,7 +1572,7 @@ public final class GraphHelper {
}
}
// newly added
// newly added
public
static
List
<
Object
>
getArrayElementsProperty
(
AtlasType
elementType
,
AtlasVertex
instanceVertex
,
String
propertyName
)
{
public
static
List
<
Object
>
getArrayElementsProperty
(
AtlasType
elementType
,
AtlasVertex
instanceVertex
,
String
propertyName
)
{
String
encodedPropertyName
=
GraphHelper
.
encodePropertyKey
(
propertyName
);
String
encodedPropertyName
=
GraphHelper
.
encodePropertyKey
(
propertyName
);
if
(
AtlasGraphUtilsV1
.
isReference
(
elementType
))
{
if
(
AtlasGraphUtilsV1
.
isReference
(
elementType
))
{
return
(
List
)
instanceVertex
.
getListProperty
(
encodedPropertyName
,
AtlasEdge
.
class
);
return
(
List
)
instanceVertex
.
getListProperty
(
encodedPropertyName
,
AtlasEdge
.
class
);
...
...
repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AbstractGlossaryDTO.java
View file @
c76afbe2
...
@@ -24,7 +24,6 @@ import org.apache.atlas.model.glossary.relations.AtlasRelatedCategoryHeader;
...
@@ -24,7 +24,6 @@ import org.apache.atlas.model.glossary.relations.AtlasRelatedCategoryHeader;
import
org.apache.atlas.model.glossary.relations.AtlasRelatedTermHeader
;
import
org.apache.atlas.model.glossary.relations.AtlasRelatedTermHeader
;
import
org.apache.atlas.model.glossary.relations.AtlasTermCategorizationHeader
;
import
org.apache.atlas.model.glossary.relations.AtlasTermCategorizationHeader
;
import
org.apache.atlas.model.instance.AtlasRelatedObjectId
;
import
org.apache.atlas.model.instance.AtlasRelatedObjectId
;
import
org.apache.atlas.model.instance.AtlasRelationship
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.repository.ogm.AbstractDataTransferObject
;
import
org.apache.atlas.repository.ogm.AbstractDataTransferObject
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
...
@@ -151,9 +150,7 @@ public abstract class AbstractGlossaryDTO<T extends AtlasBaseModelObject> extend
...
@@ -151,9 +150,7 @@ public abstract class AbstractGlossaryDTO<T extends AtlasBaseModelObject> extend
ret
=
new
HashSet
<>();
ret
=
new
HashSet
<>();
for
(
Object
t
:
(
Collection
)
relatedObjectIds
)
{
for
(
Object
t
:
(
Collection
)
relatedObjectIds
)
{
if
(
t
instanceof
AtlasRelatedObjectId
)
{
if
(
t
instanceof
AtlasRelatedObjectId
)
{
if
(((
AtlasRelatedObjectId
)
t
).
getRelationshipStatus
()
==
AtlasRelationship
.
Status
.
ACTIVE
)
{
ret
.
add
(
constructRelatedTermId
((
AtlasRelatedObjectId
)
t
));
ret
.
add
(
constructRelatedTermId
((
AtlasRelatedObjectId
)
t
));
}
}
}
}
}
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryCategoryDTO.java
View file @
c76afbe2
...
@@ -60,17 +60,13 @@ public class AtlasGlossaryCategoryDTO extends AbstractGlossaryDTO<AtlasGlossaryC
...
@@ -60,17 +60,13 @@ public class AtlasGlossaryCategoryDTO extends AbstractGlossaryDTO<AtlasGlossaryC
Object
anchor
=
entity
.
getRelationshipAttribute
(
"anchor"
);
Object
anchor
=
entity
.
getRelationshipAttribute
(
"anchor"
);
if
(
anchor
instanceof
AtlasRelatedObjectId
)
{
if
(
anchor
instanceof
AtlasRelatedObjectId
)
{
LOG
.
debug
(
"Processing anchor"
);
LOG
.
debug
(
"Processing anchor"
);
if
(((
AtlasRelatedObjectId
)
anchor
).
getRelationshipStatus
()
==
AtlasRelationship
.
Status
.
ACTIVE
)
{
ret
.
setAnchor
(
constructGlossaryId
((
AtlasRelatedObjectId
)
anchor
));
ret
.
setAnchor
(
constructGlossaryId
((
AtlasRelatedObjectId
)
anchor
));
}
}
}
Object
parentCategory
=
entity
.
getRelationshipAttribute
(
"parentCategory"
);
Object
parentCategory
=
entity
.
getRelationshipAttribute
(
"parentCategory"
);
if
(
parentCategory
instanceof
AtlasRelatedObjectId
)
{
if
(
parentCategory
instanceof
AtlasRelatedObjectId
)
{
LOG
.
debug
(
"Processing parentCategory"
);
LOG
.
debug
(
"Processing parentCategory"
);
if
(((
AtlasRelatedObjectId
)
parentCategory
).
getRelationshipStatus
()
==
AtlasRelationship
.
Status
.
ACTIVE
)
{
ret
.
setParentCategory
(
constructRelatedCategoryId
((
AtlasRelatedObjectId
)
parentCategory
));
ret
.
setParentCategory
(
constructRelatedCategoryId
((
AtlasRelatedObjectId
)
parentCategory
));
}
}
}
Object
childrenCategories
=
entity
.
getRelationshipAttribute
(
"childrenCategories"
);
Object
childrenCategories
=
entity
.
getRelationshipAttribute
(
"childrenCategories"
);
...
@@ -90,9 +86,7 @@ public class AtlasGlossaryCategoryDTO extends AbstractGlossaryDTO<AtlasGlossaryC
...
@@ -90,9 +86,7 @@ public class AtlasGlossaryCategoryDTO extends AbstractGlossaryDTO<AtlasGlossaryC
LOG
.
debug
(
"Processing terms"
);
LOG
.
debug
(
"Processing terms"
);
for
(
Object
term
:
(
Collection
)
terms
)
{
for
(
Object
term
:
(
Collection
)
terms
)
{
if
(
term
instanceof
AtlasRelatedObjectId
)
{
if
(
term
instanceof
AtlasRelatedObjectId
)
{
if
(((
AtlasRelatedObjectId
)
term
).
getRelationshipStatus
()
==
AtlasRelationship
.
Status
.
ACTIVE
)
{
ret
.
addTerm
(
constructRelatedTermId
((
AtlasRelatedObjectId
)
term
));
ret
.
addTerm
(
constructRelatedTermId
((
AtlasRelatedObjectId
)
term
));
}
}
}
}
}
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryDTO.java
View file @
c76afbe2
...
@@ -21,7 +21,6 @@ import org.apache.atlas.exception.AtlasBaseException;
...
@@ -21,7 +21,6 @@ import org.apache.atlas.exception.AtlasBaseException;
import
org.apache.atlas.model.glossary.AtlasGlossary
;
import
org.apache.atlas.model.glossary.AtlasGlossary
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasRelatedObjectId
;
import
org.apache.atlas.model.instance.AtlasRelatedObjectId
;
import
org.apache.atlas.model.instance.AtlasRelationship
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -69,9 +68,7 @@ public class AtlasGlossaryDTO extends AbstractGlossaryDTO<AtlasGlossary> {
...
@@ -69,9 +68,7 @@ public class AtlasGlossaryDTO extends AbstractGlossaryDTO<AtlasGlossary> {
if
(
categoriesAttr
instanceof
Collection
)
{
if
(
categoriesAttr
instanceof
Collection
)
{
for
(
Object
o
:
(
Collection
)
categoriesAttr
)
{
for
(
Object
o
:
(
Collection
)
categoriesAttr
)
{
if
(
o
instanceof
AtlasRelatedObjectId
)
{
if
(
o
instanceof
AtlasRelatedObjectId
)
{
if
(((
AtlasRelatedObjectId
)
o
).
getRelationshipStatus
()
==
AtlasRelationship
.
Status
.
ACTIVE
)
{
ret
.
addCategory
(
constructRelatedCategoryId
((
AtlasRelatedObjectId
)
o
));
ret
.
addCategory
(
constructRelatedCategoryId
((
AtlasRelatedObjectId
)
o
));
}
}
}
}
}
}
}
...
@@ -83,9 +80,7 @@ public class AtlasGlossaryDTO extends AbstractGlossaryDTO<AtlasGlossary> {
...
@@ -83,9 +80,7 @@ public class AtlasGlossaryDTO extends AbstractGlossaryDTO<AtlasGlossary> {
if
(
termsAttr
instanceof
Collection
)
{
if
(
termsAttr
instanceof
Collection
)
{
for
(
Object
o
:
(
Collection
)
termsAttr
)
{
for
(
Object
o
:
(
Collection
)
termsAttr
)
{
if
(
o
instanceof
AtlasRelatedObjectId
)
{
if
(
o
instanceof
AtlasRelatedObjectId
)
{
if
(((
AtlasRelatedObjectId
)
o
).
getRelationshipStatus
()
==
AtlasRelationship
.
Status
.
ACTIVE
)
{
ret
.
addTerm
(
constructRelatedTermId
((
AtlasRelatedObjectId
)
o
));
ret
.
addTerm
(
constructRelatedTermId
((
AtlasRelatedObjectId
)
o
));
}
}
}
}
}
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryTermDTO.java
View file @
c76afbe2
...
@@ -21,7 +21,6 @@ import org.apache.atlas.exception.AtlasBaseException;
...
@@ -21,7 +21,6 @@ import org.apache.atlas.exception.AtlasBaseException;
import
org.apache.atlas.model.glossary.AtlasGlossaryTerm
;
import
org.apache.atlas.model.glossary.AtlasGlossaryTerm
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasRelatedObjectId
;
import
org.apache.atlas.model.instance.AtlasRelatedObjectId
;
import
org.apache.atlas.model.instance.AtlasRelationship
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -65,9 +64,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
...
@@ -65,9 +64,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
Object
anchor
=
entity
.
getRelationshipAttribute
(
"anchor"
);
Object
anchor
=
entity
.
getRelationshipAttribute
(
"anchor"
);
if
(
anchor
instanceof
AtlasRelatedObjectId
)
{
if
(
anchor
instanceof
AtlasRelatedObjectId
)
{
LOG
.
debug
(
"Processing anchor"
);
LOG
.
debug
(
"Processing anchor"
);
if
(((
AtlasRelatedObjectId
)
anchor
).
getRelationshipStatus
()
==
AtlasRelationship
.
Status
.
ACTIVE
)
{
ret
.
setAnchor
(
constructGlossaryId
((
AtlasRelatedObjectId
)
anchor
));
ret
.
setAnchor
(
constructGlossaryId
((
AtlasRelatedObjectId
)
anchor
));
}
}
}
Object
categories
=
entity
.
getRelationshipAttribute
(
"categories"
);
Object
categories
=
entity
.
getRelationshipAttribute
(
"categories"
);
...
@@ -75,9 +72,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
...
@@ -75,9 +72,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
LOG
.
debug
(
"Processing categories"
);
LOG
.
debug
(
"Processing categories"
);
for
(
Object
category
:
(
Collection
)
categories
)
{
for
(
Object
category
:
(
Collection
)
categories
)
{
if
(
category
instanceof
AtlasRelatedObjectId
)
{
if
(
category
instanceof
AtlasRelatedObjectId
)
{
if
(((
AtlasRelatedObjectId
)
category
).
getRelationshipStatus
()
==
AtlasRelationship
.
Status
.
ACTIVE
)
{
ret
.
addCategory
(
constructTermCategorizationId
((
AtlasRelatedObjectId
)
category
));
ret
.
addCategory
(
constructTermCategorizationId
((
AtlasRelatedObjectId
)
category
));
}
}
}
}
}
}
}
...
@@ -90,9 +85,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
...
@@ -90,9 +85,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
for
(
Object
assignedEntity
:
(
Collection
)
assignedEntities
)
{
for
(
Object
assignedEntity
:
(
Collection
)
assignedEntities
)
{
if
(
assignedEntity
instanceof
AtlasRelatedObjectId
)
{
if
(
assignedEntity
instanceof
AtlasRelatedObjectId
)
{
AtlasRelatedObjectId
id
=
(
AtlasRelatedObjectId
)
assignedEntity
;
AtlasRelatedObjectId
id
=
(
AtlasRelatedObjectId
)
assignedEntity
;
if
(
id
.
getRelationshipStatus
()
==
AtlasRelationship
.
Status
.
ACTIVE
)
{
ret
.
addAssignedEntity
(
id
);
ret
.
addAssignedEntity
(
id
);
}
}
}
}
}
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
View file @
c76afbe2
...
@@ -30,6 +30,8 @@ import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
...
@@ -30,6 +30,8 @@ import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.model.instance.EntityMutations.EntityOperation
;
import
org.apache.atlas.model.instance.EntityMutations.EntityOperation
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.v1.model.instance.Referenceable
;
import
org.apache.atlas.v1.model.instance.Referenceable
;
import
org.apache.atlas.v1.model.instance.Struct
;
import
org.apache.atlas.v1.model.instance.Struct
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.Constants
;
...
@@ -48,6 +50,7 @@ import javax.inject.Inject;
...
@@ -48,6 +50,7 @@ import javax.inject.Inject;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.Set
;
import
static
org
.
apache
.
atlas
.
util
.
AtlasRepositoryConfiguration
.
isV2EntityNotificationEnabled
;
import
static
org
.
apache
.
atlas
.
util
.
AtlasRepositoryConfiguration
.
isV2EntityNotificationEnabled
;
...
@@ -61,15 +64,20 @@ public class AtlasEntityChangeNotifier {
...
@@ -61,15 +64,20 @@ public class AtlasEntityChangeNotifier {
private
final
Set
<
EntityChangeListenerV2
>
entityChangeListenersV2
;
private
final
Set
<
EntityChangeListenerV2
>
entityChangeListenersV2
;
private
final
AtlasInstanceConverter
instanceConverter
;
private
final
AtlasInstanceConverter
instanceConverter
;
private
final
FullTextMapperV2
fullTextMapperV2
;
private
final
FullTextMapperV2
fullTextMapperV2
;
private
final
AtlasTypeRegistry
atlasTypeRegistry
;
@Inject
@Inject
public
AtlasEntityChangeNotifier
(
Set
<
EntityChangeListener
>
entityChangeListeners
,
Set
<
EntityChangeListenerV2
>
entityChangeListenersV2
,
public
AtlasEntityChangeNotifier
(
Set
<
EntityChangeListener
>
entityChangeListeners
,
AtlasInstanceConverter
instanceConverter
,
final
FullTextMapperV2
fullTextMapperV2
)
{
Set
<
EntityChangeListenerV2
>
entityChangeListenersV2
,
AtlasInstanceConverter
instanceConverter
,
FullTextMapperV2
fullTextMapperV2
,
AtlasTypeRegistry
atlasTypeRegistry
)
{
this
.
entityChangeListeners
=
entityChangeListeners
;
this
.
entityChangeListeners
=
entityChangeListeners
;
this
.
entityChangeListenersV2
=
entityChangeListenersV2
;
this
.
entityChangeListenersV2
=
entityChangeListenersV2
;
this
.
instanceConverter
=
instanceConverter
;
this
.
instanceConverter
=
instanceConverter
;
this
.
fullTextMapperV2
=
fullTextMapperV2
;
this
.
fullTextMapperV2
=
fullTextMapperV2
;
this
.
atlasTypeRegistry
=
atlasTypeRegistry
;
}
}
public
void
onEntitiesMutated
(
EntityMutationResponse
entityMutationResponse
,
boolean
isImport
)
throws
AtlasBaseException
{
public
void
onEntitiesMutated
(
EntityMutationResponse
entityMutationResponse
,
boolean
isImport
)
throws
AtlasBaseException
{
...
@@ -282,6 +290,17 @@ public class AtlasEntityChangeNotifier {
...
@@ -282,6 +290,17 @@ public class AtlasEntityChangeNotifier {
if
(
CollectionUtils
.
isNotEmpty
(
entityHeaders
))
{
if
(
CollectionUtils
.
isNotEmpty
(
entityHeaders
))
{
for
(
AtlasEntityHeader
entityHeader
:
entityHeaders
)
{
for
(
AtlasEntityHeader
entityHeader
:
entityHeaders
)
{
String
entityGuid
=
entityHeader
.
getGuid
();
String
entityGuid
=
entityHeader
.
getGuid
();
String
typeName
=
entityHeader
.
getTypeName
();
// Skip all internal types as the HARD DELETE will cause lookup errors
AtlasEntityType
entityType
=
atlasTypeRegistry
.
getEntityTypeByName
(
typeName
);
if
(
Objects
.
nonNull
(
entityType
)
&&
entityType
.
isInternalType
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Skipping internal type = {}"
,
typeName
);
}
continue
;
}
AtlasEntityWithExtInfo
entityWithExtInfo
=
instanceConverter
.
getAndCacheEntity
(
entityGuid
);
AtlasEntityWithExtInfo
entityWithExtInfo
=
instanceConverter
.
getAndCacheEntity
(
entityGuid
);
if
(
entityWithExtInfo
!=
null
)
{
if
(
entityWithExtInfo
!=
null
)
{
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
View file @
c76afbe2
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
View file @
c76afbe2
...
@@ -683,6 +683,13 @@ public final class EntityGraphRetriever {
...
@@ -683,6 +683,13 @@ public final class EntityGraphRetriever {
String
edgeLabel
=
EDGE_LABEL_PREFIX
+
propertyName
;
String
edgeLabel
=
EDGE_LABEL_PREFIX
+
propertyName
;
for
(
Object
element
:
arrayElements
)
{
for
(
Object
element
:
arrayElements
)
{
// When internal types are deleted, sometimes the collection type attribute will contain a null value
// Graph layer does erroneous mapping of the null element, hence avoiding the processing of the null element
if
(
element
==
null
)
{
LOG
.
debug
(
"Skipping null arrayElement"
);
continue
;
}
Object
arrValue
=
mapVertexToCollectionEntry
(
entityVertex
,
arrayElementType
,
element
,
edgeLabel
,
Object
arrValue
=
mapVertexToCollectionEntry
(
entityVertex
,
arrayElementType
,
element
,
edgeLabel
,
entityExtInfo
,
isOwnedAttribute
,
edgeDirection
);
entityExtInfo
,
isOwnedAttribute
,
edgeDirection
);
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/HardDeleteHandlerV1.java
View file @
c76afbe2
...
@@ -20,6 +20,7 @@ package org.apache.atlas.repository.store.graph.v1;
...
@@ -20,6 +20,7 @@ package org.apache.atlas.repository.store.graph.v1;
import
org.apache.atlas.annotation.ConditionalOnAtlasProperty
;
import
org.apache.atlas.annotation.ConditionalOnAtlasProperty
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.repository.graph.GraphHelper
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
...
@@ -38,11 +39,19 @@ public class HardDeleteHandlerV1 extends DeleteHandlerV1 {
...
@@ -38,11 +39,19 @@ public class HardDeleteHandlerV1 extends DeleteHandlerV1 {
@Override
@Override
protected
void
_deleteVertex
(
AtlasVertex
instanceVertex
,
boolean
force
)
{
protected
void
_deleteVertex
(
AtlasVertex
instanceVertex
,
boolean
force
)
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> SoftDeleteHandlerV1._deleteVertex({}, {})"
,
GraphHelper
.
string
(
instanceVertex
),
force
);
}
graphHelper
.
removeVertex
(
instanceVertex
);
graphHelper
.
removeVertex
(
instanceVertex
);
}
}
@Override
@Override
protected
void
deleteEdge
(
AtlasEdge
edge
,
boolean
force
)
throws
AtlasBaseException
{
protected
void
deleteEdge
(
AtlasEdge
edge
,
boolean
force
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> HardDeleteHandlerV1.deleteEdge({}, {})"
,
GraphHelper
.
string
(
edge
),
force
);
}
graphHelper
.
removeEdge
(
edge
);
graphHelper
.
removeEdge
(
edge
);
}
}
}
}
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1.java
View file @
c76afbe2
...
@@ -45,6 +45,10 @@ public class SoftDeleteHandlerV1 extends DeleteHandlerV1 {
...
@@ -45,6 +45,10 @@ public class SoftDeleteHandlerV1 extends DeleteHandlerV1 {
@Override
@Override
protected
void
_deleteVertex
(
AtlasVertex
instanceVertex
,
boolean
force
)
{
protected
void
_deleteVertex
(
AtlasVertex
instanceVertex
,
boolean
force
)
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> SoftDeleteHandlerV1._deleteVertex({}, {})"
,
GraphHelper
.
string
(
instanceVertex
),
force
);
}
if
(
force
)
{
if
(
force
)
{
graphHelper
.
removeVertex
(
instanceVertex
);
graphHelper
.
removeVertex
(
instanceVertex
);
}
else
{
}
else
{
...
@@ -60,6 +64,10 @@ public class SoftDeleteHandlerV1 extends DeleteHandlerV1 {
...
@@ -60,6 +64,10 @@ public class SoftDeleteHandlerV1 extends DeleteHandlerV1 {
@Override
@Override
protected
void
deleteEdge
(
AtlasEdge
edge
,
boolean
force
)
throws
AtlasBaseException
{
protected
void
deleteEdge
(
AtlasEdge
edge
,
boolean
force
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> SoftDeleteHandlerV1.deleteEdge({}, {})"
,
GraphHelper
.
string
(
edge
),
force
);
}
if
(
force
)
{
if
(
force
)
{
graphHelper
.
removeEdge
(
edge
);
graphHelper
.
removeEdge
(
edge
);
}
else
{
}
else
{
...
...
repository/src/test/java/org/apache/atlas/glossary/GlossaryServiceTest.java
View file @
c76afbe2
...
@@ -332,7 +332,7 @@ public class GlossaryServiceTest {
...
@@ -332,7 +332,7 @@ public class GlossaryServiceTest {
try
{
try
{
glossaryService
.
getGlossary
(
bankGlossary
.
getGuid
());
glossaryService
.
getGlossary
(
bankGlossary
.
getGuid
());
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
assertEquals
(
e
.
getAtlasErrorCode
(),
AtlasErrorCode
.
INSTANCE_GUID_
DELETE
D
);
assertEquals
(
e
.
getAtlasErrorCode
(),
AtlasErrorCode
.
INSTANCE_GUID_
NOT_FOUN
D
);
}
}
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
fail
(
"Glossary delete should've succeeded"
,
e
);
fail
(
"Glossary delete should've succeeded"
,
e
);
...
...
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