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
7fcf0415
Commit
7fcf0415
authored
6 years ago
by
mayanknj
Committed by
Sarath Subramanian
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3310:- Fix create/update Relationships, after updating a bigint attribute.
parent
93addf06
master
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
6 deletions
+33
-6
AtlasRelationshipType.java
...ain/java/org/apache/atlas/type/AtlasRelationshipType.java
+18
-2
AtlasRelationshipStoreV2.java
...s/repository/store/graph/v2/AtlasRelationshipStoreV2.java
+15
-4
No files found.
intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java
View file @
7fcf0415
...
...
@@ -20,6 +20,7 @@ package org.apache.atlas.type;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasRelationship
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasRelationshipDef
;
...
...
@@ -242,14 +243,29 @@ public class AtlasRelationshipType extends AtlasStructType {
* @throws AtlasBaseException
*/
private
boolean
validateRelationship
(
AtlasRelationship
relationship
)
{
String
end1TypeName
=
relationship
.
getEnd1
()
!=
null
?
relationship
.
getEnd1
().
getTypeName
()
:
null
;
String
end2TypeName
=
relationship
.
getEnd2
()
!=
null
?
relationship
.
getEnd2
().
getTypeName
()
:
null
;
AtlasObjectId
end1
=
relationship
.
getEnd1
();
AtlasObjectId
end2
=
relationship
.
getEnd2
();
if
(
end1
!=
null
&&
end2
!=
null
)
{
String
end1TypeName
=
end1
.
getTypeName
();
String
end2TypeName
=
end2
.
getTypeName
();
if
(
StringUtils
.
isNotEmpty
(
end1TypeName
)
&&
StringUtils
.
isNotEmpty
(
end2TypeName
))
{
return
end1Type
.
isTypeOrSuperTypeOf
(
end1TypeName
)
&&
end2Type
.
isTypeOrSuperTypeOf
(
end2TypeName
)
&&
super
.
isValidValue
(
relationship
);
}
else
{
return
StringUtils
.
isNotEmpty
(
end1
.
getGuid
())
&&
StringUtils
.
isNotEmpty
(
end2
.
getGuid
());
}
}
return
false
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java
View file @
7fcf0415
...
...
@@ -192,7 +192,16 @@ public class AtlasRelationshipStoreV2 implements AtlasRelationshipStore {
}
}
validateRelationship
(
end1Vertex
,
end2Vertex
,
edgeType
,
relationship
.
getAttributes
());
boolean
relationshipTypeNotExists
=
false
;
if
(
StringUtils
.
isEmpty
(
relationship
.
getTypeName
()))
{
relationship
.
setTypeName
(
edgeType
);
relationshipTypeNotExists
=
true
;
}
validateRelationship
(
end1Vertex
,
end2Vertex
,
relationship
);
if
(
relationshipTypeNotExists
)
{
relationship
.
setTypeName
(
null
);
}
AtlasRelationship
ret
=
updateRelationship
(
edge
,
relationship
);
sendNotifications
(
ret
,
OperationType
.
RELATIONSHIP_UPDATE
);
...
...
@@ -337,7 +346,7 @@ public class AtlasRelationshipStoreV2 implements AtlasRelationshipStore {
AtlasEdge
ret
;
try
{
validateRelationship
(
end1Vertex
,
end2Vertex
,
relationship
.
getTypeName
(),
relationship
.
getAttributes
()
);
validateRelationship
(
end1Vertex
,
end2Vertex
,
relationship
);
String
relationshipLabel
=
getRelationshipEdgeLabel
(
end1Vertex
,
end2Vertex
,
relationship
.
getTypeName
());
...
...
@@ -623,7 +632,10 @@ public class AtlasRelationshipStoreV2 implements AtlasRelationshipStore {
validateAndNormalize
(
relationship
);
}
private
void
validateRelationship
(
AtlasVertex
end1Vertex
,
AtlasVertex
end2Vertex
,
String
relationshipName
,
Map
<
String
,
Object
>
attributes
)
throws
AtlasBaseException
{
private
void
validateRelationship
(
AtlasVertex
end1Vertex
,
AtlasVertex
end2Vertex
,
AtlasRelationship
relationship
)
throws
AtlasBaseException
{
String
relationshipName
=
relationship
.
getTypeName
();
AtlasRelationshipType
relationshipType
=
typeRegistry
.
getRelationshipTypeByName
(
relationshipName
);
if
(
relationshipType
==
null
)
{
...
...
@@ -654,7 +666,6 @@ public class AtlasRelationshipStoreV2 implements AtlasRelationshipStore {
}
List
<
String
>
messages
=
new
ArrayList
<>();
AtlasRelationship
relationship
=
new
AtlasRelationship
(
relationshipName
,
attributes
);
relationshipType
.
validateValue
(
relationship
,
relationshipName
,
messages
);
...
...
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