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
eaf067bc
Commit
eaf067bc
authored
May 18, 2018
by
apoorvnaik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2705: Search using term shouldn't show deleted entities by default
Change-Id: I23b53086b2bb2380f451e7d85b59096edc610181
parent
0b9d7113
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
SearchContext.java
...c/main/java/org/apache/atlas/discovery/SearchContext.java
+7
-3
TermSearchProcessor.java
.../java/org/apache/atlas/discovery/TermSearchProcessor.java
+9
-13
No files found.
repository/src/main/java/org/apache/atlas/discovery/SearchContext.java
View file @
eaf067bc
...
@@ -27,16 +27,15 @@ import org.apache.atlas.model.typedef.AtlasClassificationDef;
...
@@ -27,16 +27,15 @@ import org.apache.atlas.model.typedef.AtlasClassificationDef;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graph.GraphHelper
;
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.AtlasEdgeDirection
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.graphdb.AtlasGraphQuery
;
import
org.apache.atlas.repository.graphdb.AtlasGraphQuery
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasStructType
;
import
org.apache.atlas.type.AtlasStructType
;
import
org.apache.atlas.type.AtlasStructType.AtlasAttribute
;
import
org.apache.atlas.type.AtlasStructType.AtlasAttribute
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.v1.model.instance.Id
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -233,11 +232,16 @@ public class SearchContext {
...
@@ -233,11 +232,16 @@ public class SearchContext {
AtlasAttribute
attr
=
termType
.
getRelationshipAttribute
(
TermSearchProcessor
.
ATLAS_GLOSSARY_TERM_ATTR_ASSIGNED_ENTITIES
);
AtlasAttribute
attr
=
termType
.
getRelationshipAttribute
(
TermSearchProcessor
.
ATLAS_GLOSSARY_TERM_ATTR_ASSIGNED_ENTITIES
);
Iterator
<
AtlasEdge
>
edges
=
GraphHelper
.
getEdgesForLabel
(
glossaryTerm
,
attr
.
getRelationshipEdgeLabel
(),
attr
.
getRelationshipEdgeDirection
());
Iterator
<
AtlasEdge
>
edges
=
GraphHelper
.
getEdgesForLabel
(
glossaryTerm
,
attr
.
getRelationshipEdgeLabel
(),
attr
.
getRelationshipEdgeDirection
());
boolean
excludeDeletedEntities
=
searchParameters
.
getExcludeDeletedEntities
();
if
(
edges
!=
null
)
{
if
(
edges
!=
null
)
{
while
(
edges
.
hasNext
())
{
while
(
edges
.
hasNext
())
{
AtlasEdge
edge
=
edges
.
next
();
AtlasEdge
edge
=
edges
.
next
();
ret
.
add
(
edge
.
getInVertex
());
AtlasVertex
inVertex
=
edge
.
getInVertex
();
if
(
excludeDeletedEntities
&&
AtlasGraphUtilsV1
.
getState
(
inVertex
)
==
AtlasEntity
.
Status
.
DELETED
)
{
continue
;
}
ret
.
add
(
inVertex
);
}
}
}
}
...
...
repository/src/main/java/org/apache/atlas/discovery/TermSearchProcessor.java
View file @
eaf067bc
...
@@ -20,7 +20,6 @@ package org.apache.atlas.discovery;
...
@@ -20,7 +20,6 @@ package org.apache.atlas.discovery;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.utils.AtlasPerfTracer
;
import
org.apache.atlas.utils.AtlasPerfTracer
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.Predicate
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -89,21 +88,18 @@ public class TermSearchProcessor extends SearchProcessor {
...
@@ -89,21 +88,18 @@ public class TermSearchProcessor extends SearchProcessor {
if
(
CollectionUtils
.
isEmpty
(
assignedEntities
))
{
if
(
CollectionUtils
.
isEmpty
(
assignedEntities
))
{
entityVertices
.
clear
();
entityVertices
.
clear
();
}
else
{
}
else
{
CollectionUtils
.
filter
(
entityVertices
,
new
Predicate
()
{
CollectionUtils
.
filter
(
entityVertices
,
o
->
{
@Override
if
(
o
instanceof
AtlasVertex
)
{
public
boolean
evaluate
(
Object
o
)
{
AtlasVertex
entityVertex
=
(
AtlasVertex
)
o
;
if
(
o
instanceof
AtlasVertex
)
{
AtlasVertex
entityVertex
=
(
AtlasVertex
)
o
;
for
(
AtlasVertex
assignedEntity
:
assignedEntities
)
{
if
(
assignedEntity
.
getId
().
equals
(
entityVertex
.
getId
()))
{
for
(
AtlasVertex
assignedEntity
:
assignedEntities
)
{
return
true
;
if
(
assignedEntity
.
getId
().
equals
(
entityVertex
.
getId
()))
{
return
true
;
}
}
}
}
}
return
false
;
}
}
return
false
;
});
});
}
}
}
}
...
...
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