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
b0470f50
Commit
b0470f50
authored
7 years ago
by
Sarath Subramanian
Committed by
Madhan Neethiraj
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1943: Fix IT failure due to incorrect inverse reference check using relationship
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
40d909ef
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
5 deletions
+39
-5
AtlasRelationshipStore.java
.../atlas/repository/store/graph/AtlasRelationshipStore.java
+7
-0
AtlasRelationshipStoreV1.java
...s/repository/store/graph/v1/AtlasRelationshipStoreV1.java
+25
-0
EntityGraphMapper.java
...he/atlas/repository/store/graph/v1/EntityGraphMapper.java
+7
-5
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasRelationshipStore.java
View file @
b0470f50
...
...
@@ -46,6 +46,13 @@ public interface AtlasRelationshipStore {
AtlasRelationship
getById
(
String
guid
)
throws
AtlasBaseException
;
/**
* Retrieve a relationship if it exists or creates a new relationship instance.
* @param relationship relationship instance definition
* @return AtlasRelationship
*/
AtlasRelationship
getOrCreate
(
AtlasRelationship
relationship
)
throws
AtlasBaseException
;
/**
* Delete a relationship instance using guid.
* @param guid relationship instance guid
*/
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipStoreV1.java
View file @
b0470f50
...
...
@@ -117,6 +117,31 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
@Override
@GraphTransaction
public
AtlasRelationship
getOrCreate
(
AtlasRelationship
relationship
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getOrCreate({})"
,
relationship
);
}
validateRelationship
(
relationship
);
AtlasVertex
end1Vertex
=
getVertexFromEndPoint
(
relationship
.
getEnd1
());
AtlasVertex
end2Vertex
=
getVertexFromEndPoint
(
relationship
.
getEnd2
());
AtlasRelationship
ret
;
// check if relationship exists
AtlasEdge
relationshipEdge
=
getRelationshipEdge
(
end1Vertex
,
end2Vertex
,
relationship
);
ret
=
(
relationshipEdge
!=
null
)
?
mapEdgeToAtlasRelationship
(
relationshipEdge
)
:
create
(
relationship
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== getOrCreate({}): {}"
,
relationship
,
ret
);
}
return
ret
;
}
@Override
@GraphTransaction
public
AtlasRelationship
update
(
AtlasRelationship
relationship
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> update({})"
,
relationship
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
View file @
b0470f50
...
...
@@ -422,7 +422,9 @@ public class EntityGraphMapper {
AtlasEntityType
entityType
=
(
AtlasEntityType
)
inverseAttributeType
;
if
(
entityType
.
hasRelationshipAttribute
(
inverseAttributeName
))
{
ret
=
createRelationship
(
inverseVertex
,
vertex
,
inverseAttribute
.
getRelationshipEdgeLabel
());
String
relationshipName
=
graphHelper
.
getRelationshipDefName
(
inverseVertex
,
entityType
,
inverseAttributeName
);
ret
=
getOrCreateRelationship
(
inverseVertex
,
vertex
,
relationshipName
);
}
else
{
if
(
LOG
.
isDebugEnabled
())
{
...
...
@@ -584,7 +586,7 @@ public class EntityGraphMapper {
}
else
{
String
relationshipName
=
graphHelper
.
getRelationshipDefName
(
entityVertex
,
entityType
,
attributeName
);
ret
=
c
reateRelationship
(
entityVertex
,
attributeVertex
,
relationshipName
);
ret
=
getOrC
reateRelationship
(
entityVertex
,
attributeVertex
,
relationshipName
);
}
}
else
{
...
...
@@ -951,7 +953,7 @@ public class EntityGraphMapper {
relationshipName
=
currentEdge
.
getLabel
();
}
ret
=
c
reateRelationship
(
currentEdge
.
getOutVertex
(),
entityVertex
,
relationshipName
);
ret
=
getOrC
reateRelationship
(
currentEdge
.
getOutVertex
(),
entityVertex
,
relationshipName
);
}
return
ret
;
...
...
@@ -1180,11 +1182,11 @@ public class EntityGraphMapper {
}
}
private
AtlasEdge
c
reateRelationship
(
AtlasVertex
end1Vertex
,
AtlasVertex
end2Vertex
,
String
relationshipName
)
throws
AtlasBaseException
{
private
AtlasEdge
getOrC
reateRelationship
(
AtlasVertex
end1Vertex
,
AtlasVertex
end2Vertex
,
String
relationshipName
)
throws
AtlasBaseException
{
AtlasEdge
ret
=
null
;
AtlasObjectId
end1
=
new
AtlasObjectId
(
AtlasGraphUtilsV1
.
getIdFromVertex
(
end1Vertex
),
AtlasGraphUtilsV1
.
getTypeName
(
end1Vertex
));
AtlasObjectId
end2
=
new
AtlasObjectId
(
AtlasGraphUtilsV1
.
getIdFromVertex
(
end2Vertex
),
AtlasGraphUtilsV1
.
getTypeName
(
end2Vertex
));
AtlasRelationship
relationship
=
relationshipStore
.
c
reate
(
new
AtlasRelationship
(
relationshipName
,
end1
,
end2
));
AtlasRelationship
relationship
=
relationshipStore
.
getOrC
reate
(
new
AtlasRelationship
(
relationshipName
,
end1
,
end2
));
// return newly created AtlasEdge
// if multiple edges are returned, compare using id to pick the right one
...
...
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