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
df44a5cb
Commit
df44a5cb
authored
Mar 12, 2019
by
Sarath Subramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3073: Investigate and fix IT failures in EntityJerseyResourceIT
parent
0f79c344
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
41 deletions
+35
-41
AtlasEntityFormatConverter.java
...las/repository/converters/AtlasEntityFormatConverter.java
+5
-40
EntityGraphRetriever.java
...atlas/repository/store/graph/v2/EntityGraphRetriever.java
+30
-1
No files found.
repository/src/main/java/org/apache/atlas/repository/converters/AtlasEntityFormatConverter.java
View file @
df44a5cb
...
...
@@ -24,6 +24,7 @@ import org.apache.atlas.model.instance.AtlasClassification;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity.Status
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.type.AtlasStructType
;
import
org.apache.atlas.v1.model.instance.AtlasSystemAttributes
;
import
org.apache.atlas.v1.model.instance.Id
;
import
org.apache.atlas.v1.model.instance.Referenceable
;
...
...
@@ -128,30 +129,12 @@ public class AtlasEntityFormatConverter extends AtlasStructFormatConverter {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
);
}
final
Map
v2Attribs
=
(
Map
)
v2Map
.
get
(
ATTRIBUTES_PROPERTY_KEY
);
final
Map
v2RelationshipAttribs
=
(
Map
)
v2Map
.
get
(
RELATIONSHIP_ATTRIBUTES_PROPERTY_KEY
);
final
Map
attributes
;
if
(
MapUtils
.
isNotEmpty
(
v2RelationshipAttribs
))
{
if
(
MapUtils
.
isNotEmpty
(
v2Attribs
))
{
attributes
=
new
HashMap
(
v2RelationshipAttribs
);
for
(
Object
key
:
v2Attribs
.
keySet
())
{
if
(!
attributes
.
containsKey
(
key
))
{
attributes
.
put
(
key
,
v2Attribs
.
get
(
key
));
}
}
}
else
{
attributes
=
v2RelationshipAttribs
;
}
}
else
{
attributes
=
v2Attribs
;
}
final
Map
v2Attribs
=
(
Map
)
v2Map
.
get
(
ATTRIBUTES_PROPERTY_KEY
);
if
(
MapUtils
.
isEmpty
(
v2Attribs
))
{
ret
=
new
Id
(
idStr
,
0
,
typeName
);
}
else
{
ret
=
new
Referenceable
(
idStr
,
typeName
,
super
.
fromV2ToV1
(
entityType
,
attribute
s
,
context
));
ret
=
new
Referenceable
(
idStr
,
typeName
,
super
.
fromV2ToV1
(
entityType
,
v2Attrib
s
,
context
));
}
}
else
if
(
v2Obj
instanceof
AtlasEntity
)
{
AtlasEntity
entity
=
(
AtlasEntity
)
v2Obj
;
...
...
@@ -161,28 +144,10 @@ public class AtlasEntityFormatConverter extends AtlasStructFormatConverter {
status
=
Status
.
ACTIVE
;
}
final
Map
<
String
,
Object
>
v2Attribs
=
entity
.
getAttributes
();
final
Map
<
String
,
Object
>
v2RelationshipAttribs
=
entity
.
getRelationshipAttributes
();
final
Map
<
String
,
Object
>
attributes
;
if
(
MapUtils
.
isNotEmpty
(
v2RelationshipAttribs
))
{
if
(
MapUtils
.
isNotEmpty
(
v2Attribs
))
{
attributes
=
new
HashMap
(
v2RelationshipAttribs
);
for
(
String
key
:
v2Attribs
.
keySet
())
{
if
(!
attributes
.
containsKey
(
key
))
{
attributes
.
put
(
key
,
v2Attribs
.
get
(
key
));
}
}
}
else
{
attributes
=
v2RelationshipAttribs
;
}
}
else
{
attributes
=
v2Attribs
;
}
final
Map
<
String
,
Object
>
v2Attribs
=
entity
.
getAttributes
();
Referenceable
referenceable
=
new
Referenceable
(
entity
.
getGuid
(),
entity
.
getTypeName
(),
status
.
name
(),
fromV2ToV1
(
entityType
,
attribute
s
,
context
),
fromV2ToV1
(
entityType
,
v2Attrib
s
,
context
),
new
AtlasSystemAttributes
(
entity
.
getCreatedBy
(),
entity
.
getUpdatedBy
(),
entity
.
getCreateTime
(),
entity
.
getUpdateTime
()));
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getClassifications
()))
{
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
View file @
df44a5cb
...
...
@@ -65,6 +65,7 @@ import javax.inject.Inject;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
...
...
@@ -1044,13 +1045,41 @@ public class EntityGraphRetriever {
entity
.
setRelationshipAttribute
(
attributeName
,
ret
);
if
(
attributeEndDef
.
getIsLegacyAttribute
()
&&
!
entity
.
hasAttribute
(
attributeName
))
{
entity
.
setAttribute
(
attributeName
,
ret
);
entity
.
setAttribute
(
attributeName
,
toAtlasObjectId
(
ret
)
);
}
}
return
ret
;
}
private
Object
toAtlasObjectId
(
Object
obj
)
{
final
Object
ret
;
if
(
obj
instanceof
AtlasObjectId
)
{
ret
=
new
AtlasObjectId
((
AtlasObjectId
)
obj
);
}
else
if
(
obj
instanceof
Collection
)
{
List
list
=
new
ArrayList
();
for
(
Object
elem
:
(
Collection
)
obj
)
{
list
.
add
(
toAtlasObjectId
(
elem
));
}
ret
=
list
;
}
else
if
(
obj
instanceof
Map
)
{
Map
map
=
new
HashMap
();
for
(
Object
key
:
((
Map
)
obj
).
keySet
())
{
map
.
put
(
key
,
toAtlasObjectId
(((
Map
)
obj
).
get
(
key
)));
}
ret
=
map
;
}
else
{
ret
=
obj
;
}
return
ret
;
}
private
AtlasObjectId
mapRelatedVertexToObjectId
(
AtlasVertex
entityVertex
,
AtlasAttribute
attribute
,
AtlasEntityExtInfo
entityExtInfo
,
boolean
isMinExtInfo
)
throws
AtlasBaseException
{
AtlasEdge
edge
=
graphHelper
.
getEdgeForLabel
(
entityVertex
,
attribute
.
getRelationshipEdgeLabel
(),
attribute
.
getRelationshipEdgeDirection
());
...
...
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