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
c3808cf1
Commit
c3808cf1
authored
Jul 13, 2017
by
Sarath Subramanian
Committed by
Madhan Neethiraj
Jul 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1949: Fix coverity scan issues and IT failures due to ATLAS-1943
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
18745cf4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
11 deletions
+25
-11
AtlasErrorCode.java
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+1
-0
GraphHelper.java
...n/java/org/apache/atlas/repository/graph/GraphHelper.java
+4
-0
EntityGraphMapper.java
...he/atlas/repository/store/graph/v1/EntityGraphMapper.java
+4
-4
EntityGraphRetriever.java
...atlas/repository/store/graph/v1/EntityGraphRetriever.java
+16
-7
No files found.
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
View file @
c3808cf1
...
...
@@ -88,6 +88,7 @@ public enum AtlasErrorCode {
RELATIONSHIPDEF_END1_NAME_INVALID
(
400
,
"ATLAS-400-00-041"
,
"{0}: invalid end1 name. Name must not contain query keywords"
),
RELATIONSHIPDEF_END2_NAME_INVALID
(
400
,
"ATLAS-400-00-042"
,
"{0}: invalid end2 name. Name must not contain query keywords"
),
RELATIONSHIPDEF_NOT_DEFINED
(
400
,
"ATLAS-400-00-043"
,
"No relationshipDef defined between {0} and {1} on attribute: {2}"
),
RELATIONSHIPDEF_INVALID
(
400
,
"ATLAS-400-00-044"
,
"Invalid relationshipDef: {0}"
),
// All Not found enums go here
TYPE_NAME_NOT_FOUND
(
404
,
"ATLAS-404-00-001"
,
"Given typename {0} was invalid"
),
TYPE_GUID_NOT_FOUND
(
404
,
"ATLAS-404-00-002"
,
"Given type guid {0} was invalid"
),
...
...
repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
View file @
c3808cf1
...
...
@@ -1269,6 +1269,10 @@ public final class GraphHelper {
}
}
if
(
ret
==
null
)
{
ret
=
relationshipTypes
.
get
(
0
).
getRelationshipDef
();
}
}
else
{
//relationshipTypes will have at least one relationshipDef
ret
=
relationshipTypes
.
get
(
0
).
getRelationshipDef
();
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
View file @
c3808cf1
...
...
@@ -328,7 +328,7 @@ public class EntityGraphMapper {
newEdge
=
mapObjectIdValueUsingRelationship
(
ctx
,
context
);
if
(
ctx
.
getAttribute
().
getInverseRefAttribute
()
!=
null
)
{
if
(
newEdge
!=
null
&&
ctx
.
getAttribute
().
getInverseRefAttribute
()
!=
null
)
{
// Update the inverse reference using relationship on the target entity
addInverseReference
(
ctx
.
getAttribute
().
getInverseRefAttribute
(),
newEdge
);
}
...
...
@@ -380,13 +380,13 @@ public class EntityGraphMapper {
case
ARRAY:
// Add edge ID to property value
List
<
String
>
elements
=
inverseVertex
.
getProperty
(
propertyName
,
List
.
class
);
if
(
elements
==
null
)
{
if
(
newEdge
!=
null
&&
elements
==
null
)
{
elements
=
new
ArrayList
<>();
elements
.
add
(
newEdge
.
getId
().
toString
());
inverseVertex
.
setProperty
(
propertyName
,
elements
);
}
else
{
if
(!
elements
.
contains
(
newEdge
.
getId
().
toString
()))
{
if
(
newEdge
!=
null
&&
!
elements
.
contains
(
newEdge
.
getId
().
toString
()))
{
elements
.
add
(
newEdge
.
getId
().
toString
());
inverseVertex
.
setProperty
(
propertyName
,
elements
);
}
...
...
@@ -945,7 +945,7 @@ public class EntityGraphMapper {
String
newEntityId
=
AtlasGraphUtilsV1
.
getIdFromVertex
(
entityVertex
);
AtlasEdge
ret
=
currentEdge
;
if
(!
currentEntityId
.
equals
(
newEntityId
)
&&
entityVertex
!=
null
)
{
if
(!
currentEntityId
.
equals
(
newEntityId
))
{
// create a new relationship edge to the new attribute vertex from the instance
String
relationshipName
=
AtlasGraphUtilsV1
.
getTypeName
(
currentEdge
);
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
View file @
c3808cf1
...
...
@@ -419,13 +419,18 @@ public final class EntityGraphRetriever {
private
Object
mapVertexToRelationshipAttribute
(
AtlasVertex
entityVertex
,
AtlasEntityType
entityType
,
AtlasAttribute
attribute
,
AtlasEntityExtInfo
entityExtInfo
)
throws
AtlasBaseException
{
Object
ret
=
null
;
AtlasRelationshipDef
relationshipDef
=
graphHelper
.
getRelationshipDef
(
entityVertex
,
entityType
,
attribute
.
getName
());
AtlasRelationshipEndDef
endDef1
=
relationshipDef
.
getEndDef1
();
AtlasRelationshipEndDef
endDef2
=
relationshipDef
.
getEndDef2
();
AtlasEntityType
endDef1Type
=
typeRegistry
.
getEntityTypeByName
(
endDef1
.
getType
());
AtlasEntityType
endDef2Type
=
typeRegistry
.
getEntityTypeByName
(
endDef2
.
getType
());
AtlasRelationshipEndDef
attributeEndDef
=
null
;
Object
ret
=
null
;
AtlasRelationshipDef
relationshipDef
=
graphHelper
.
getRelationshipDef
(
entityVertex
,
entityType
,
attribute
.
getName
());
if
(
relationshipDef
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_INVALID
,
"relationshipDef is null"
);
}
AtlasRelationshipEndDef
endDef1
=
relationshipDef
.
getEndDef1
();
AtlasRelationshipEndDef
endDef2
=
relationshipDef
.
getEndDef2
();
AtlasEntityType
endDef1Type
=
typeRegistry
.
getEntityTypeByName
(
endDef1
.
getType
());
AtlasEntityType
endDef2Type
=
typeRegistry
.
getEntityTypeByName
(
endDef2
.
getType
());
AtlasRelationshipEndDef
attributeEndDef
=
null
;
if
(
endDef1Type
.
isTypeOrSuperTypeOf
(
entityType
.
getTypeName
())
&&
StringUtils
.
equals
(
endDef1
.
getName
(),
attribute
.
getName
()))
{
attributeEndDef
=
endDef1
;
...
...
@@ -434,6 +439,10 @@ public final class EntityGraphRetriever {
attributeEndDef
=
endDef2
;
}
if
(
attributeEndDef
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_INVALID
,
relationshipDef
.
toString
());
}
String
relationshipLabel
=
attribute
.
getRelationshipEdgeLabel
();
switch
(
attributeEndDef
.
getCardinality
())
{
...
...
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