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
5b406348
Commit
5b406348
authored
Aug 16, 2018
by
Graham Wallis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2808: Add proxy support
ATLAS-2808: further updates Signed-off-by:
Graham Wallis
<
graham_wallis@uk.ibm.com
>
parent
69fe4ab7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
10 deletions
+50
-10
Constants.java
.../src/main/java/org/apache/atlas/repository/Constants.java
+8
-0
AtlasEntity.java
...ain/java/org/apache/atlas/model/instance/AtlasEntity.java
+31
-9
GraphHelper.java
...n/java/org/apache/atlas/repository/graph/GraphHelper.java
+4
-0
EntityGraphMapper.java
...he/atlas/repository/store/graph/v2/EntityGraphMapper.java
+5
-1
EntityGraphRetriever.java
...atlas/repository/store/graph/v2/EntityGraphRetriever.java
+2
-0
No files found.
common/src/main/java/org/apache/atlas/repository/Constants.java
View file @
5b406348
...
@@ -93,6 +93,14 @@ public final class Constants {
...
@@ -93,6 +93,14 @@ public final class Constants {
*/
*/
public
static
final
String
HOME_ID_KEY
=
INTERNAL_PROPERTY_KEY_PREFIX
+
"homeId"
;
public
static
final
String
HOME_ID_KEY
=
INTERNAL_PROPERTY_KEY_PREFIX
+
"homeId"
;
/**
* The isProxy field is used when saving into Atlas a proxy of an entity - i.e. it is not a whole entity, but
* a partial representation of an entity that is referred to by a relationship end.
* The isProxy field will be set to true if the entity is a proxy. The field is used during retrieval of an
* entity (proxy) from Atlas to indicate that the entity does not contain full entity detail.
*/
public
static
final
String
IS_PROXY_KEY
=
INTERNAL_PROPERTY_KEY_PREFIX
+
"isProxy"
;
public
static
final
String
TIMESTAMP_PROPERTY_KEY
=
INTERNAL_PROPERTY_KEY_PREFIX
+
"timestamp"
;
public
static
final
String
TIMESTAMP_PROPERTY_KEY
=
INTERNAL_PROPERTY_KEY_PREFIX
+
"timestamp"
;
public
static
final
String
MODIFICATION_TIMESTAMP_PROPERTY_KEY
=
public
static
final
String
MODIFICATION_TIMESTAMP_PROPERTY_KEY
=
...
...
intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java
View file @
5b406348
...
@@ -61,6 +61,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -61,6 +61,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
public
static
final
String
KEY_GUID
=
"guid"
;
public
static
final
String
KEY_GUID
=
"guid"
;
public
static
final
String
KEY_HOME_ID
=
"homeId"
;
public
static
final
String
KEY_HOME_ID
=
"homeId"
;
public
static
final
String
KEY_IS_PROXY
=
"isProxy"
;
public
static
final
String
KEY_STATUS
=
"status"
;
public
static
final
String
KEY_STATUS
=
"status"
;
public
static
final
String
KEY_CREATED_BY
=
"createdBy"
;
public
static
final
String
KEY_CREATED_BY
=
"createdBy"
;
public
static
final
String
KEY_UPDATED_BY
=
"updatedBy"
;
public
static
final
String
KEY_UPDATED_BY
=
"updatedBy"
;
...
@@ -73,14 +74,15 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -73,14 +74,15 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
*/
*/
public
enum
Status
{
ACTIVE
,
DELETED
}
public
enum
Status
{
ACTIVE
,
DELETED
}
private
String
guid
=
null
;
private
String
guid
=
null
;
private
String
homeId
=
null
;
private
String
homeId
=
null
;
private
Status
status
=
Status
.
ACTIVE
;
private
Boolean
isProxy
=
Boolean
.
FALSE
;
private
String
createdBy
=
null
;
private
Status
status
=
Status
.
ACTIVE
;
private
String
updatedBy
=
null
;
private
String
createdBy
=
null
;
private
Date
createTime
=
null
;
private
String
updatedBy
=
null
;
private
Date
updateTime
=
null
;
private
Date
createTime
=
null
;
private
Long
version
=
0L
;
private
Date
updateTime
=
null
;
private
Long
version
=
0L
;
private
Map
<
String
,
Object
>
relationshipAttributes
;
private
Map
<
String
,
Object
>
relationshipAttributes
;
private
List
<
AtlasClassification
>
classifications
;
private
List
<
AtlasClassification
>
classifications
;
...
@@ -119,6 +121,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -119,6 +121,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
if
(
map
!=
null
)
{
if
(
map
!=
null
)
{
Object
oGuid
=
map
.
get
(
KEY_GUID
);
Object
oGuid
=
map
.
get
(
KEY_GUID
);
Object
homeId
=
map
.
get
(
KEY_HOME_ID
);
Object
homeId
=
map
.
get
(
KEY_HOME_ID
);
Object
isProxy
=
map
.
get
(
KEY_IS_PROXY
);
Object
status
=
map
.
get
(
KEY_STATUS
);
Object
status
=
map
.
get
(
KEY_STATUS
);
Object
createdBy
=
map
.
get
(
KEY_CREATED_BY
);
Object
createdBy
=
map
.
get
(
KEY_CREATED_BY
);
Object
updatedBy
=
map
.
get
(
KEY_UPDATED_BY
);
Object
updatedBy
=
map
.
get
(
KEY_UPDATED_BY
);
...
@@ -134,6 +137,13 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -134,6 +137,13 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
setHomeId
(
homeId
.
toString
());
setHomeId
(
homeId
.
toString
());
}
}
if
(
isProxy
!=
null
)
{
setIsProxy
((
Boolean
)
isProxy
);
}
else
{
setIsProxy
(
Boolean
.
FALSE
);
}
if
(
status
!=
null
)
{
if
(
status
!=
null
)
{
setStatus
(
Status
.
valueOf
(
status
.
toString
()));
setStatus
(
Status
.
valueOf
(
status
.
toString
()));
}
}
...
@@ -166,6 +176,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -166,6 +176,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
if
(
other
!=
null
)
{
if
(
other
!=
null
)
{
setGuid
(
other
.
getGuid
());
setGuid
(
other
.
getGuid
());
setHomeId
(
other
.
getHomeId
());
setHomeId
(
other
.
getHomeId
());
setIsProxy
(
other
.
isProxy
());
setStatus
(
other
.
getStatus
());
setStatus
(
other
.
getStatus
());
setCreatedBy
(
other
.
getCreatedBy
());
setCreatedBy
(
other
.
getCreatedBy
());
setUpdatedBy
(
other
.
getUpdatedBy
());
setUpdatedBy
(
other
.
getUpdatedBy
());
...
@@ -192,6 +203,14 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -192,6 +203,14 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
this
.
homeId
=
homeId
;
this
.
homeId
=
homeId
;
}
}
public
Boolean
isProxy
()
{
return
isProxy
;
}
public
void
setIsProxy
(
Boolean
isProxy
)
{
this
.
isProxy
=
isProxy
;
}
public
Status
getStatus
()
{
public
Status
getStatus
()
{
return
status
;
return
status
;
}
}
...
@@ -308,6 +327,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -308,6 +327,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
private
void
init
()
{
private
void
init
()
{
setGuid
(
nextInternalId
());
setGuid
(
nextInternalId
());
setHomeId
(
null
);
setHomeId
(
null
);
setIsProxy
(
Boolean
.
FALSE
);
setStatus
(
null
);
setStatus
(
null
);
setCreatedBy
(
null
);
setCreatedBy
(
null
);
setUpdatedBy
(
null
);
setUpdatedBy
(
null
);
...
@@ -331,6 +351,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -331,6 +351,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
super
.
toString
(
sb
);
super
.
toString
(
sb
);
sb
.
append
(
"guid='"
).
append
(
guid
).
append
(
'\''
);
sb
.
append
(
"guid='"
).
append
(
guid
).
append
(
'\''
);
sb
.
append
(
", homeId='"
).
append
(
homeId
).
append
(
'\''
);
sb
.
append
(
", homeId='"
).
append
(
homeId
).
append
(
'\''
);
sb
.
append
(
", isProxy='"
).
append
(
isProxy
).
append
(
'\''
);
sb
.
append
(
", status="
).
append
(
status
);
sb
.
append
(
", status="
).
append
(
status
);
sb
.
append
(
", createdBy='"
).
append
(
createdBy
).
append
(
'\''
);
sb
.
append
(
", createdBy='"
).
append
(
createdBy
).
append
(
'\''
);
sb
.
append
(
", updatedBy='"
).
append
(
updatedBy
).
append
(
'\''
);
sb
.
append
(
", updatedBy='"
).
append
(
updatedBy
).
append
(
'\''
);
...
@@ -360,6 +381,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -360,6 +381,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
AtlasEntity
that
=
(
AtlasEntity
)
o
;
AtlasEntity
that
=
(
AtlasEntity
)
o
;
return
Objects
.
equals
(
guid
,
that
.
guid
)
&&
return
Objects
.
equals
(
guid
,
that
.
guid
)
&&
Objects
.
equals
(
homeId
,
that
.
homeId
)
&&
Objects
.
equals
(
homeId
,
that
.
homeId
)
&&
Objects
.
equals
(
isProxy
,
that
.
isProxy
)
&&
status
==
that
.
status
&&
status
==
that
.
status
&&
Objects
.
equals
(
createdBy
,
that
.
createdBy
)
&&
Objects
.
equals
(
createdBy
,
that
.
createdBy
)
&&
Objects
.
equals
(
updatedBy
,
that
.
updatedBy
)
&&
Objects
.
equals
(
updatedBy
,
that
.
updatedBy
)
&&
...
@@ -372,7 +394,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
...
@@ -372,7 +394,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
Objects
.
hash
(
super
.
hashCode
(),
guid
,
homeId
,
status
,
createdBy
,
updatedBy
,
createTime
,
updateTime
,
version
,
return
Objects
.
hash
(
super
.
hashCode
(),
guid
,
homeId
,
isProxy
,
status
,
createdBy
,
updatedBy
,
createTime
,
updateTime
,
version
,
relationshipAttributes
,
classifications
);
relationshipAttributes
,
classifications
);
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
View file @
5b406348
...
@@ -1185,6 +1185,10 @@ public final class GraphHelper {
...
@@ -1185,6 +1185,10 @@ public final class GraphHelper {
return
element
.
getProperty
(
Constants
.
HOME_ID_KEY
,
String
.
class
);
return
element
.
getProperty
(
Constants
.
HOME_ID_KEY
,
String
.
class
);
}
}
public
static
Boolean
isProxy
(
AtlasElement
element
)
{
return
element
.
getProperty
(
Constants
.
IS_PROXY_KEY
,
Boolean
.
class
);
}
public
static
String
getTypeName
(
AtlasElement
element
)
{
public
static
String
getTypeName
(
AtlasElement
element
)
{
return
element
.
getProperty
(
Constants
.
ENTITY_TYPE_PROPERTY_KEY
,
String
.
class
);
return
element
.
getProperty
(
Constants
.
ENTITY_TYPE_PROPERTY_KEY
,
String
.
class
);
}
}
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
View file @
5b406348
...
@@ -91,7 +91,7 @@ public class EntityGraphMapper {
...
@@ -91,7 +91,7 @@ public class EntityGraphMapper {
private
final
GraphHelper
graphHelper
=
GraphHelper
.
getInstance
();
private
final
GraphHelper
graphHelper
=
GraphHelper
.
getInstance
();
private
final
AtlasGraph
graph
;
private
final
AtlasGraph
graph
;
private
final
DeleteHandlerV1
deleteHandler
;
private
final
DeleteHandlerV1
deleteHandler
;
private
final
AtlasTypeRegistry
typeRegistry
;
private
final
AtlasTypeRegistry
typeRegistry
;
private
final
AtlasRelationshipStore
relationshipStore
;
private
final
AtlasRelationshipStore
relationshipStore
;
private
final
AtlasEntityChangeNotifier
entityChangeNotifier
;
private
final
AtlasEntityChangeNotifier
entityChangeNotifier
;
...
@@ -159,6 +159,10 @@ public class EntityGraphMapper {
...
@@ -159,6 +159,10 @@ public class EntityGraphMapper {
if
(
StringUtils
.
isNotEmpty
(
entity
.
getHomeId
()))
{
if
(
StringUtils
.
isNotEmpty
(
entity
.
getHomeId
()))
{
AtlasGraphUtilsV2
.
setProperty
(
vertex
,
Constants
.
HOME_ID_KEY
,
entity
.
getHomeId
());
AtlasGraphUtilsV2
.
setProperty
(
vertex
,
Constants
.
HOME_ID_KEY
,
entity
.
getHomeId
());
}
}
if
(
entity
.
isProxy
()
!=
null
)
{
AtlasGraphUtilsV2
.
setProperty
(
vertex
,
Constants
.
IS_PROXY_KEY
,
entity
.
isProxy
());
}
}
}
public
EntityMutationResponse
mapAttributesAndClassifications
(
EntityMutationContext
context
,
final
boolean
isPartialUpdate
,
final
boolean
replaceClassifications
)
throws
AtlasBaseException
{
public
EntityMutationResponse
mapAttributesAndClassifications
(
EntityMutationContext
context
,
final
boolean
isPartialUpdate
,
final
boolean
replaceClassifications
)
throws
AtlasBaseException
{
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
View file @
5b406348
...
@@ -522,6 +522,8 @@ public final class EntityGraphRetriever {
...
@@ -522,6 +522,8 @@ public final class EntityGraphRetriever {
entity
.
setHomeId
(
GraphHelper
.
getHomeId
(
entityVertex
));
entity
.
setHomeId
(
GraphHelper
.
getHomeId
(
entityVertex
));
entity
.
setIsProxy
(
GraphHelper
.
isProxy
(
entityVertex
));
return
entity
;
return
entity
;
}
}
...
...
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