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
01ea65c2
Commit
01ea65c2
authored
Mar 25, 2019
by
Sarath Subramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3095: Update QuickStartV2 to use relationships
parent
3ba4a3fe
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
3 deletions
+37
-3
AtlasRelationshipDef.java
.../org/apache/atlas/model/typedef/AtlasRelationshipDef.java
+1
-2
AtlasTypeUtil.java
intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
+35
-0
AtlasGraphUtilsV2.java
...he/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
+1
-1
QuickStartV2.java
...src/main/java/org/apache/atlas/examples/QuickStartV2.java
+0
-0
QuickStartV2IT.java
...c/test/java/org/apache/atlas/examples/QuickStartV2IT.java
+0
-0
No files found.
intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipDef.java
View file @
01ea65c2
...
@@ -152,13 +152,12 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
...
@@ -152,13 +152,12 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
*
*
* The ends are defined as 1 and 2 to avoid implying a direction. So we do not use to and from.
* The ends are defined as 1 and 2 to avoid implying a direction. So we do not use to and from.
*
*
* @throws AtlasBaseException
*/
*/
public
AtlasRelationshipDef
(
String
name
,
String
description
,
String
typeVersion
,
public
AtlasRelationshipDef
(
String
name
,
String
description
,
String
typeVersion
,
RelationshipCategory
relationshipCategory
,
RelationshipCategory
relationshipCategory
,
PropagateTags
propagatetags
,
PropagateTags
propagatetags
,
AtlasRelationshipEndDef
endDef1
,
AtlasRelationshipEndDef
endDef1
,
AtlasRelationshipEndDef
endDef2
)
throws
AtlasBaseException
{
AtlasRelationshipEndDef
endDef2
)
{
this
(
name
,
description
,
typeVersion
,
relationshipCategory
,
propagatetags
,
endDef1
,
endDef2
,
this
(
name
,
description
,
typeVersion
,
relationshipCategory
,
propagatetags
,
endDef1
,
endDef2
,
new
ArrayList
<
AtlasAttributeDef
>());
new
ArrayList
<
AtlasAttributeDef
>());
}
}
...
...
intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
View file @
01ea65c2
...
@@ -21,6 +21,7 @@ import org.apache.atlas.model.instance.AtlasClassification;
...
@@ -21,6 +21,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.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasEntityHeader
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasRelatedObjectId
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
...
@@ -276,6 +277,10 @@ public class AtlasTypeUtil {
...
@@ -276,6 +277,10 @@ public class AtlasTypeUtil {
return
new
AtlasEntityDef
(
name
,
description
,
version
,
Arrays
.
asList
(
attrDefs
),
superTypes
);
return
new
AtlasEntityDef
(
name
,
description
,
version
,
Arrays
.
asList
(
attrDefs
),
superTypes
);
}
}
public
static
AtlasEntityDef
createClassTypeDef
(
String
name
,
String
description
,
String
version
,
Set
<
String
>
superTypes
,
Map
<
String
,
String
>
options
,
AtlasAttributeDef
...
attrDefs
)
{
return
new
AtlasEntityDef
(
name
,
description
,
version
,
Arrays
.
asList
(
attrDefs
),
superTypes
,
options
);
}
public
static
AtlasRelationshipDef
createRelationshipTypeDef
(
String
name
,
public
static
AtlasRelationshipDef
createRelationshipTypeDef
(
String
name
,
String
description
,
String
description
,
String
version
,
String
version
,
...
@@ -288,6 +293,10 @@ public class AtlasTypeUtil {
...
@@ -288,6 +293,10 @@ public class AtlasTypeUtil {
endDef1
,
endDef2
,
Arrays
.
asList
(
attrDefs
));
endDef1
,
endDef2
,
Arrays
.
asList
(
attrDefs
));
}
}
public
static
AtlasRelationshipEndDef
createRelationshipEndDef
(
String
typeName
,
String
name
,
Cardinality
cardinality
,
boolean
isContainer
)
{
return
new
AtlasRelationshipEndDef
(
typeName
,
name
,
cardinality
,
isContainer
);
}
public
static
AtlasTypesDef
getTypesDef
(
List
<
AtlasEnumDef
>
enums
,
public
static
AtlasTypesDef
getTypesDef
(
List
<
AtlasEnumDef
>
enums
,
List
<
AtlasStructDef
>
structs
,
List
<
AtlasStructDef
>
structs
,
List
<
AtlasClassificationDef
>
traits
,
List
<
AtlasClassificationDef
>
traits
,
...
@@ -295,6 +304,14 @@ public class AtlasTypeUtil {
...
@@ -295,6 +304,14 @@ public class AtlasTypeUtil {
return
new
AtlasTypesDef
(
enums
,
structs
,
traits
,
classes
);
return
new
AtlasTypesDef
(
enums
,
structs
,
traits
,
classes
);
}
}
public
static
AtlasTypesDef
getTypesDef
(
List
<
AtlasEnumDef
>
enums
,
List
<
AtlasStructDef
>
structs
,
List
<
AtlasClassificationDef
>
traits
,
List
<
AtlasEntityDef
>
classes
,
List
<
AtlasRelationshipDef
>
relations
)
{
return
new
AtlasTypesDef
(
enums
,
structs
,
traits
,
classes
,
relations
);
}
public
static
List
<
AtlasTypeDefHeader
>
toTypeDefHeader
(
AtlasTypesDef
typesDef
)
{
public
static
List
<
AtlasTypeDefHeader
>
toTypeDefHeader
(
AtlasTypesDef
typesDef
)
{
List
<
AtlasTypeDefHeader
>
headerList
=
new
LinkedList
<>();
List
<
AtlasTypeDefHeader
>
headerList
=
new
LinkedList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getEnumDefs
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getEnumDefs
()))
{
...
@@ -360,6 +377,20 @@ public class AtlasTypeUtil {
...
@@ -360,6 +377,20 @@ public class AtlasTypeUtil {
return
ret
;
return
ret
;
}
}
public
static
Collection
<
AtlasRelatedObjectId
>
toAtlasRelatedObjectIds
(
Collection
<
AtlasEntity
>
entities
)
{
List
<
AtlasRelatedObjectId
>
ret
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
entities
))
{
for
(
AtlasEntity
entity
:
entities
)
{
if
(
entity
!=
null
)
{
ret
.
add
(
toAtlasRelatedObjectId
(
entity
));
}
}
}
return
ret
;
}
public
static
Map
toStructAttributes
(
Map
map
)
{
public
static
Map
toStructAttributes
(
Map
map
)
{
if
(
map
!=
null
&&
map
.
containsKey
(
"typeName"
)
&&
map
.
containsKey
(
"attributes"
)
&&
map
.
get
(
"attributes"
)
instanceof
Map
)
{
if
(
map
!=
null
&&
map
.
containsKey
(
"typeName"
)
&&
map
.
containsKey
(
"attributes"
)
&&
map
.
get
(
"attributes"
)
instanceof
Map
)
{
return
(
Map
)
map
.
get
(
"attributes"
);
return
(
Map
)
map
.
get
(
"attributes"
);
...
@@ -378,6 +409,10 @@ public class AtlasTypeUtil {
...
@@ -378,6 +409,10 @@ public class AtlasTypeUtil {
return
ret
;
return
ret
;
}
}
public
static
AtlasRelatedObjectId
toAtlasRelatedObjectId
(
AtlasEntity
entity
)
{
return
new
AtlasRelatedObjectId
(
getAtlasObjectId
(
entity
));
}
public
static
AtlasObjectId
getAtlasObjectId
(
AtlasEntity
entity
)
{
public
static
AtlasObjectId
getAtlasObjectId
(
AtlasEntity
entity
)
{
return
new
AtlasObjectId
(
entity
.
getGuid
(),
entity
.
getTypeName
());
return
new
AtlasObjectId
(
entity
.
getGuid
(),
entity
.
getTypeName
());
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
View file @
01ea65c2
...
@@ -95,7 +95,7 @@ public class AtlasGraphUtilsV2 {
...
@@ -95,7 +95,7 @@ public class AtlasGraphUtilsV2 {
public
static
final
String
VERTEX_TYPE
=
"typeSystem"
;
public
static
final
String
VERTEX_TYPE
=
"typeSystem"
;
private
static
boolean
USE_INDEX_QUERY_TO_FIND_ENTITY_BY_UNIQUE_ATTRIBUTES
=
false
;
private
static
boolean
USE_INDEX_QUERY_TO_FIND_ENTITY_BY_UNIQUE_ATTRIBUTES
=
false
;
private
static
boolean
USE_UNIQUE_INDEX_PROPERTY_TO_FIND_ENTITY
=
fals
e
;
private
static
boolean
USE_UNIQUE_INDEX_PROPERTY_TO_FIND_ENTITY
=
tru
e
;
private
static
String
INDEX_SEARCH_PREFIX
;
private
static
String
INDEX_SEARCH_PREFIX
;
static
{
static
{
...
...
webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
View file @
01ea65c2
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
View file @
01ea65c2
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