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
6 years ago
by
Sarath Subramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3073: Investigate and fix IT failures in EntityJerseyResourceIT
parent
0f79c344
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
39 deletions
+33
-39
AtlasEntityFormatConverter.java
...las/repository/converters/AtlasEntityFormatConverter.java
+3
-38
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;
...
@@ -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
;
import
org.apache.atlas.model.instance.AtlasEntity.Status
;
import
org.apache.atlas.model.instance.AtlasEntity.Status
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
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.AtlasSystemAttributes
;
import
org.apache.atlas.v1.model.instance.Id
;
import
org.apache.atlas.v1.model.instance.Id
;
import
org.apache.atlas.v1.model.instance.Referenceable
;
import
org.apache.atlas.v1.model.instance.Referenceable
;
...
@@ -129,29 +130,11 @@ public class AtlasEntityFormatConverter extends AtlasStructFormatConverter {
...
@@ -129,29 +130,11 @@ public class AtlasEntityFormatConverter extends AtlasStructFormatConverter {
}
}
final
Map
v2Attribs
=
(
Map
)
v2Map
.
get
(
ATTRIBUTES_PROPERTY_KEY
);
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
;
}
if
(
MapUtils
.
isEmpty
(
v2Attribs
))
{
if
(
MapUtils
.
isEmpty
(
v2Attribs
))
{
ret
=
new
Id
(
idStr
,
0
,
typeName
);
ret
=
new
Id
(
idStr
,
0
,
typeName
);
}
else
{
}
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
)
{
}
else
if
(
v2Obj
instanceof
AtlasEntity
)
{
AtlasEntity
entity
=
(
AtlasEntity
)
v2Obj
;
AtlasEntity
entity
=
(
AtlasEntity
)
v2Obj
;
...
@@ -162,27 +145,9 @@ public class AtlasEntityFormatConverter extends AtlasStructFormatConverter {
...
@@ -162,27 +145,9 @@ public class AtlasEntityFormatConverter extends AtlasStructFormatConverter {
}
}
final
Map
<
String
,
Object
>
v2Attribs
=
entity
.
getAttributes
();
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
;
}
Referenceable
referenceable
=
new
Referenceable
(
entity
.
getGuid
(),
entity
.
getTypeName
(),
status
.
name
(),
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
()));
new
AtlasSystemAttributes
(
entity
.
getCreatedBy
(),
entity
.
getUpdatedBy
(),
entity
.
getCreateTime
(),
entity
.
getUpdateTime
()));
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getClassifications
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
entity
.
getClassifications
()))
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
View file @
df44a5cb
...
@@ -65,6 +65,7 @@ import javax.inject.Inject;
...
@@ -65,6 +65,7 @@ import javax.inject.Inject;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -1044,13 +1045,41 @@ public class EntityGraphRetriever {
...
@@ -1044,13 +1045,41 @@ public class EntityGraphRetriever {
entity
.
setRelationshipAttribute
(
attributeName
,
ret
);
entity
.
setRelationshipAttribute
(
attributeName
,
ret
);
if
(
attributeEndDef
.
getIsLegacyAttribute
()
&&
!
entity
.
hasAttribute
(
attributeName
))
{
if
(
attributeEndDef
.
getIsLegacyAttribute
()
&&
!
entity
.
hasAttribute
(
attributeName
))
{
entity
.
setAttribute
(
attributeName
,
ret
);
entity
.
setAttribute
(
attributeName
,
toAtlasObjectId
(
ret
)
);
}
}
}
}
return
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
{
private
AtlasObjectId
mapRelatedVertexToObjectId
(
AtlasVertex
entityVertex
,
AtlasAttribute
attribute
,
AtlasEntityExtInfo
entityExtInfo
,
boolean
isMinExtInfo
)
throws
AtlasBaseException
{
AtlasEdge
edge
=
graphHelper
.
getEdgeForLabel
(
entityVertex
,
attribute
.
getRelationshipEdgeLabel
(),
attribute
.
getRelationshipEdgeDirection
());
AtlasEdge
edge
=
graphHelper
.
getEdgeForLabel
(
entityVertex
,
attribute
.
getRelationshipEdgeLabel
(),
attribute
.
getRelationshipEdgeDirection
());
...
...
This diff is collapsed.
Click to expand it.
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