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
e841619c
Commit
e841619c
authored
Mar 03, 2017
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1627: fix for missed update to full-text index attribute on entity-update
parent
9ba2ff0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
43 deletions
+43
-43
AtlasEntityChangeNotifier.java
.../repository/store/graph/v1/AtlasEntityChangeNotifier.java
+21
-27
EntityGraphRetriever.java
...atlas/repository/store/graph/v1/EntityGraphRetriever.java
+22
-16
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
View file @
e841619c
...
...
@@ -72,32 +72,16 @@ public class AtlasEntityChangeNotifier {
List
<
AtlasEntityHeader
>
partiallyUpdatedEntities
=
entityMutationResponse
.
getPartialUpdatedEntities
();
List
<
AtlasEntityHeader
>
deletedEntities
=
entityMutationResponse
.
getDeletedEntities
();
if
(
CollectionUtils
.
isNotEmpty
(
createdEntities
))
{
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
createdEntities
);
doFullTextMapping
(
createdEntities
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
CREATE
);
}
if
(
CollectionUtils
.
isNotEmpty
(
updatedEntities
))
{
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
updatedEntities
);
doFullTextMapping
(
updatedEntities
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
UPDATE
);
}
if
(
CollectionUtils
.
isNotEmpty
(
partiallyUpdatedEntities
))
{
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
partiallyUpdatedEntities
);
doFullTextMapping
(
partiallyUpdatedEntities
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
PARTIAL_UPDATE
);
}
if
(
CollectionUtils
.
isNotEmpty
(
deletedEntities
))
{
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
deletedEntities
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
DELETE
);
}
// complete full text mapping before calling toITypedReferenceable(), from notifyListners(), to
// include all vertex updates in the current graph-transaction
doFullTextMapping
(
createdEntities
);
doFullTextMapping
(
updatedEntities
);
doFullTextMapping
(
partiallyUpdatedEntities
);
notifyListeners
(
createdEntities
,
EntityOperation
.
CREATE
);
notifyListeners
(
updatedEntities
,
EntityOperation
.
UPDATE
);
notifyListeners
(
partiallyUpdatedEntities
,
EntityOperation
.
PARTIAL_UPDATE
);
notifyListeners
(
deletedEntities
,
EntityOperation
.
DELETE
);
}
public
void
onClassificationAddedToEntity
(
String
entityId
,
List
<
AtlasClassification
>
classifications
)
throws
AtlasBaseException
{
...
...
@@ -133,7 +117,13 @@ public class AtlasEntityChangeNotifier {
}
}
private
void
notifyListeners
(
List
<
ITypedReferenceableInstance
>
typedRefInsts
,
EntityOperation
operation
)
throws
AtlasBaseException
{
private
void
notifyListeners
(
List
<
AtlasEntityHeader
>
entityHeaders
,
EntityOperation
operation
)
throws
AtlasBaseException
{
if
(
CollectionUtils
.
isEmpty
(
entityHeaders
))
{
return
;
}
List
<
ITypedReferenceableInstance
>
typedRefInsts
=
toITypedReferenceable
(
entityHeaders
);
for
(
EntityChangeListener
listener
:
entityChangeListeners
)
{
try
{
switch
(
operation
)
{
...
...
@@ -191,6 +181,10 @@ public class AtlasEntityChangeNotifier {
}
private
void
doFullTextMapping
(
List
<
AtlasEntityHeader
>
atlasEntityHeaders
)
{
if
(
CollectionUtils
.
isEmpty
(
atlasEntityHeaders
))
{
return
;
}
try
{
if
(!
AtlasRepositoryConfiguration
.
isFullTextSearchEnabled
())
{
return
;
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
View file @
e841619c
...
...
@@ -20,7 +20,6 @@ package org.apache.atlas.repository.store.graph.v1;
import
com.sun.istack.Nullable
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
...
@@ -127,29 +126,36 @@ public final class EntityGraphRetriever {
}
private
AtlasVertex
getEntityVertex
(
String
guid
)
throws
AtlasBaseException
{
try
{
return
graphHelper
.
getVertexForGUID
(
guid
);
}
catch
(
AtlasException
excp
)
{
AtlasVertex
ret
=
AtlasGraphUtilsV1
.
findByGuid
(
guid
);
if
(
ret
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
}
return
ret
;
}
private
AtlasVertex
getEntityVertex
(
AtlasObjectId
objId
)
throws
AtlasBaseException
{
try
{
if
(!
AtlasTypeUtil
.
isValid
(
objId
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
objId
.
toString
());
}
if
(
AtlasTypeUtil
.
isAssignedGuid
(
objId
))
{
return
graphHelper
.
getVertexForGUID
(
objId
.
getGuid
());
}
else
{
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
objId
.
getTypeName
());
Map
<
String
,
Object
>
uniqAttributes
=
objId
.
getUniqueAttributes
();
AtlasVertex
ret
=
null
;
return
AtlasGraphUtilsV1
.
getVertexByUniqueAttributes
(
entityType
,
uniqAttributes
);
}
}
catch
(
AtlasException
excp
)
{
if
(!
AtlasTypeUtil
.
isValid
(
objId
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
objId
.
toString
());
}
if
(
AtlasTypeUtil
.
isAssignedGuid
(
objId
))
{
ret
=
AtlasGraphUtilsV1
.
findByGuid
(
objId
.
getGuid
());
}
else
{
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
objId
.
getTypeName
());
Map
<
String
,
Object
>
uniqAttributes
=
objId
.
getUniqueAttributes
();
ret
=
AtlasGraphUtilsV1
.
getVertexByUniqueAttributes
(
entityType
,
uniqAttributes
);
}
if
(
ret
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
objId
.
toString
());
}
return
ret
;
}
private
AtlasEntity
mapVertexToAtlasEntity
(
AtlasVertex
entityVertex
,
AtlasEntityExtInfo
entityExtInfo
)
throws
AtlasBaseException
{
...
...
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