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
7303a412
Commit
7303a412
authored
Feb 18, 2017
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1568: moved helper methods from org.apache.atlas.model package classes into an utility class
parent
8cd6a644
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
168 additions
and
162 deletions
+168
-162
CreateUpdateEntitiesResult.java
...ain/java/org/apache/atlas/CreateUpdateEntitiesResult.java
+2
-1
AtlasEntity.java
...ain/java/org/apache/atlas/model/instance/AtlasEntity.java
+0
-33
AtlasEntityHeader.java
...va/org/apache/atlas/model/instance/AtlasEntityHeader.java
+0
-7
AtlasObjectId.java
...n/java/org/apache/atlas/model/instance/AtlasObjectId.java
+3
-31
GuidMapping.java
...ain/java/org/apache/atlas/model/instance/GuidMapping.java
+19
-16
AtlasEntityType.java
.../src/main/java/org/apache/atlas/type/AtlasEntityType.java
+1
-1
AtlasTypeUtil.java
intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
+56
-1
TestUtilsV2.java
intg/src/test/java/org/apache/atlas/TestUtilsV2.java
+10
-10
release-log.txt
release-log.txt
+3
-2
AtlasEntityGraphDiscoveryV1.java
...epository/store/graph/v1/AtlasEntityGraphDiscoveryV1.java
+5
-5
AtlasEntityStoreV1.java
...e/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
+2
-1
EntityGraphMapper.java
...he/atlas/repository/store/graph/v1/EntityGraphMapper.java
+1
-1
EntityGraphRetriever.java
...atlas/repository/store/graph/v1/EntityGraphRetriever.java
+3
-3
IDBasedEntityResolver.java
...tlas/repository/store/graph/v1/IDBasedEntityResolver.java
+2
-1
GraphBackedMetadataRepositoryTest.java
...s/repository/graph/GraphBackedMetadataRepositoryTest.java
+0
-2
AtlasDeleteHandlerV1Test.java
...s/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
+15
-11
AtlasEntityStoreV1Test.java
...las/repository/store/graph/v1/AtlasEntityStoreV1Test.java
+25
-21
QuickStartV2.java
...src/main/java/org/apache/atlas/examples/QuickStartV2.java
+2
-2
EntityResource.java
...n/java/org/apache/atlas/web/resources/EntityResource.java
+2
-1
ExportService.java
...in/java/org/apache/atlas/web/resources/ExportService.java
+4
-4
TypesREST.java
...pp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
+0
-2
TestEntitiesREST.java
.../java/org/apache/atlas/web/adapters/TestEntitiesREST.java
+4
-1
TestEntityREST.java
...st/java/org/apache/atlas/web/adapters/TestEntityREST.java
+5
-2
EntityJerseyResourceIT.java
...rg/apache/atlas/web/resources/EntityJerseyResourceIT.java
+2
-1
EntityV2JerseyResourceIT.java
.../apache/atlas/web/resources/EntityV2JerseyResourceIT.java
+2
-2
No files found.
client/src/main/java/org/apache/atlas/CreateUpdateEntitiesResult.java
View file @
7303a412
...
@@ -22,6 +22,7 @@ import java.util.List;
...
@@ -22,6 +22,7 @@ import java.util.List;
import
org.apache.atlas.AtlasClient.EntityResult
;
import
org.apache.atlas.AtlasClient.EntityResult
;
import
org.apache.atlas.model.instance.GuidMapping
;
import
org.apache.atlas.model.instance.GuidMapping
;
import
org.apache.atlas.type.AtlasType
;
/**
/**
* Result from creating or updating entities.
* Result from creating or updating entities.
...
@@ -77,7 +78,7 @@ public class CreateUpdateEntitiesResult {
...
@@ -77,7 +78,7 @@ public class CreateUpdateEntitiesResult {
*/
*/
public
static
CreateUpdateEntitiesResult
fromJson
(
String
json
)
throws
AtlasServiceException
{
public
static
CreateUpdateEntitiesResult
fromJson
(
String
json
)
throws
AtlasServiceException
{
GuidMapping
guidMapping
=
GuidMapping
.
fromString
(
json
);
GuidMapping
guidMapping
=
AtlasType
.
fromJson
(
json
,
GuidMapping
.
class
);
EntityResult
entityResult
=
EntityResult
.
fromString
(
json
);
EntityResult
entityResult
=
EntityResult
.
fromString
(
json
);
CreateUpdateEntitiesResult
result
=
new
CreateUpdateEntitiesResult
();
CreateUpdateEntitiesResult
result
=
new
CreateUpdateEntitiesResult
();
result
.
setEntityResult
(
entityResult
);
result
.
setEntityResult
(
entityResult
);
...
...
intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java
View file @
7303a412
...
@@ -40,7 +40,6 @@ import java.util.HashMap;
...
@@ -40,7 +40,6 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.UUID
;
import
java.util.concurrent.atomic.AtomicLong
;
import
java.util.concurrent.atomic.AtomicLong
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
NONE
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
NONE
;
...
@@ -175,33 +174,6 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -175,33 +174,6 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
public
void
setClassifications
(
List
<
AtlasClassification
>
classifications
)
{
this
.
classifications
=
classifications
;
}
public
void
setClassifications
(
List
<
AtlasClassification
>
classifications
)
{
this
.
classifications
=
classifications
;
}
@JsonIgnore
public
boolean
isUnassigned
()
{
return
isUnAssigned
(
guid
);
}
@JsonIgnore
public
boolean
isAssigned
()
{
return
isAssigned
(
guid
);
}
@JsonIgnore
public
static
boolean
isAssigned
(
String
guid
)
{
if
(
guid
!=
null
)
{
try
{
UUID
.
fromString
(
guid
);
return
true
;
}
catch
(
IllegalArgumentException
e
)
{
// ignore
}
}
return
false
;
}
@JsonIgnore
public
static
boolean
isUnAssigned
(
String
guid
)
{
return
guid
!=
null
&&
guid
.
length
()
>
0
&&
guid
.
charAt
(
0
)
==
'-'
;
}
private
void
init
()
{
private
void
init
()
{
setGuid
(
nextInternalId
());
setGuid
(
nextInternalId
());
...
@@ -217,11 +189,6 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -217,11 +189,6 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
return
"-"
+
Long
.
toString
(
s_nextId
.
getAndIncrement
());
return
"-"
+
Long
.
toString
(
s_nextId
.
getAndIncrement
());
}
}
@JsonIgnore
public
AtlasObjectId
getAtlasObjectId
()
{
return
new
AtlasObjectId
(
getGuid
(),
getTypeName
());
}
@Override
@Override
public
StringBuilder
toString
(
StringBuilder
sb
)
{
public
StringBuilder
toString
(
StringBuilder
sb
)
{
if
(
sb
==
null
)
{
if
(
sb
==
null
)
{
...
...
intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityHeader.java
View file @
7303a412
...
@@ -34,7 +34,6 @@ import org.codehaus.jackson.annotate.JsonAutoDetect;
...
@@ -34,7 +34,6 @@ import org.codehaus.jackson.annotate.JsonAutoDetect;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
PUBLIC_ONLY
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
PUBLIC_ONLY
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
NONE
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
NONE
;
import
org.codehaus.jackson.annotate.JsonIgnore
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
...
@@ -191,10 +190,4 @@ public class AtlasEntityHeader extends AtlasStruct implements Serializable {
...
@@ -191,10 +190,4 @@ public class AtlasEntityHeader extends AtlasStruct implements Serializable {
super
(
list
,
startIndex
,
pageSize
,
totalCount
,
sortType
,
sortBy
);
super
(
list
,
startIndex
,
pageSize
,
totalCount
,
sortType
,
sortBy
);
}
}
}
}
@JsonIgnore
public
AtlasObjectId
getAtlasObjectId
()
{
return
new
AtlasObjectId
(
getGuid
(),
getTypeName
());
}
}
}
intg/src/main/java/org/apache/atlas/model/instance/AtlasObjectId.java
View file @
7303a412
...
@@ -31,13 +31,10 @@ import javax.xml.bind.annotation.XmlSeeAlso;
...
@@ -31,13 +31,10 @@ import javax.xml.bind.annotation.XmlSeeAlso;
import
org.apache.atlas.model.PList
;
import
org.apache.atlas.model.PList
;
import
org.apache.atlas.model.SearchFilter.SortType
;
import
org.apache.atlas.model.SearchFilter.SortType
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.codehaus.jackson.annotate.JsonAutoDetect
;
import
org.codehaus.jackson.annotate.JsonAutoDetect
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
PUBLIC_ONLY
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
PUBLIC_ONLY
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
NONE
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
NONE
;
import
org.codehaus.jackson.annotate.JsonIgnore
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
...
@@ -139,32 +136,6 @@ public class AtlasObjectId implements Serializable {
...
@@ -139,32 +136,6 @@ public class AtlasObjectId implements Serializable {
this
.
uniqueAttributes
=
uniqueAttributes
;
this
.
uniqueAttributes
=
uniqueAttributes
;
}
}
@JsonIgnore
public
boolean
isValidGuid
()
{
return
isAssignedGuid
()
||
isUnAssignedGuid
();
}
@JsonIgnore
public
boolean
isAssignedGuid
()
{
return
AtlasEntity
.
isAssigned
(
guid
);
}
@JsonIgnore
public
boolean
isUnAssignedGuid
()
{
return
AtlasEntity
.
isUnAssigned
(
guid
);
}
@JsonIgnore
public
boolean
isValid
()
{
if
(
isAssignedGuid
()
||
isUnAssignedGuid
())
{
return
true
;
}
else
if
(
StringUtils
.
isNotEmpty
(
typeName
)
&&
MapUtils
.
isNotEmpty
(
uniqueAttributes
))
{
return
true
;
}
return
false
;
}
public
StringBuilder
toString
(
StringBuilder
sb
)
{
public
StringBuilder
toString
(
StringBuilder
sb
)
{
if
(
sb
==
null
)
{
if
(
sb
==
null
)
{
sb
=
new
StringBuilder
();
sb
=
new
StringBuilder
();
...
@@ -193,7 +164,8 @@ public class AtlasObjectId implements Serializable {
...
@@ -193,7 +164,8 @@ public class AtlasObjectId implements Serializable {
AtlasObjectId
that
=
(
AtlasObjectId
)
o
;
AtlasObjectId
that
=
(
AtlasObjectId
)
o
;
if
(
isValidGuid
()
&&
Objects
.
equals
(
guid
,
that
.
guid
))
{
// if guid is null, equality should be based on typeName/uniqueAttributes
if
(
guid
!=
null
&&
Objects
.
equals
(
guid
,
that
.
guid
))
{
return
true
;
return
true
;
}
}
...
@@ -203,7 +175,7 @@ public class AtlasObjectId implements Serializable {
...
@@ -203,7 +175,7 @@ public class AtlasObjectId implements Serializable {
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
isValidGuid
()
?
Objects
.
hash
(
guid
)
:
Objects
.
hash
(
typeName
,
uniqueAttributes
);
return
guid
!=
null
?
Objects
.
hash
(
guid
)
:
Objects
.
hash
(
typeName
,
uniqueAttributes
);
}
}
@Override
@Override
...
...
intg/src/main/java/org/apache/atlas/model/instance/GuidMapping.java
View file @
7303a412
...
@@ -26,13 +26,11 @@ import javax.xml.bind.annotation.XmlAccessType;
...
@@ -26,13 +26,11 @@ import javax.xml.bind.annotation.XmlAccessType;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.codehaus.jackson.annotate.JsonAutoDetect
;
import
org.codehaus.jackson.annotate.JsonAutoDetect
;
import
org.codehaus.jackson.annotate.JsonIgnore
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
/**
/**
* This stores a mapping of guid assignments that were made during the processing
* This stores a mapping of guid assignments that were made during the processing
...
@@ -45,15 +43,13 @@ import com.google.gson.GsonBuilder;
...
@@ -45,15 +43,13 @@ import com.google.gson.GsonBuilder;
@XmlRootElement
@XmlRootElement
@XmlAccessorType
(
XmlAccessType
.
PROPERTY
)
@XmlAccessorType
(
XmlAccessType
.
PROPERTY
)
public
class
GuidMapping
{
public
class
GuidMapping
{
private
static
final
long
serialVersionUID
=
1L
;
@JsonIgnore
private
static
final
Gson
gson
=
new
GsonBuilder
().
setPrettyPrinting
().
create
();
private
Map
<
String
,
String
>
guidAssignments
;
private
Map
<
String
,
String
>
guidAssignments
;
public
GuidMapping
()
{
public
GuidMapping
()
{
}
}
public
GuidMapping
(
Map
<
String
,
String
>
guidAssignments
)
{
public
GuidMapping
(
Map
<
String
,
String
>
guidAssignments
)
{
...
@@ -68,17 +64,23 @@ public class GuidMapping {
...
@@ -68,17 +64,23 @@ public class GuidMapping {
public
void
setGuidAssignments
(
Map
<
String
,
String
>
guidAssignments
)
{
public
void
setGuidAssignments
(
Map
<
String
,
String
>
guidAssignments
)
{
this
.
guidAssignments
=
guidAssignments
;
this
.
guidAssignments
=
guidAssignments
;
}
}
/**
* Converts the GuidMapping to json
*/
@Override
public
String
toString
()
{
return
gson
.
toJson
(
this
);
}
@JsonIgnore
public
StringBuilder
toString
(
StringBuilder
sb
)
{
public
static
GuidMapping
fromString
(
String
json
)
{
if
(
sb
==
null
)
{
return
gson
.
fromJson
(
json
,
GuidMapping
.
class
);
sb
=
new
StringBuilder
();
}
sb
.
append
(
"GuidMapping{"
);
sb
.
append
(
"guidAssignments={"
);
AtlasBaseTypeDef
.
dumpObjects
(
guidAssignments
,
sb
);
sb
.
append
(
'}'
);
sb
.
append
(
'}'
);
return
sb
;
}
}
@Override
public
String
toString
()
{
return
toString
(
new
StringBuilder
()).
toString
();
}
}
}
\ No newline at end of file
intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
View file @
7303a412
...
@@ -362,7 +362,7 @@ public class AtlasEntityType extends AtlasStructType {
...
@@ -362,7 +362,7 @@ public class AtlasEntityType extends AtlasStructType {
}
}
boolean
isAssignableFrom
(
AtlasObjectId
objId
)
{
boolean
isAssignableFrom
(
AtlasObjectId
objId
)
{
boolean
ret
=
objId
.
isValid
(
)
&&
(
StringUtils
.
equals
(
objId
.
getTypeName
(),
getTypeName
())
||
isSuperTypeOf
(
objId
.
getTypeName
()));
boolean
ret
=
AtlasTypeUtil
.
isValid
(
objId
)
&&
(
StringUtils
.
equals
(
objId
.
getTypeName
(),
getTypeName
())
||
isSuperTypeOf
(
objId
.
getTypeName
()));
return
ret
;
return
ret
;
}
}
...
...
intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
View file @
7303a412
...
@@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableSet;
...
@@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableSet;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
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.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
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
;
...
@@ -35,8 +36,10 @@ import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;
...
@@ -35,8 +36,10 @@ import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;
import
org.apache.atlas.model.typedef.AtlasTypeDefHeader
;
import
org.apache.atlas.model.typedef.AtlasTypeDefHeader
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collection
;
...
@@ -46,6 +49,7 @@ import java.util.LinkedList;
...
@@ -46,6 +49,7 @@ import java.util.LinkedList;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -309,7 +313,7 @@ public class AtlasTypeUtil {
...
@@ -309,7 +313,7 @@ public class AtlasTypeUtil {
if
(
CollectionUtils
.
isNotEmpty
(
entities
))
{
if
(
CollectionUtils
.
isNotEmpty
(
entities
))
{
for
(
AtlasEntity
entity
:
entities
)
{
for
(
AtlasEntity
entity
:
entities
)
{
if
(
entity
!=
null
)
{
if
(
entity
!=
null
)
{
ret
.
add
(
entity
.
getAtlasObjectId
(
));
ret
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
entity
));
}
}
}
}
}
}
...
@@ -324,4 +328,54 @@ public class AtlasTypeUtil {
...
@@ -324,4 +328,54 @@ public class AtlasTypeUtil {
return
map
;
return
map
;
}
}
public
static
AtlasObjectId
getAtlasObjectId
(
AtlasEntity
entity
)
{
return
new
AtlasObjectId
(
entity
.
getGuid
(),
entity
.
getTypeName
());
}
public
static
AtlasObjectId
getAtlasObjectId
(
AtlasEntityHeader
header
)
{
return
new
AtlasObjectId
(
header
.
getGuid
(),
header
.
getTypeName
());
}
public
static
boolean
isValidGuid
(
AtlasObjectId
objId
)
{
return
isValidGuid
(
objId
.
getGuid
());
}
public
static
boolean
isAssignedGuid
(
AtlasObjectId
objId
)
{
return
isAssignedGuid
(
objId
.
getGuid
());
}
public
static
boolean
isUnAssignedGuid
(
AtlasObjectId
objId
)
{
return
isUnAssignedGuid
(
objId
.
getGuid
());
}
public
static
boolean
isValidGuid
(
String
guid
)
{
return
isAssignedGuid
(
guid
)
||
isUnAssignedGuid
(
guid
);
}
public
static
boolean
isAssignedGuid
(
String
guid
)
{
if
(
guid
!=
null
)
{
try
{
UUID
.
fromString
(
guid
);
return
true
;
}
catch
(
IllegalArgumentException
e
)
{
// ignore
}
}
return
false
;
}
public
static
boolean
isUnAssignedGuid
(
String
guid
)
{
return
guid
!=
null
&&
guid
.
length
()
>
0
&&
guid
.
charAt
(
0
)
==
'-'
;
}
public
static
boolean
isValid
(
AtlasObjectId
objId
)
{
if
(
isAssignedGuid
(
objId
)
||
isUnAssignedGuid
(
objId
))
{
return
true
;
}
else
if
(
StringUtils
.
isNotEmpty
(
objId
.
getTypeName
())
&&
MapUtils
.
isNotEmpty
(
objId
.
getUniqueAttributes
()))
{
return
true
;
}
return
false
;
}
}
}
\ No newline at end of file
intg/src/test/java/org/apache/atlas/TestUtilsV2.java
View file @
7303a412
...
@@ -311,7 +311,7 @@ public final class TestUtilsV2 {
...
@@ -311,7 +311,7 @@ public final class TestUtilsV2 {
/******* Department - HR *******/
/******* Department - HR *******/
AtlasEntity
hrDept
=
new
AtlasEntity
(
DEPARTMENT_TYPE
,
"name"
,
"hr"
);
AtlasEntity
hrDept
=
new
AtlasEntity
(
DEPARTMENT_TYPE
,
"name"
,
"hr"
);
AtlasObjectId
hrDeptId
=
hrDept
.
getAtlasObjectId
(
);
AtlasObjectId
hrDeptId
=
AtlasTypeUtil
.
getAtlasObjectId
(
hrDept
);
/******* Address Entities *******/
/******* Address Entities *******/
AtlasStruct
janeAddr
=
new
AtlasStruct
(
ADDRESS_TYPE
);
AtlasStruct
janeAddr
=
new
AtlasStruct
(
ADDRESS_TYPE
);
...
@@ -332,14 +332,14 @@ public final class TestUtilsV2 {
...
@@ -332,14 +332,14 @@ public final class TestUtilsV2 {
/******* Manager - Jane (John and Max subordinates) *******/
/******* Manager - Jane (John and Max subordinates) *******/
AtlasEntity
jane
=
new
AtlasEntity
(
MANAGER_TYPE
);
AtlasEntity
jane
=
new
AtlasEntity
(
MANAGER_TYPE
);
AtlasObjectId
janeId
=
jane
.
getAtlasObjectId
(
);
AtlasObjectId
janeId
=
AtlasTypeUtil
.
getAtlasObjectId
(
jane
);
jane
.
setAttribute
(
"name"
,
"Jane"
);
jane
.
setAttribute
(
"name"
,
"Jane"
);
jane
.
setAttribute
(
"department"
,
hrDeptId
);
jane
.
setAttribute
(
"department"
,
hrDeptId
);
jane
.
setAttribute
(
"address"
,
janeAddr
);
jane
.
setAttribute
(
"address"
,
janeAddr
);
/******* Manager - Julius (no subordinates) *******/
/******* Manager - Julius (no subordinates) *******/
AtlasEntity
julius
=
new
AtlasEntity
(
MANAGER_TYPE
);
AtlasEntity
julius
=
new
AtlasEntity
(
MANAGER_TYPE
);
AtlasObjectId
juliusId
=
julius
.
getAtlasObjectId
(
);
AtlasObjectId
juliusId
=
AtlasTypeUtil
.
getAtlasObjectId
(
julius
);
julius
.
setAttribute
(
"name"
,
"Julius"
);
julius
.
setAttribute
(
"name"
,
"Julius"
);
julius
.
setAttribute
(
"department"
,
hrDeptId
);
julius
.
setAttribute
(
"department"
,
hrDeptId
);
julius
.
setAttribute
(
"address"
,
juliusAddr
);
julius
.
setAttribute
(
"address"
,
juliusAddr
);
...
@@ -347,7 +347,7 @@ public final class TestUtilsV2 {
...
@@ -347,7 +347,7 @@ public final class TestUtilsV2 {
/******* Employee - Max (Manager: Jane, Mentor: Julius) *******/
/******* Employee - Max (Manager: Jane, Mentor: Julius) *******/
AtlasEntity
max
=
new
AtlasEntity
(
EMPLOYEE_TYPE
);
AtlasEntity
max
=
new
AtlasEntity
(
EMPLOYEE_TYPE
);
AtlasObjectId
maxId
=
max
.
getAtlasObjectId
(
);
AtlasObjectId
maxId
=
AtlasTypeUtil
.
getAtlasObjectId
(
max
);
max
.
setAttribute
(
"name"
,
"Max"
);
max
.
setAttribute
(
"name"
,
"Max"
);
max
.
setAttribute
(
"department"
,
hrDeptId
);
max
.
setAttribute
(
"department"
,
hrDeptId
);
max
.
setAttribute
(
"address"
,
maxAddr
);
max
.
setAttribute
(
"address"
,
maxAddr
);
...
@@ -366,7 +366,7 @@ public final class TestUtilsV2 {
...
@@ -366,7 +366,7 @@ public final class TestUtilsV2 {
/******* Employee - John (Manager: Jane, Mentor: Max) *******/
/******* Employee - John (Manager: Jane, Mentor: Max) *******/
AtlasEntity
john
=
new
AtlasEntity
(
EMPLOYEE_TYPE
);
AtlasEntity
john
=
new
AtlasEntity
(
EMPLOYEE_TYPE
);
AtlasObjectId
johnId
=
john
.
getAtlasObjectId
(
);
AtlasObjectId
johnId
=
AtlasTypeUtil
.
getAtlasObjectId
(
john
);
john
.
setAttribute
(
"name"
,
"John"
);
john
.
setAttribute
(
"name"
,
"John"
);
john
.
setAttribute
(
"department"
,
hrDeptId
);
john
.
setAttribute
(
"department"
,
hrDeptId
);
john
.
setAttribute
(
"address"
,
johnAddr
);
john
.
setAttribute
(
"address"
,
johnAddr
);
...
@@ -442,8 +442,8 @@ public final class TestUtilsV2 {
...
@@ -442,8 +442,8 @@ public final class TestUtilsV2 {
julius
.
setAttribute
(
"address"
,
juliusAddr
);
julius
.
setAttribute
(
"address"
,
juliusAddr
);
julius
.
setAttribute
(
"subordinates"
,
ImmutableList
.
of
());
julius
.
setAttribute
(
"subordinates"
,
ImmutableList
.
of
());
AtlasObjectId
janeId
=
jane
.
getAtlasObjectId
(
);
AtlasObjectId
janeId
=
AtlasTypeUtil
.
getAtlasObjectId
(
jane
);
AtlasObjectId
johnId
=
john
.
getAtlasObjectId
(
);
AtlasObjectId
johnId
=
AtlasTypeUtil
.
getAtlasObjectId
(
john
);
//TODO - Change to MANAGER_TYPE for JULIUS
//TODO - Change to MANAGER_TYPE for JULIUS
AtlasObjectId
maxId
=
new
AtlasObjectId
(
max
.
getGuid
(),
EMPLOYEE_TYPE
);
AtlasObjectId
maxId
=
new
AtlasObjectId
(
max
.
getGuid
(),
EMPLOYEE_TYPE
);
...
@@ -797,7 +797,7 @@ public final class TestUtilsV2 {
...
@@ -797,7 +797,7 @@ public final class TestUtilsV2 {
entity
.
setAttribute
(
"description"
,
"random table"
);
entity
.
setAttribute
(
"description"
,
"random table"
);
entity
.
setAttribute
(
"type"
,
"type"
);
entity
.
setAttribute
(
"type"
,
"type"
);
entity
.
setAttribute
(
"tableType"
,
"MANAGED"
);
entity
.
setAttribute
(
"tableType"
,
"MANAGED"
);
entity
.
setAttribute
(
"database"
,
dbEntity
.
getAtlasObjectId
(
));
entity
.
setAttribute
(
"database"
,
AtlasTypeUtil
.
getAtlasObjectId
(
dbEntity
));
entity
.
setAttribute
(
"created"
,
new
Date
());
entity
.
setAttribute
(
"created"
,
new
Date
());
Map
<
String
,
Object
>
partAttributes
=
new
HashMap
<
String
,
Object
>()
{{
Map
<
String
,
Object
>
partAttributes
=
new
HashMap
<
String
,
Object
>()
{{
...
@@ -820,7 +820,7 @@ public final class TestUtilsV2 {
...
@@ -820,7 +820,7 @@ public final class TestUtilsV2 {
tblEntity
.
setAttribute
(
"description"
,
"random table"
);
tblEntity
.
setAttribute
(
"description"
,
"random table"
);
tblEntity
.
setAttribute
(
"type"
,
"type"
);
tblEntity
.
setAttribute
(
"type"
,
"type"
);
tblEntity
.
setAttribute
(
"tableType"
,
"MANAGED"
);
tblEntity
.
setAttribute
(
"tableType"
,
"MANAGED"
);
tblEntity
.
setAttribute
(
"database"
,
dbEntity
.
getAtlasObjectId
(
));
tblEntity
.
setAttribute
(
"database"
,
AtlasTypeUtil
.
getAtlasObjectId
(
dbEntity
));
tblEntity
.
setAttribute
(
"created"
,
new
Date
());
tblEntity
.
setAttribute
(
"created"
,
new
Date
());
final
AtlasStruct
partitionStruct
=
new
AtlasStruct
(
"partition_struct_type"
,
"name"
,
"part0"
);
final
AtlasStruct
partitionStruct
=
new
AtlasStruct
(
"partition_struct_type"
,
"name"
,
"part0"
);
...
@@ -845,7 +845,7 @@ public final class TestUtilsV2 {
...
@@ -845,7 +845,7 @@ public final class TestUtilsV2 {
AtlasEntity
entity
=
new
AtlasEntity
(
COLUMN_TYPE
);
AtlasEntity
entity
=
new
AtlasEntity
(
COLUMN_TYPE
);
entity
.
setAttribute
(
NAME
,
colName
);
entity
.
setAttribute
(
NAME
,
colName
);
entity
.
setAttribute
(
"type"
,
"VARCHAR(32)"
);
entity
.
setAttribute
(
"type"
,
"VARCHAR(32)"
);
entity
.
setAttribute
(
"table"
,
tableEntity
.
getAtlasObjectId
(
));
entity
.
setAttribute
(
"table"
,
AtlasTypeUtil
.
getAtlasObjectId
(
tableEntity
));
return
entity
;
return
entity
;
}
}
...
...
release-log.txt
View file @
7303a412
...
@@ -9,14 +9,15 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
...
@@ -9,14 +9,15 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ALL CHANGES:
ATLAS-1568 moved helper methods from org.apache.atlas.model package classes into an utility class (mneethiraj)
ATLAS-1566 replace GSON ser-de with ObjectMapper ser-de (svimal2016 via mneethiraj)
ATLAS-1566 replace GSON ser-de with ObjectMapper ser-de (svimal2016 via mneethiraj)
ATLAS-1551 auto update of reverse references in V1 API (dkantor)
ATLAS-1551 auto update of reverse references in V1 API (dkantor)
ATLAS-1565 Create EntityREST endpoints for delete operations (sarathkumarsubramanian via svimal2106)
ATLAS-1565 Create EntityREST endpoints for delete operations (sarathkumarsubramanian via svimal2106)
ATLAS-1547 Added tests for hard delete (
mneethiraj
)
ATLAS-1547 Added tests for hard delete (
sumasai
)
ATLAS-1546 (ATLAS-1546.3.patch)Hive hook should choose appropriate JAAS config if host uses kerberos ticket-cache (nixonrodrigues via kevalbhat)
ATLAS-1546 (ATLAS-1546.3.patch)Hive hook should choose appropriate JAAS config if host uses kerberos ticket-cache (nixonrodrigues via kevalbhat)
ATLAS-1503 Export/import support to copy data between Atlas instances (ashutoshm via mneethiraj)
ATLAS-1503 Export/import support to copy data between Atlas instances (ashutoshm via mneethiraj)
ATLAS-1554 v2 EntityREST implementation for entity partial update (sarathkumarsubramanian via mneethiraj)
ATLAS-1554 v2 EntityREST implementation for entity partial update (sarathkumarsubramanian via mneethiraj)
ATLAS-1547 Fix DeleteHandlerV1 for new model changes and add tests (
mneethiraj
)
ATLAS-1547 Fix DeleteHandlerV1 for new model changes and add tests (
sumasai
)
ATLAS-1556 Edit entity button not working from search table of tag detail page. (kevalbhatt)
ATLAS-1556 Edit entity button not working from search table of tag detail page. (kevalbhatt)
ATLAS-1559 Regression - If a new tag is created then the earlier tags doesn't render properly (kevalbhatt)
ATLAS-1559 Regression - If a new tag is created then the earlier tags doesn't render properly (kevalbhatt)
ATLAS-1508 Make AtlasADAuthenticationProvider like Ranger ADLdap Methods (gss2002 via mneethiraj)
ATLAS-1508 Make AtlasADAuthenticationProvider like Ranger ADLdap Methods (gss2002 via mneethiraj)
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityGraphDiscoveryV1.java
View file @
7303a412
...
@@ -72,7 +72,7 @@ public class AtlasEntityGraphDiscoveryV1 implements EntityGraphDiscovery {
...
@@ -72,7 +72,7 @@ public class AtlasEntityGraphDiscoveryV1 implements EntityGraphDiscovery {
public
void
validateAndNormalize
(
AtlasEntity
entity
)
throws
AtlasBaseException
{
public
void
validateAndNormalize
(
AtlasEntity
entity
)
throws
AtlasBaseException
{
List
<
String
>
messages
=
new
ArrayList
<>();
List
<
String
>
messages
=
new
ArrayList
<>();
if
(!
AtlasEntity
.
isAssigned
(
entity
.
getGuid
())
&&
!
AtlasEntity
.
isUnAssigne
d
(
entity
.
getGuid
()))
{
if
(!
AtlasTypeUtil
.
isValidGui
d
(
entity
.
getGuid
()))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
"invalid guid "
+
entity
.
getGuid
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
"invalid guid "
+
entity
.
getGuid
());
}
}
...
@@ -95,7 +95,7 @@ public class AtlasEntityGraphDiscoveryV1 implements EntityGraphDiscovery {
...
@@ -95,7 +95,7 @@ public class AtlasEntityGraphDiscoveryV1 implements EntityGraphDiscovery {
public
void
validateAndNormalizeForUpdate
(
AtlasEntity
entity
)
throws
AtlasBaseException
{
public
void
validateAndNormalizeForUpdate
(
AtlasEntity
entity
)
throws
AtlasBaseException
{
List
<
String
>
messages
=
new
ArrayList
<>();
List
<
String
>
messages
=
new
ArrayList
<>();
if
(!
AtlasEntity
.
isAssigned
(
entity
.
getGuid
())
&&
!
AtlasEntity
.
isUnAssigne
d
(
entity
.
getGuid
()))
{
if
(!
AtlasTypeUtil
.
isValidGui
d
(
entity
.
getGuid
()))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
"invalid guid "
+
entity
.
getGuid
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
"invalid guid "
+
entity
.
getGuid
());
}
}
...
@@ -176,7 +176,7 @@ public class AtlasEntityGraphDiscoveryV1 implements EntityGraphDiscovery {
...
@@ -176,7 +176,7 @@ public class AtlasEntityGraphDiscoveryV1 implements EntityGraphDiscovery {
if
(
val
instanceof
AtlasObjectId
)
{
if
(
val
instanceof
AtlasObjectId
)
{
AtlasObjectId
objId
=
(
AtlasObjectId
)
val
;
AtlasObjectId
objId
=
(
AtlasObjectId
)
val
;
if
(!
objId
.
isValid
(
))
{
if
(!
AtlasTypeUtil
.
isValid
(
objId
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
objId
.
toString
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
objId
.
toString
());
}
}
...
@@ -184,7 +184,7 @@ public class AtlasEntityGraphDiscoveryV1 implements EntityGraphDiscovery {
...
@@ -184,7 +184,7 @@ public class AtlasEntityGraphDiscoveryV1 implements EntityGraphDiscovery {
}
else
if
(
val
instanceof
Map
)
{
}
else
if
(
val
instanceof
Map
)
{
AtlasObjectId
objId
=
new
AtlasObjectId
((
Map
)
val
);
AtlasObjectId
objId
=
new
AtlasObjectId
((
Map
)
val
);
if
(!
objId
.
isValid
(
))
{
if
(!
AtlasTypeUtil
.
isValid
(
objId
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
objId
.
toString
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
objId
.
toString
());
}
}
...
@@ -323,7 +323,7 @@ public class AtlasEntityGraphDiscoveryV1 implements EntityGraphDiscovery {
...
@@ -323,7 +323,7 @@ public class AtlasEntityGraphDiscoveryV1 implements EntityGraphDiscovery {
}
}
private
void
recordObjectReference
(
AtlasObjectId
objId
)
{
private
void
recordObjectReference
(
AtlasObjectId
objId
)
{
if
(
objId
.
isValidGuid
(
))
{
if
(
AtlasTypeUtil
.
isValidGuid
(
objId
))
{
discoveryContext
.
addReferencedGuid
(
objId
.
getGuid
());
discoveryContext
.
addReferencedGuid
(
objId
.
getGuid
());
}
else
{
}
else
{
discoveryContext
.
addReferencedByUniqAttribs
(
objId
);
discoveryContext
.
addReferencedByUniqAttribs
(
objId
);
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
View file @
7303a412
...
@@ -38,6 +38,7 @@ import org.apache.atlas.repository.store.graph.EntityGraphDiscovery;
...
@@ -38,6 +38,7 @@ import org.apache.atlas.repository.store.graph.EntityGraphDiscovery;
import
org.apache.atlas.repository.store.graph.EntityGraphDiscoveryContext
;
import
org.apache.atlas.repository.store.graph.EntityGraphDiscoveryContext
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -378,7 +379,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
...
@@ -378,7 +379,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
entity
.
getTypeName
());
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
entity
.
getTypeName
());
//Create vertices which do not exist in the repository
//Create vertices which do not exist in the repository
if
((
entityStream
instanceof
EntityImportStream
)
&&
Atlas
Entity
.
isAssigne
d
(
entity
.
getGuid
()))
{
if
((
entityStream
instanceof
EntityImportStream
)
&&
Atlas
TypeUtil
.
isAssignedGui
d
(
entity
.
getGuid
()))
{
vertex
=
entityGraphMapper
.
createVertexWithGuid
(
entity
,
entity
.
getGuid
());
vertex
=
entityGraphMapper
.
createVertexWithGuid
(
entity
,
entity
.
getGuid
());
}
else
{
}
else
{
vertex
=
entityGraphMapper
.
createVertex
(
entity
);
vertex
=
entityGraphMapper
.
createVertex
(
entity
);
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
View file @
7303a412
...
@@ -538,7 +538,7 @@ public class EntityGraphMapper {
...
@@ -538,7 +538,7 @@ public class EntityGraphMapper {
}
else
if
(
val
instanceof
Map
)
{
}
else
if
(
val
instanceof
Map
)
{
AtlasObjectId
ret
=
new
AtlasObjectId
((
Map
)
val
);
AtlasObjectId
ret
=
new
AtlasObjectId
((
Map
)
val
);
if
(
ret
.
isValid
(
))
{
if
(
AtlasTypeUtil
.
isValid
(
ret
))
{
return
ret
;
return
ret
;
}
}
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java
View file @
7303a412
...
@@ -127,10 +127,10 @@ public final class EntityGraphRetriever {
...
@@ -127,10 +127,10 @@ public final class EntityGraphRetriever {
private
AtlasVertex
getEntityVertex
(
AtlasObjectId
objId
)
throws
AtlasBaseException
{
private
AtlasVertex
getEntityVertex
(
AtlasObjectId
objId
)
throws
AtlasBaseException
{
try
{
try
{
if
(!
objId
.
isValid
(
))
{
if
(!
AtlasTypeUtil
.
isValid
(
objId
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
objId
.
toString
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
objId
.
toString
());
}
}
if
(
objId
.
isAssignedGuid
(
))
{
if
(
AtlasTypeUtil
.
isAssignedGuid
(
objId
))
{
return
graphHelper
.
getVertexForGUID
(
objId
.
getGuid
());
return
graphHelper
.
getVertexForGUID
(
objId
.
getGuid
());
}
else
{
}
else
{
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
objId
.
getTypeName
());
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
objId
.
getTypeName
());
...
@@ -419,7 +419,7 @@ public final class EntityGraphRetriever {
...
@@ -419,7 +419,7 @@ public final class EntityGraphRetriever {
AtlasEntity
entity
=
mapVertexToAtlasEntity
(
referenceVertex
,
entityExtInfo
);
AtlasEntity
entity
=
mapVertexToAtlasEntity
(
referenceVertex
,
entityExtInfo
);
if
(
entity
!=
null
)
{
if
(
entity
!=
null
)
{
ret
=
entity
.
getAtlasObjectId
(
);
ret
=
AtlasTypeUtil
.
getAtlasObjectId
(
entity
);
}
}
}
else
{
}
else
{
ret
=
new
AtlasObjectId
(
GraphHelper
.
getGuid
(
referenceVertex
),
GraphHelper
.
getTypeName
(
referenceVertex
));
ret
=
new
AtlasObjectId
(
GraphHelper
.
getGuid
(
referenceVertex
),
GraphHelper
.
getTypeName
(
referenceVertex
));
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/IDBasedEntityResolver.java
View file @
7303a412
...
@@ -26,6 +26,7 @@ import org.apache.atlas.repository.store.graph.EntityGraphDiscoveryContext;
...
@@ -26,6 +26,7 @@ import org.apache.atlas.repository.store.graph.EntityGraphDiscoveryContext;
import
org.apache.atlas.repository.store.graph.EntityResolver
;
import
org.apache.atlas.repository.store.graph.EntityResolver
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -47,7 +48,7 @@ public class IDBasedEntityResolver implements EntityResolver {
...
@@ -47,7 +48,7 @@ public class IDBasedEntityResolver implements EntityResolver {
EntityStream
entityStream
=
context
.
getEntityStream
();
EntityStream
entityStream
=
context
.
getEntityStream
();
for
(
String
guid
:
context
.
getReferencedGuids
())
{
for
(
String
guid
:
context
.
getReferencedGuids
())
{
boolean
isAssignedGuid
=
Atlas
Entity
.
isAssigne
d
(
guid
);
boolean
isAssignedGuid
=
Atlas
TypeUtil
.
isAssignedGui
d
(
guid
);
AtlasVertex
vertex
=
isAssignedGuid
?
AtlasGraphUtilsV1
.
findByGuid
(
guid
)
:
null
;
AtlasVertex
vertex
=
isAssignedGuid
?
AtlasGraphUtilsV1
.
findByGuid
(
guid
)
:
null
;
if
(
vertex
==
null
)
{
// if not found in the store, look if the entity is present in the stream
if
(
vertex
==
null
)
{
// if not found in the store, look if the entity is present in the stream
...
...
repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryTest.java
View file @
7303a412
...
@@ -240,7 +240,6 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -240,7 +240,6 @@ public class GraphBackedMetadataRepositoryTest {
CreateUpdateEntitiesResult
result
=
repositoryService
.
createEntities
(
deptInstance
);
CreateUpdateEntitiesResult
result
=
repositoryService
.
createEntities
(
deptInstance
);
System
.
out
.
println
(
result
.
getGuidMapping
().
toString
());
validateGuidMapping
(
toValidate
,
result
);
validateGuidMapping
(
toValidate
,
result
);
}
}
...
@@ -362,7 +361,6 @@ public class GraphBackedMetadataRepositoryTest {
...
@@ -362,7 +361,6 @@ public class GraphBackedMetadataRepositoryTest {
CreateUpdateEntitiesResult
result
=
repositoryService
.
createEntities
(
deptInstance
);
CreateUpdateEntitiesResult
result
=
repositoryService
.
createEntities
(
deptInstance
);
System
.
out
.
println
(
result
.
getGuidMapping
().
toString
());
assertEquals
(
result
.
getCreatedEntities
().
size
(),
toVerify
.
size
());
assertEquals
(
result
.
getCreatedEntities
().
size
(),
toVerify
.
size
());
validateGuidMapping
(
toVerify
,
result
);
validateGuidMapping
(
toVerify
,
result
);
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasDeleteHandlerV1Test.java
View file @
7303a412
...
@@ -198,7 +198,7 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -198,7 +198,7 @@ public abstract class AtlasDeleteHandlerV1Test {
final
AtlasEntity
tableEntity
=
TestUtilsV2
.
createTableEntity
(
dbEntity
);
final
AtlasEntity
tableEntity
=
TestUtilsV2
.
createTableEntity
(
dbEntity
);
final
AtlasEntity
columnEntity
=
TestUtilsV2
.
createColumnEntity
(
tableEntity
);
final
AtlasEntity
columnEntity
=
TestUtilsV2
.
createColumnEntity
(
tableEntity
);
tableEntity
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
columnEntity
.
getAtlasObjectId
(
)));
tableEntity
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity
)));
AtlasEntity
.
AtlasEntityWithExtInfo
input
=
new
AtlasEntity
.
AtlasEntityWithExtInfo
(
tableEntity
);
AtlasEntity
.
AtlasEntityWithExtInfo
input
=
new
AtlasEntity
.
AtlasEntityWithExtInfo
(
tableEntity
);
input
.
addReferredEntity
(
columnEntity
);
input
.
addReferredEntity
(
columnEntity
);
...
@@ -220,7 +220,7 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -220,7 +220,7 @@ public abstract class AtlasDeleteHandlerV1Test {
assertColumnForTestDeleteReference
(
entityStore
.
getById
(
tableCreated
.
getGuid
()));
assertColumnForTestDeleteReference
(
entityStore
.
getById
(
tableCreated
.
getGuid
()));
//Deleting table should update process
//Deleting table should update process
AtlasEntity
process
=
TestUtilsV2
.
createProcessEntity
(
null
,
Arrays
.
asList
(
tableCreated
.
getAtlasObjectId
(
)));
AtlasEntity
process
=
TestUtilsV2
.
createProcessEntity
(
null
,
Arrays
.
asList
(
AtlasTypeUtil
.
getAtlasObjectId
(
tableCreated
)));
init
();
init
();
final
EntityMutationResponse
processCreationResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
process
),
false
);
final
EntityMutationResponse
processCreationResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
process
),
false
);
...
@@ -249,7 +249,9 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -249,7 +249,9 @@ public abstract class AtlasDeleteHandlerV1Test {
final
AtlasEntity
columnEntity3
=
TestUtilsV2
.
createColumnEntity
(
tableEntity
);
final
AtlasEntity
columnEntity3
=
TestUtilsV2
.
createColumnEntity
(
tableEntity
);
entitiesInfo
.
addReferredEntity
(
columnEntity3
);
entitiesInfo
.
addReferredEntity
(
columnEntity3
);
tableEntity
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
columnEntity1
.
getAtlasObjectId
(),
columnEntity2
.
getAtlasObjectId
(),
columnEntity3
.
getAtlasObjectId
()));
tableEntity
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity1
),
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity2
),
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity3
)));
init
();
init
();
...
@@ -287,7 +289,7 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -287,7 +289,7 @@ public abstract class AtlasDeleteHandlerV1Test {
AtlasEntity
.
AtlasEntitiesWithExtInfo
entitiesInfo1
=
new
AtlasEntity
.
AtlasEntitiesWithExtInfo
(
tableEntity1
);
AtlasEntity
.
AtlasEntitiesWithExtInfo
entitiesInfo1
=
new
AtlasEntity
.
AtlasEntitiesWithExtInfo
(
tableEntity1
);
final
AtlasEntity
columnEntity3New
=
TestUtilsV2
.
createColumnEntity
(
tableEntity1
,
(
String
)
column3Created
.
getAttribute
(
NAME
));
final
AtlasEntity
columnEntity3New
=
TestUtilsV2
.
createColumnEntity
(
tableEntity1
,
(
String
)
column3Created
.
getAttribute
(
NAME
));
tableEntity1
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
columnEntity3New
.
getAtlasObjectId
(
)));
tableEntity1
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity3New
)));
entitiesInfo1
.
addReferredEntity
(
columnEntity3New
);
entitiesInfo1
.
addReferredEntity
(
columnEntity3New
);
init
();
init
();
...
@@ -357,9 +359,9 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -357,9 +359,9 @@ public abstract class AtlasDeleteHandlerV1Test {
Assert
.
assertNotNull
(
modificationTimestampPreUpdate
);
Assert
.
assertNotNull
(
modificationTimestampPreUpdate
);
AtlasEntity
maxEmployee
=
getEmployeeByName
(
hrDept
,
"Max"
);
AtlasEntity
maxEmployee
=
getEmployeeByName
(
hrDept
,
"Max"
);
maxEmployee
.
setAttribute
(
"mentor"
,
johnEmployeeCreated
.
getAtlasObjectId
(
));
maxEmployee
.
setAttribute
(
"mentor"
,
AtlasTypeUtil
.
getAtlasObjectId
(
johnEmployeeCreated
));
maxEmployee
.
setAttribute
(
"department"
,
deptCreated
.
getAtlasObjectId
(
));
maxEmployee
.
setAttribute
(
"department"
,
AtlasTypeUtil
.
getAtlasObjectId
(
deptCreated
));
maxEmployee
.
setAttribute
(
"manager"
,
janeEmployeeCreated
.
getAtlasObjectId
(
));
maxEmployee
.
setAttribute
(
"manager"
,
AtlasTypeUtil
.
getAtlasObjectId
(
janeEmployeeCreated
));
init
();
init
();
EntityMutationResponse
entityResult
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
maxEmployee
),
false
);
EntityMutationResponse
entityResult
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
maxEmployee
),
false
);
...
@@ -379,7 +381,7 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -379,7 +381,7 @@ public abstract class AtlasDeleteHandlerV1Test {
Assert
.
assertTrue
(
creationTimestamp
<
modificationTimestampPostUpdate
);
Assert
.
assertTrue
(
creationTimestamp
<
modificationTimestampPostUpdate
);
// Update max's mentor reference to jane.
// Update max's mentor reference to jane.
maxEmployee
.
setAttribute
(
"mentor"
,
janeEmployeeCreated
.
getAtlasObjectId
(
));
maxEmployee
.
setAttribute
(
"mentor"
,
AtlasTypeUtil
.
getAtlasObjectId
(
janeEmployeeCreated
));
init
();
init
();
entityResult
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
maxEmployee
),
false
);
entityResult
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
maxEmployee
),
false
);
assertEquals
(
entityResult
.
getUpdatedEntities
().
size
(),
1
);
assertEquals
(
entityResult
.
getUpdatedEntities
().
size
(),
1
);
...
@@ -400,7 +402,7 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -400,7 +402,7 @@ public abstract class AtlasDeleteHandlerV1Test {
Id
juliusGuid
=
julius
.
getId
();
Id
juliusGuid
=
julius
.
getId
();
init
();
init
();
maxEmployee
.
setAttribute
(
"manager"
,
juliusEmployeeCreated
.
getAtlasObjectId
(
));
maxEmployee
.
setAttribute
(
"manager"
,
AtlasTypeUtil
.
getAtlasObjectId
(
juliusEmployeeCreated
));
entityResult
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
maxEmployee
),
false
);
entityResult
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
maxEmployee
),
false
);
//TODO ATLAS-499 should have updated julius' subordinates
//TODO ATLAS-499 should have updated julius' subordinates
assertEquals
(
entityResult
.
getUpdatedEntities
().
size
(),
2
);
assertEquals
(
entityResult
.
getUpdatedEntities
().
size
(),
2
);
...
@@ -625,7 +627,7 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -625,7 +627,7 @@ public abstract class AtlasDeleteHandlerV1Test {
AtlasStruct
nestedStructInstance
=
new
AtlasStruct
(
"NestedStruct"
);
AtlasStruct
nestedStructInstance
=
new
AtlasStruct
(
"NestedStruct"
);
Struct
traitInstance
=
new
Struct
(
"TestTrait"
);
Struct
traitInstance
=
new
Struct
(
"TestTrait"
);
structContainerEntity
.
setAttribute
(
"struct"
,
structInstance
);
structContainerEntity
.
setAttribute
(
"struct"
,
structInstance
);
structInstance
.
setAttribute
(
"target"
,
ImmutableList
.
of
(
structTargetEntity
.
getAtlasObjectId
(
)));
structInstance
.
setAttribute
(
"target"
,
ImmutableList
.
of
(
AtlasTypeUtil
.
getAtlasObjectId
(
structTargetEntity
)));
structInstance
.
setAttribute
(
"nestedStructs"
,
ImmutableList
.
of
(
nestedStructInstance
));
structInstance
.
setAttribute
(
"nestedStructs"
,
ImmutableList
.
of
(
nestedStructInstance
));
AtlasEntity
.
AtlasEntitiesWithExtInfo
structCreationObj
=
new
AtlasEntity
.
AtlasEntitiesWithExtInfo
();
AtlasEntity
.
AtlasEntitiesWithExtInfo
structCreationObj
=
new
AtlasEntity
.
AtlasEntitiesWithExtInfo
();
...
@@ -728,7 +730,9 @@ public abstract class AtlasDeleteHandlerV1Test {
...
@@ -728,7 +730,9 @@ public abstract class AtlasDeleteHandlerV1Test {
final
AtlasEntity
columnEntity3
=
TestUtilsV2
.
createColumnEntity
(
tableEntity
);
final
AtlasEntity
columnEntity3
=
TestUtilsV2
.
createColumnEntity
(
tableEntity
);
entitiesInfo
.
addReferredEntity
(
columnEntity3
);
entitiesInfo
.
addReferredEntity
(
columnEntity3
);
tableEntity
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
columnEntity1
.
getAtlasObjectId
(),
columnEntity2
.
getAtlasObjectId
(),
columnEntity3
.
getAtlasObjectId
()));
tableEntity
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity1
),
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity2
),
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity3
)));
init
();
init
();
...
...
repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
View file @
7303a412
...
@@ -191,8 +191,8 @@ public class AtlasEntityStoreV1Test {
...
@@ -191,8 +191,8 @@ public class AtlasEntityStoreV1Test {
AtlasEntity
col2
=
TestUtilsV2
.
createColumnEntity
(
tableEntity
);
AtlasEntity
col2
=
TestUtilsV2
.
createColumnEntity
(
tableEntity
);
col2
.
setAttribute
(
TestUtilsV2
.
NAME
,
"col2"
);
col2
.
setAttribute
(
TestUtilsV2
.
NAME
,
"col2"
);
columns
.
add
(
col1
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
col1
));
columns
.
add
(
col2
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
col2
));
tableEntity
.
setAttribute
(
TestUtilsV2
.
COLUMNS_ATTR_NAME
,
columns
);
tableEntity
.
setAttribute
(
TestUtilsV2
.
COLUMNS_ATTR_NAME
,
columns
);
...
@@ -213,8 +213,8 @@ public class AtlasEntityStoreV1Test {
...
@@ -213,8 +213,8 @@ public class AtlasEntityStoreV1Test {
AtlasEntity
col4
=
TestUtilsV2
.
createColumnEntity
(
tableEntity
);
AtlasEntity
col4
=
TestUtilsV2
.
createColumnEntity
(
tableEntity
);
col4
.
setAttribute
(
TestUtilsV2
.
NAME
,
"col4"
);
col4
.
setAttribute
(
TestUtilsV2
.
NAME
,
"col4"
);
columns
.
add
(
col3
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
col3
));
columns
.
add
(
col4
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
col4
));
tableEntity
.
setAttribute
(
TestUtilsV2
.
COLUMNS_ATTR_NAME
,
columns
);
tableEntity
.
setAttribute
(
TestUtilsV2
.
COLUMNS_ATTR_NAME
,
columns
);
entitiesInfo
.
addReferredEntity
(
col3
);
entitiesInfo
.
addReferredEntity
(
col3
);
...
@@ -228,8 +228,8 @@ public class AtlasEntityStoreV1Test {
...
@@ -228,8 +228,8 @@ public class AtlasEntityStoreV1Test {
//Swap elements
//Swap elements
columns
.
clear
();
columns
.
clear
();
columns
.
add
(
col4
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
col4
));
columns
.
add
(
col3
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
col3
));
tableEntity
.
setAttribute
(
TestUtilsV2
.
COLUMNS_ATTR_NAME
,
columns
);
tableEntity
.
setAttribute
(
TestUtilsV2
.
COLUMNS_ATTR_NAME
,
columns
);
init
();
init
();
...
@@ -321,7 +321,7 @@ public class AtlasEntityStoreV1Test {
...
@@ -321,7 +321,7 @@ public class AtlasEntityStoreV1Test {
AtlasEntity
col0
=
new
AtlasEntity
(
TestUtilsV2
.
COLUMN_TYPE
,
TestUtilsV2
.
NAME
,
"test1"
);
AtlasEntity
col0
=
new
AtlasEntity
(
TestUtilsV2
.
COLUMN_TYPE
,
TestUtilsV2
.
NAME
,
"test1"
);
col0
.
setAttribute
(
"type"
,
"string"
);
col0
.
setAttribute
(
"type"
,
"string"
);
col0
.
setAttribute
(
"table"
,
tableEntity
.
getAtlasObjectId
(
));
col0
.
setAttribute
(
"table"
,
AtlasTypeUtil
.
getAtlasObjectId
(
tableEntity
));
AtlasEntityWithExtInfo
col0WithExtendedInfo
=
new
AtlasEntityWithExtInfo
(
col0
);
AtlasEntityWithExtInfo
col0WithExtendedInfo
=
new
AtlasEntityWithExtInfo
(
col0
);
col0WithExtendedInfo
.
addReferredEntity
(
tableEntity
);
col0WithExtendedInfo
.
addReferredEntity
(
tableEntity
);
...
@@ -332,7 +332,7 @@ public class AtlasEntityStoreV1Test {
...
@@ -332,7 +332,7 @@ public class AtlasEntityStoreV1Test {
AtlasEntity
col1
=
new
AtlasEntity
(
TestUtils
.
COLUMN_TYPE
,
TestUtilsV2
.
NAME
,
"test2"
);
AtlasEntity
col1
=
new
AtlasEntity
(
TestUtils
.
COLUMN_TYPE
,
TestUtilsV2
.
NAME
,
"test2"
);
col1
.
setAttribute
(
"type"
,
"string"
);
col1
.
setAttribute
(
"type"
,
"string"
);
col1
.
setAttribute
(
"table"
,
tableEntity
.
getAtlasObjectId
(
));
col1
.
setAttribute
(
"table"
,
AtlasTypeUtil
.
getAtlasObjectId
(
tableEntity
));
AtlasEntityWithExtInfo
col1WithExtendedInfo
=
new
AtlasEntityWithExtInfo
(
col1
);
AtlasEntityWithExtInfo
col1WithExtendedInfo
=
new
AtlasEntityWithExtInfo
(
col1
);
col1WithExtendedInfo
.
addReferredEntity
(
tableEntity
);
col1WithExtendedInfo
.
addReferredEntity
(
tableEntity
);
...
@@ -342,8 +342,8 @@ public class AtlasEntityStoreV1Test {
...
@@ -342,8 +342,8 @@ public class AtlasEntityStoreV1Test {
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
col1WithExtendedInfo
),
false
);
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
col1WithExtendedInfo
),
false
);
Map
<
String
,
AtlasObjectId
>
columnsMap
=
new
HashMap
<
String
,
AtlasObjectId
>();
Map
<
String
,
AtlasObjectId
>
columnsMap
=
new
HashMap
<
String
,
AtlasObjectId
>();
columnsMap
.
put
(
"col0"
,
col0
.
getAtlasObjectId
(
));
columnsMap
.
put
(
"col0"
,
AtlasTypeUtil
.
getAtlasObjectId
(
col0
));
columnsMap
.
put
(
"col1"
,
col1
.
getAtlasObjectId
(
));
columnsMap
.
put
(
"col1"
,
AtlasTypeUtil
.
getAtlasObjectId
(
col1
));
tableEntity
.
setAttribute
(
TestUtils
.
COLUMNS_MAP
,
columnsMap
);
tableEntity
.
setAttribute
(
TestUtils
.
COLUMNS_MAP
,
columnsMap
);
...
@@ -356,8 +356,8 @@ public class AtlasEntityStoreV1Test {
...
@@ -356,8 +356,8 @@ public class AtlasEntityStoreV1Test {
//Swap elements
//Swap elements
columnsMap
.
clear
();
columnsMap
.
clear
();
columnsMap
.
put
(
"col0"
,
col1
.
getAtlasObjectId
(
));
columnsMap
.
put
(
"col0"
,
AtlasTypeUtil
.
getAtlasObjectId
(
col1
));
columnsMap
.
put
(
"col1"
,
col0
.
getAtlasObjectId
(
));
columnsMap
.
put
(
"col1"
,
AtlasTypeUtil
.
getAtlasObjectId
(
col0
));
tableEntity
.
setAttribute
(
TestUtils
.
COLUMNS_MAP
,
columnsMap
);
tableEntity
.
setAttribute
(
TestUtils
.
COLUMNS_MAP
,
columnsMap
);
init
();
init
();
...
@@ -367,7 +367,7 @@ public class AtlasEntityStoreV1Test {
...
@@ -367,7 +367,7 @@ public class AtlasEntityStoreV1Test {
//Drop the first key and change the class type as well to col0
//Drop the first key and change the class type as well to col0
columnsMap
.
clear
();
columnsMap
.
clear
();
columnsMap
.
put
(
"col0"
,
col0
.
getAtlasObjectId
(
));
columnsMap
.
put
(
"col0"
,
AtlasTypeUtil
.
getAtlasObjectId
(
col0
));
init
();
init
();
response
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
entitiesInfo
),
false
);
response
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
entitiesInfo
),
false
);
AtlasEntityHeader
tableDefinition7
=
response
.
getFirstUpdatedEntityByTypeName
(
TABLE_TYPE
);
AtlasEntityHeader
tableDefinition7
=
response
.
getFirstUpdatedEntityByTypeName
(
TABLE_TYPE
);
...
@@ -695,7 +695,7 @@ public class AtlasEntityStoreV1Test {
...
@@ -695,7 +695,7 @@ public class AtlasEntityStoreV1Test {
tblEntity
.
setAttribute
(
"name"
,
RandomStringUtils
.
randomAlphanumeric
(
10
));
tblEntity
.
setAttribute
(
"name"
,
RandomStringUtils
.
randomAlphanumeric
(
10
));
tblEntity
.
setAttribute
(
"type"
,
"type"
);
tblEntity
.
setAttribute
(
"type"
,
"type"
);
tblEntity
.
setAttribute
(
"tableType"
,
"MANAGED"
);
tblEntity
.
setAttribute
(
"tableType"
,
"MANAGED"
);
tblEntity
.
setAttribute
(
"database"
,
updatedDbEntity
.
getAtlasObjectId
(
));
tblEntity
.
setAttribute
(
"database"
,
AtlasTypeUtil
.
getAtlasObjectId
(
updatedDbEntity
));
// create new column entity
// create new column entity
AtlasEntity
col1
=
TestUtilsV2
.
createColumnEntity
(
tblEntity
);
AtlasEntity
col1
=
TestUtilsV2
.
createColumnEntity
(
tblEntity
);
...
@@ -704,8 +704,8 @@ public class AtlasEntityStoreV1Test {
...
@@ -704,8 +704,8 @@ public class AtlasEntityStoreV1Test {
col2
.
setAttribute
(
TestUtilsV2
.
NAME
,
"col2"
);
col2
.
setAttribute
(
TestUtilsV2
.
NAME
,
"col2"
);
List
<
AtlasObjectId
>
columns
=
new
ArrayList
<>();
List
<
AtlasObjectId
>
columns
=
new
ArrayList
<>();
columns
.
add
(
col1
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
col1
));
columns
.
add
(
col2
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
col2
));
tblEntity
.
setAttribute
(
TestUtilsV2
.
COLUMNS_ATTR_NAME
,
columns
);
tblEntity
.
setAttribute
(
TestUtilsV2
.
COLUMNS_ATTR_NAME
,
columns
);
...
@@ -731,8 +731,8 @@ public class AtlasEntityStoreV1Test {
...
@@ -731,8 +731,8 @@ public class AtlasEntityStoreV1Test {
col4
.
setAttribute
(
"description"
,
"description col4"
);
col4
.
setAttribute
(
"description"
,
"description col4"
);
columns
.
clear
();
columns
.
clear
();
columns
.
add
(
col3
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
col3
));
columns
.
add
(
col4
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
col4
));
tblEntity
=
new
AtlasEntity
(
TABLE_TYPE
);
tblEntity
=
new
AtlasEntity
(
TABLE_TYPE
);
tblEntity
.
setGuid
(
createdTblEntity
.
getGuid
());
tblEntity
.
setGuid
(
createdTblEntity
.
getGuid
());
...
@@ -774,7 +774,9 @@ public class AtlasEntityStoreV1Test {
...
@@ -774,7 +774,9 @@ public class AtlasEntityStoreV1Test {
columnEntity3
.
setAttribute
(
"description"
,
"desc for col3"
);
columnEntity3
.
setAttribute
(
"description"
,
"desc for col3"
);
entitiesInfo
.
addReferredEntity
(
columnEntity3
);
entitiesInfo
.
addReferredEntity
(
columnEntity3
);
tableEntity
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
columnEntity1
.
getAtlasObjectId
(),
columnEntity2
.
getAtlasObjectId
(),
columnEntity3
.
getAtlasObjectId
()));
tableEntity
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity1
),
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity2
),
AtlasTypeUtil
.
getAtlasObjectId
(
columnEntity3
)));
init
();
init
();
...
@@ -801,7 +803,9 @@ public class AtlasEntityStoreV1Test {
...
@@ -801,7 +803,9 @@ public class AtlasEntityStoreV1Test {
final
AtlasEntity
tableEntity1
=
new
AtlasEntity
(
TABLE_TYPE
);
final
AtlasEntity
tableEntity1
=
new
AtlasEntity
(
TABLE_TYPE
);
tableEntity1
.
setGuid
(
createdTblHeader
.
getGuid
());
tableEntity1
.
setGuid
(
createdTblHeader
.
getGuid
());
tableEntity1
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
col1
.
getAtlasObjectId
(),
col2
.
getAtlasObjectId
(),
col3
.
getAtlasObjectId
()));
tableEntity1
.
setAttribute
(
COLUMNS_ATTR_NAME
,
Arrays
.
asList
(
AtlasTypeUtil
.
getAtlasObjectId
(
col1
),
AtlasTypeUtil
.
getAtlasObjectId
(
col2
),
AtlasTypeUtil
.
getAtlasObjectId
(
col3
)));
AtlasEntitiesWithExtInfo
tableInfo
=
new
AtlasEntitiesWithExtInfo
(
tableEntity1
);
AtlasEntitiesWithExtInfo
tableInfo
=
new
AtlasEntitiesWithExtInfo
(
tableEntity1
);
tableInfo
.
addReferredEntity
(
col1
.
getGuid
(),
col1
);
tableInfo
.
addReferredEntity
(
col1
.
getGuid
(),
col1
);
tableInfo
.
addReferredEntity
(
col2
.
getGuid
(),
col2
);
tableInfo
.
addReferredEntity
(
col2
.
getGuid
(),
col2
);
...
@@ -862,7 +866,7 @@ public class AtlasEntityStoreV1Test {
...
@@ -862,7 +866,7 @@ public class AtlasEntityStoreV1Test {
case
OBJECT_ID_TYPE:
case
OBJECT_ID_TYPE:
Assert
.
assertTrue
(
actual
instanceof
AtlasObjectId
);
Assert
.
assertTrue
(
actual
instanceof
AtlasObjectId
);
String
guid
=
((
AtlasObjectId
)
actual
).
getGuid
();
String
guid
=
((
AtlasObjectId
)
actual
).
getGuid
();
Assert
.
assertTrue
(
Atlas
Entity
.
isAssigne
d
(
guid
),
"expected assigned guid. found "
+
guid
);
Assert
.
assertTrue
(
Atlas
TypeUtil
.
isAssignedGui
d
(
guid
),
"expected assigned guid. found "
+
guid
);
break
;
break
;
case
PRIMITIVE:
case
PRIMITIVE:
...
...
webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
View file @
7303a412
...
@@ -420,8 +420,8 @@ public class QuickStartV2 {
...
@@ -420,8 +420,8 @@ public class QuickStartV2 {
entity
.
setAttribute
(
"createTime"
,
System
.
currentTimeMillis
());
entity
.
setAttribute
(
"createTime"
,
System
.
currentTimeMillis
());
entity
.
setAttribute
(
"lastAccessTime"
,
System
.
currentTimeMillis
());
entity
.
setAttribute
(
"lastAccessTime"
,
System
.
currentTimeMillis
());
entity
.
setAttribute
(
"retention"
,
System
.
currentTimeMillis
());
entity
.
setAttribute
(
"retention"
,
System
.
currentTimeMillis
());
entity
.
setAttribute
(
"db"
,
db
.
getAtlasObjectId
(
));
entity
.
setAttribute
(
"db"
,
AtlasTypeUtil
.
getAtlasObjectId
(
db
));
entity
.
setAttribute
(
"sd"
,
sd
.
getAtlasObjectId
(
));
entity
.
setAttribute
(
"sd"
,
AtlasTypeUtil
.
getAtlasObjectId
(
sd
));
entity
.
setAttribute
(
"columns"
,
AtlasTypeUtil
.
toObjectIds
(
columns
));
entity
.
setAttribute
(
"columns"
,
AtlasTypeUtil
.
toObjectIds
(
columns
));
return
createInstance
(
entity
,
traitNames
);
return
createInstance
(
entity
,
traitNames
);
...
...
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
View file @
7303a412
...
@@ -28,6 +28,7 @@ import org.apache.atlas.EntityAuditEvent;
...
@@ -28,6 +28,7 @@ import org.apache.atlas.EntityAuditEvent;
import
org.apache.atlas.AtlasClient.EntityResult
;
import
org.apache.atlas.AtlasClient.EntityResult
;
import
org.apache.atlas.model.instance.GuidMapping
;
import
org.apache.atlas.model.instance.GuidMapping
;
import
org.apache.atlas.services.MetadataService
;
import
org.apache.atlas.services.MetadataService
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.typesystem.IStruct
;
import
org.apache.atlas.typesystem.IStruct
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.exception.EntityExistsException
;
import
org.apache.atlas.typesystem.exception.EntityExistsException
;
...
@@ -201,7 +202,7 @@ public class EntityResource {
...
@@ -201,7 +202,7 @@ public class EntityResource {
}
}
}
}
if
(
mapping
!=
null
)
{
if
(
mapping
!=
null
)
{
response
.
put
(
AtlasClient
.
GUID_ASSIGNMENTS
,
new
JSONObject
(
mapping
.
toString
(
)).
get
(
AtlasClient
.
GUID_ASSIGNMENTS
));
response
.
put
(
AtlasClient
.
GUID_ASSIGNMENTS
,
new
JSONObject
(
AtlasType
.
toJson
(
mapping
)).
get
(
AtlasClient
.
GUID_ASSIGNMENTS
));
}
}
return
response
;
return
response
;
}
}
...
...
webapp/src/main/java/org/apache/atlas/web/resources/ExportService.java
View file @
7303a412
...
@@ -23,7 +23,6 @@ import org.apache.atlas.model.typedef.AtlasTypesDef;
...
@@ -23,7 +23,6 @@ import org.apache.atlas.model.typedef.AtlasTypesDef;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.store.graph.v1.EntityGraphRetriever
;
import
org.apache.atlas.repository.store.graph.v1.EntityGraphRetriever
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.AtlasServiceException
;
...
@@ -32,6 +31,7 @@ import org.apache.atlas.model.instance.AtlasEntity;
...
@@ -32,6 +31,7 @@ import org.apache.atlas.model.instance.AtlasEntity;
import
org.apache.atlas.model.impexp.*
;
import
org.apache.atlas.model.impexp.*
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -133,7 +133,7 @@ public class ExportService {
...
@@ -133,7 +133,7 @@ public class ExportService {
private
void
processEntity
(
AtlasEntity
entity
,
ExportContext
context
)
throws
AtlasBaseException
{
private
void
processEntity
(
AtlasEntity
entity
,
ExportContext
context
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> processEntity({})"
,
entity
.
getAtlasObjectId
(
));
LOG
.
debug
(
"==> processEntity({})"
,
AtlasTypeUtil
.
getAtlasObjectId
(
entity
));
}
}
if
(!
context
.
guidsProcessed
.
contains
(
entity
.
getGuid
()))
{
if
(!
context
.
guidsProcessed
.
contains
(
entity
.
getGuid
()))
{
...
@@ -148,7 +148,7 @@ public class ExportService {
...
@@ -148,7 +148,7 @@ public class ExportService {
}
}
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== processEntity({})"
,
entity
.
getAtlasObjectId
(
));
LOG
.
debug
(
"<== processEntity({})"
,
AtlasTypeUtil
.
getAtlasObjectId
(
entity
));
}
}
}
}
...
@@ -156,7 +156,7 @@ public class ExportService {
...
@@ -156,7 +156,7 @@ public class ExportService {
try
{
try
{
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getConnectedEntityGuids({}): guidsToProcess {}"
,
entity
.
getAtlasObjectId
(
),
context
.
guidsToProcess
.
size
());
LOG
.
debug
(
"==> getConnectedEntityGuids({}): guidsToProcess {}"
,
AtlasTypeUtil
.
getAtlasObjectId
(
entity
),
context
.
guidsToProcess
.
size
());
}
}
List
<
String
>
result
=
executeGremlinScriptFor
(
entity
.
getGuid
());
List
<
String
>
result
=
executeGremlinScriptFor
(
entity
.
getGuid
());
...
...
webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
View file @
7303a412
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
package
org
.
apache
.
atlas
.
web
.
rest
;
package
org
.
apache
.
atlas
.
web
.
rest
;
import
com.google.inject.Inject
;
import
com.google.inject.Inject
;
import
com.webcohesion.enunciate.metadata.rs.ResponseCode
;
import
com.webcohesion.enunciate.metadata.rs.StatusCodes
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.SearchFilter
;
import
org.apache.atlas.model.SearchFilter
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
...
...
webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java
View file @
7303a412
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
package
org
.
apache
.
atlas
.
web
.
adapters
;
package
org
.
apache
.
atlas
.
web
.
adapters
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.TestUtilsV2
;
...
@@ -37,6 +38,7 @@ import org.apache.atlas.store.AtlasTypeDefStore;
...
@@ -37,6 +38,7 @@ import org.apache.atlas.store.AtlasTypeDefStore;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.web.rest.EntityREST
;
import
org.apache.atlas.web.rest.EntityREST
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -101,6 +103,7 @@ public class TestEntitiesREST {
...
@@ -101,6 +103,7 @@ public class TestEntitiesREST {
@AfterMethod
@AfterMethod
public
void
cleanup
()
throws
Exception
{
public
void
cleanup
()
throws
Exception
{
RequestContext
.
clear
();
RequestContext
.
clear
();
RequestContextV1
.
clear
();
}
}
@AfterClass
@AfterClass
...
@@ -263,7 +266,7 @@ public class TestEntitiesREST {
...
@@ -263,7 +266,7 @@ public class TestEntitiesREST {
List
<
AtlasObjectId
>
ret
=
new
ArrayList
<>();
List
<
AtlasObjectId
>
ret
=
new
ArrayList
<>();
for
(
AtlasEntity
entity
:
entities
)
{
for
(
AtlasEntity
entity
:
entities
)
{
ret
.
add
(
entity
.
getAtlasObjectId
(
));
ret
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
entity
));
}
}
return
ret
;
return
ret
;
...
...
webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
View file @
7303a412
...
@@ -19,6 +19,7 @@ package org.apache.atlas.web.adapters;
...
@@ -19,6 +19,7 @@ package org.apache.atlas.web.adapters;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RepositoryMetadataModule
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
@@ -30,6 +31,7 @@ import org.apache.atlas.model.instance.EntityMutations;
...
@@ -30,6 +31,7 @@ import org.apache.atlas.model.instance.EntityMutations;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.web.rest.EntityREST
;
import
org.apache.atlas.web.rest.EntityREST
;
import
org.mockito.Mockito
;
import
org.mockito.Mockito
;
import
org.testng.Assert
;
import
org.testng.Assert
;
...
@@ -73,6 +75,7 @@ public class TestEntityREST {
...
@@ -73,6 +75,7 @@ public class TestEntityREST {
@AfterMethod
@AfterMethod
public
void
cleanup
()
throws
Exception
{
public
void
cleanup
()
throws
Exception
{
RequestContext
.
clear
();
RequestContext
.
clear
();
RequestContextV1
.
clear
();
}
}
private
void
createTestEntity
()
throws
Exception
{
private
void
createTestEntity
()
throws
Exception
{
...
@@ -158,7 +161,7 @@ public class TestEntityREST {
...
@@ -158,7 +161,7 @@ public class TestEntityREST {
EntityMutationResponse
response
=
entityREST
.
createOrUpdate
(
new
AtlasEntitiesWithExtInfo
(
dbEntity
));
EntityMutationResponse
response
=
entityREST
.
createOrUpdate
(
new
AtlasEntitiesWithExtInfo
(
dbEntity
));
String
dbGuid
=
response
.
getEntitiesByOperation
(
EntityMutations
.
EntityOperation
.
CREATE
).
get
(
0
).
getGuid
();
String
dbGuid
=
response
.
getEntitiesByOperation
(
EntityMutations
.
EntityOperation
.
CREATE
).
get
(
0
).
getGuid
();
Assert
.
assertTrue
(
Atlas
Entity
.
isAssigne
d
(
dbGuid
));
Assert
.
assertTrue
(
Atlas
TypeUtil
.
isAssignedGui
d
(
dbGuid
));
final
String
prevDBName
=
(
String
)
dbEntity
.
getAttribute
(
TestUtilsV2
.
NAME
);
final
String
prevDBName
=
(
String
)
dbEntity
.
getAttribute
(
TestUtilsV2
.
NAME
);
final
String
updatedDBName
=
prevDBName
+
":updated"
;
final
String
updatedDBName
=
prevDBName
+
":updated"
;
...
@@ -189,7 +192,7 @@ public class TestEntityREST {
...
@@ -189,7 +192,7 @@ public class TestEntityREST {
EntityMutationResponse
response
=
entityREST
.
createOrUpdate
(
new
AtlasEntitiesWithExtInfo
(
dbEntity
));
EntityMutationResponse
response
=
entityREST
.
createOrUpdate
(
new
AtlasEntitiesWithExtInfo
(
dbEntity
));
String
dbGuid
=
response
.
getEntitiesByOperation
(
EntityMutations
.
EntityOperation
.
CREATE
).
get
(
0
).
getGuid
();
String
dbGuid
=
response
.
getEntitiesByOperation
(
EntityMutations
.
EntityOperation
.
CREATE
).
get
(
0
).
getGuid
();
Assert
.
assertTrue
(
Atlas
Entity
.
isAssigne
d
(
dbGuid
));
Assert
.
assertTrue
(
Atlas
TypeUtil
.
isAssignedGui
d
(
dbGuid
));
final
String
prevDBName
=
(
String
)
dbEntity
.
getAttribute
(
TestUtilsV2
.
NAME
);
final
String
prevDBName
=
(
String
)
dbEntity
.
getAttribute
(
TestUtilsV2
.
NAME
);
final
String
updatedDBName
=
prevDBName
+
":updated"
;
final
String
updatedDBName
=
prevDBName
+
":updated"
;
...
...
webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
View file @
7303a412
...
@@ -40,6 +40,7 @@ import org.apache.atlas.notification.NotificationConsumer;
...
@@ -40,6 +40,7 @@ import org.apache.atlas.notification.NotificationConsumer;
import
org.apache.atlas.notification.NotificationInterface
;
import
org.apache.atlas.notification.NotificationInterface
;
import
org.apache.atlas.notification.NotificationModule
;
import
org.apache.atlas.notification.NotificationModule
;
import
org.apache.atlas.notification.entity.EntityNotification
;
import
org.apache.atlas.notification.entity.EntityNotification
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.typesystem.IStruct
;
import
org.apache.atlas.typesystem.IStruct
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.Struct
;
import
org.apache.atlas.typesystem.Struct
;
...
@@ -158,7 +159,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
...
@@ -158,7 +159,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
JSONObject
response
=
atlasClientV1
.
callAPIWithBodyAndParams
(
AtlasClient
.
API
.
CREATE_ENTITY
,
json
);
JSONObject
response
=
atlasClientV1
.
callAPIWithBodyAndParams
(
AtlasClient
.
API
.
CREATE_ENTITY
,
json
);
GuidMapping
guidMapping
=
GuidMapping
.
fromString
(
response
.
toString
()
);
GuidMapping
guidMapping
=
AtlasType
.
fromJson
(
response
.
toString
(),
GuidMapping
.
class
);
Map
<
String
,
String
>
guidsCreated
=
guidMapping
.
getGuidAssignments
();
Map
<
String
,
String
>
guidsCreated
=
guidMapping
.
getGuidAssignments
();
assertEquals
(
guidsCreated
.
size
(),
nTables
*
colsPerTable
+
nTables
+
1
);
assertEquals
(
guidsCreated
.
size
(),
nTables
*
colsPerTable
+
nTables
+
1
);
...
...
webapp/src/test/java/org/apache/atlas/web/resources/EntityV2JerseyResourceIT.java
View file @
7303a412
...
@@ -126,7 +126,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
...
@@ -126,7 +126,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
AtlasEntity
tableInstance
=
new
AtlasEntity
(
HIVE_TABLE_TYPE_V2
,
"name"
,
tableName
);
AtlasEntity
tableInstance
=
new
AtlasEntity
(
HIVE_TABLE_TYPE_V2
,
"name"
,
tableName
);
tableInstance
.
setAttribute
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
tableName
);
tableInstance
.
setAttribute
(
AtlasClient
.
REFERENCEABLE_ATTRIBUTE_NAME
,
tableName
);
tableInstance
.
setAttribute
(
"db"
,
databaseInstance
.
getAtlasObjectId
(
));
tableInstance
.
setAttribute
(
"db"
,
AtlasTypeUtil
.
getAtlasObjectId
(
databaseInstance
));
tableInstance
.
setAttribute
(
"description"
,
tableName
+
" table"
);
tableInstance
.
setAttribute
(
"description"
,
tableName
+
" table"
);
entities
.
addEntity
(
tableInstance
);
entities
.
addEntity
(
tableInstance
);
...
@@ -137,7 +137,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
...
@@ -137,7 +137,7 @@ public class EntityV2JerseyResourceIT extends BaseResourceIT {
columnInstance
.
setAttribute
(
"dataType"
,
"String"
);
columnInstance
.
setAttribute
(
"dataType"
,
"String"
);
columnInstance
.
setAttribute
(
"comment"
,
"column "
+
j
+
" for table "
+
i
);
columnInstance
.
setAttribute
(
"comment"
,
"column "
+
j
+
" for table "
+
i
);
columns
.
add
(
columnInstance
.
getAtlasObjectId
(
));
columns
.
add
(
AtlasTypeUtil
.
getAtlasObjectId
(
columnInstance
));
entities
.
addReferredEntity
(
columnInstance
);
entities
.
addReferredEntity
(
columnInstance
);
}
}
...
...
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