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
e0abdb3c
Commit
e0abdb3c
authored
Jun 21, 2017
by
David Radley
Committed by
Madhan Neethiraj
Jun 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1887: addressed issues flagged by Coverity Scan
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
f053fd59
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
AtlasRelationshipType.java
...ain/java/org/apache/atlas/type/AtlasRelationshipType.java
+13
-10
No files found.
intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java
View file @
e0abdb3c
...
@@ -124,17 +124,22 @@ public class AtlasRelationshipType extends AtlasStructType {
...
@@ -124,17 +124,22 @@ public class AtlasRelationshipType extends AtlasStructType {
/**
/**
* Throw an exception so we can junit easily.
* Throw an exception so we can junit easily.
*
* This method assumes that the 2 ends are not null.
*
* @param relationshipDef
* @param relationshipDef
* @throws AtlasBaseException
* @throws AtlasBaseException
*/
*/
public
static
void
validateAtlasRelationshipDef
(
AtlasRelationshipDef
relationshipDef
)
throws
AtlasBaseException
{
public
static
void
validateAtlasRelationshipDef
(
AtlasRelationshipDef
relationshipDef
)
throws
AtlasBaseException
{
AtlasRelationshipEndDef
endDef1
=
relationshipDef
.
getEndDef1
();
AtlasRelationshipEndDef
endDef1
=
relationshipDef
.
getEndDef1
();
AtlasRelationshipEndDef
endDef2
=
relationshipDef
.
getEndDef2
();
AtlasRelationshipEndDef
endDef2
=
relationshipDef
.
getEndDef2
();
boolean
isContainer1
=
endDef1
.
getIsContainer
();
boolean
isContainer2
=
endDef2
.
getIsContainer
();
RelationshipCategory
relationshipCategory
=
relationshipDef
.
getRelationshipCategory
();
RelationshipCategory
relationshipCategory
=
relationshipDef
.
getRelationshipCategory
();
String
name
=
relationshipDef
.
getName
();
String
name
=
relationshipDef
.
getName
();
boolean
isContainer1
=
endDef1
.
getIsContainer
();
boolean
isContainer2
=
endDef2
.
getIsContainer
();
if
(
isContainer1
&&
isContainer2
)
{
if
(
isContainer1
&&
isContainer2
)
{
// we support 0 or 1 of these flags.
// we support 0 or 1 of these flags.
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_DOUBLE_CONTAINERS
,
name
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_DOUBLE_CONTAINERS
,
name
);
...
@@ -157,20 +162,18 @@ public class AtlasRelationshipType extends AtlasStructType {
...
@@ -157,20 +162,18 @@ public class AtlasRelationshipType extends AtlasStructType {
}
}
if
(
relationshipCategory
==
RelationshipCategory
.
COMPOSITION
)
{
if
(
relationshipCategory
==
RelationshipCategory
.
COMPOSITION
)
{
// composition containers should not be multiple cardinality
// composition containers should not be multiple cardinality
if
(
endDef1
!=
null
&&
if
(
endDef1
.
getCardinality
()
==
AtlasAttributeDef
.
Cardinality
.
SET
&&
endDef1
.
getCardinality
()
==
AtlasAttributeDef
.
Cardinality
.
SET
&&
endDef1
.
getIsContainer
())
{
endDef1
.
getIsContainer
())
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER
,
name
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER
,
name
);
}
}
if
(
endDef2
!=
null
&&
endDef2
!=
null
&&
if
((
endDef2
.
getCardinality
()
==
AtlasAttributeDef
.
Cardinality
.
SET
)
&&
endDef2
.
getCardinality
()
==
AtlasAttributeDef
.
Cardinality
.
SET
&&
endDef2
.
getIsContainer
())
{
endDef2
.
getIsContainer
())
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER
,
name
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER
,
name
);
}
}
}
if
((
endDef1
.
getCardinality
()
==
AtlasAttributeDef
.
Cardinality
.
LIST
)
||
if
((
endDef1
!=
null
&&
endDef1
.
getCardinality
()
==
AtlasAttributeDef
.
Cardinality
.
LIST
)
||
(
endDef2
.
getCardinality
()
==
AtlasAttributeDef
.
Cardinality
.
LIST
))
{
(
endDef2
!=
null
&&
endDef2
.
getCardinality
()
==
AtlasAttributeDef
.
Cardinality
.
LIST
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_LIST_ON_END
,
name
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIPDEF_LIST_ON_END
,
name
);
}
}
}
}
}
}
}
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