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
f8cb6f76
Commit
f8cb6f76
authored
Oct 28, 2019
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3492: updated object-id attributes in audit logs to replace…
ATLAS-3492: updated object-id attributes in audit logs to replace unassigned-guids with assigned-guids (#2)
parent
c6ee2779
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
16 deletions
+38
-16
EntityGraphMapper.java
...he/atlas/repository/store/graph/v2/EntityGraphMapper.java
+38
-16
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
View file @
f8cb6f76
...
...
@@ -597,8 +597,6 @@ public class EntityGraphMapper {
true
,
ctx
.
getAttribute
().
getRelationshipEdgeDirection
(),
ctx
.
getReferringVertex
());
}
setAssignedGuid
(
ctx
.
getValue
(),
context
.
getGuidAssignments
());
return
newEdge
;
}
...
...
@@ -628,7 +626,7 @@ public class EntityGraphMapper {
}
}
setAssignedGuid
(
ctx
.
getValue
(),
context
.
getGuidAssignments
()
);
setAssignedGuid
(
ctx
.
getValue
(),
context
);
return
ret
;
}
...
...
@@ -1021,6 +1019,8 @@ public class EntityGraphMapper {
ret
=
mapObjectIdValue
(
ctx
,
context
);
}
setAssignedGuid
(
ctx
.
getValue
(),
context
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== mapObjectIdValueUsingRelationship({})"
,
ctx
);
}
...
...
@@ -1304,34 +1304,54 @@ public class EntityGraphMapper {
return
null
;
}
private
static
void
setAssignedGuid
(
Object
val
,
Map
<
String
,
String
>
guidAssignements
)
{
if
(
val
!=
null
&&
MapUtils
.
isNotEmpty
(
guidAssignements
))
{
private
static
void
setAssignedGuid
(
Object
val
,
EntityMutationContext
context
)
{
if
(
val
!=
null
)
{
Map
<
String
,
String
>
guidAssignements
=
context
.
getGuidAssignments
();
if
(
val
instanceof
AtlasObjectId
)
{
AtlasObjectId
objId
=
(
AtlasObjectId
)
val
;
String
guid
=
objId
.
getGuid
();
String
assignedGuid
=
null
;
if
(
StringUtils
.
isNotEmpty
(
guid
)
&&
!
AtlasTypeUtil
.
isAssignedGuid
(
guid
))
{
String
assignedGuid
=
guidAssignements
.
get
(
guid
);
if
(
StringUtils
.
isNotEmpty
(
guid
))
{
if
(!
AtlasTypeUtil
.
isAssignedGuid
(
guid
)
&&
MapUtils
.
isNotEmpty
(
guidAssignements
))
{
assignedGuid
=
guidAssignements
.
get
(
guid
);
}
}
else
{
AtlasVertex
vertex
=
context
.
getDiscoveryContext
().
getResolvedEntityVertex
(
objId
);
if
(
vertex
!=
null
)
{
assignedGuid
=
GraphHelper
.
getGuid
(
vertex
);
}
}
if
(
StringUtils
.
isNotEmpty
(
assignedGuid
))
{
RequestContext
.
get
().
recordEntityGuidUpdate
(
objId
,
guid
);
objId
.
setGuid
(
assignedGuid
);
}
}
}
else
if
(
val
instanceof
Map
)
{
Map
objId
=
(
Map
)
val
;
Object
guidVal
=
objId
.
get
(
AtlasObjectId
.
KEY_GUID
);
String
guid
=
objId
!=
null
?
guidVal
.
toString
()
:
null
;
Map
mapObjId
=
(
Map
)
val
;
Object
guidVal
=
mapObjId
.
get
(
AtlasObjectId
.
KEY_GUID
);
String
guid
=
guidVal
!=
null
?
guidVal
.
toString
()
:
null
;
String
assignedGuid
=
null
;
if
(
StringUtils
.
isNotEmpty
(
guid
)
&&
!
AtlasTypeUtil
.
isAssignedGuid
(
guid
))
{
String
assignedGuid
=
guidAssignements
.
get
(
guid
);
if
(
StringUtils
.
isNotEmpty
(
guid
)
)
{
if
(!
AtlasTypeUtil
.
isAssignedGuid
(
guid
)
&&
MapUtils
.
isNotEmpty
(
guidAssignements
))
{
assignedGuid
=
guidAssignements
.
get
(
guid
);
}
}
else
{
AtlasVertex
vertex
=
context
.
getDiscoveryContext
().
getResolvedEntityVertex
(
new
AtlasObjectId
(
mapObjId
));
if
(
vertex
!=
null
)
{
assignedGuid
=
GraphHelper
.
getGuid
(
vertex
);
}
}
if
(
StringUtils
.
isNotEmpty
(
assignedGuid
))
{
RequestContext
.
get
().
recordEntityGuidUpdate
(
o
bjId
,
guid
);
RequestContext
.
get
().
recordEntityGuidUpdate
(
mapO
bjId
,
guid
);
objId
.
put
(
AtlasObjectId
.
KEY_GUID
,
assignedGuid
);
}
mapObjId
.
put
(
AtlasObjectId
.
KEY_GUID
,
assignedGuid
);
}
}
}
...
...
@@ -2148,6 +2168,7 @@ public class EntityGraphMapper {
}
private
void
recordEntityUpdate
(
AtlasVertex
vertex
)
throws
AtlasBaseException
{
if
(
vertex
!=
null
)
{
RequestContext
req
=
RequestContext
.
get
();
if
(!
req
.
isUpdatedEntity
(
GraphHelper
.
getGuid
(
vertex
)))
{
...
...
@@ -2156,6 +2177,7 @@ public class EntityGraphMapper {
req
.
recordEntityUpdate
(
entityRetriever
.
toAtlasEntityHeader
(
vertex
));
}
}
}
private
String
getIdFromInVertex
(
AtlasEdge
edge
)
{
return
getIdFromVertex
(
edge
.
getInVertex
());
...
...
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