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
3d5b4880
Commit
3d5b4880
authored
7 years ago
by
apoorvnaik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2490: updates to make usage of v1/v2 in class names consistent
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
85e08c28
Hide whitespace changes
Inline
Side-by-side
Showing
84 changed files
with
483 additions
and
484 deletions
+483
-484
AtlasAuthorizationUtils.java
...a/org/apache/atlas/authorize/AtlasAuthorizationUtils.java
+4
-4
ClassificationSearchProcessor.java
...apache/atlas/discovery/ClassificationSearchProcessor.java
+3
-3
EntityDiscoveryService.java
...va/org/apache/atlas/discovery/EntityDiscoveryService.java
+3
-3
EntityLineageService.java
...java/org/apache/atlas/discovery/EntityLineageService.java
+6
-6
FullTextSearchProcessor.java
...a/org/apache/atlas/discovery/FullTextSearchProcessor.java
+3
-3
SearchContext.java
...c/main/java/org/apache/atlas/discovery/SearchContext.java
+2
-2
SearchProcessor.java
...main/java/org/apache/atlas/discovery/SearchProcessor.java
+3
-3
GlossaryService.java
.../main/java/org/apache/atlas/glossary/GlossaryService.java
+6
-6
EntityAuditListener.java
...rg/apache/atlas/repository/audit/EntityAuditListener.java
+2
-2
EntityAuditListenerV2.java
.../apache/atlas/repository/audit/EntityAuditListenerV2.java
+5
-5
AtlasInstanceConverter.java
...e/atlas/repository/converters/AtlasInstanceConverter.java
+3
-3
TypeConverterUtil.java
...apache/atlas/repository/converters/TypeConverterUtil.java
+2
-2
FullTextMapperV2.java
...a/org/apache/atlas/repository/graph/FullTextMapperV2.java
+3
-3
GraphBackedSearchIndexer.java
...ache/atlas/repository/graph/GraphBackedSearchIndexer.java
+1
-2
GraphHelper.java
...n/java/org/apache/atlas/repository/graph/GraphHelper.java
+22
-22
ExportService.java
...ava/org/apache/atlas/repository/impexp/ExportService.java
+1
-1
ZipSource.java
...in/java/org/apache/atlas/repository/impexp/ZipSource.java
+1
-1
DataAccess.java
...main/java/org/apache/atlas/repository/ogm/DataAccess.java
+1
-1
AtlasEntityStore.java
...apache/atlas/repository/store/graph/AtlasEntityStore.java
+1
-1
BulkImporter.java
...org/apache/atlas/repository/store/graph/BulkImporter.java
+1
-1
EntityGraphDiscovery.java
...he/atlas/repository/store/graph/EntityGraphDiscovery.java
+0
-4
EntityGraphDiscoveryContext.java
...s/repository/store/graph/EntityGraphDiscoveryContext.java
+1
-1
DeleteHandlerV1.java
...ache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
+16
-14
SoftDeleteHandlerV1.java
.../atlas/repository/store/graph/v1/SoftDeleteHandlerV1.java
+8
-7
AtlasAbstractDefStoreV2.java
...as/repository/store/graph/v2/AtlasAbstractDefStoreV2.java
+6
-5
AtlasClassificationDefStoreV2.java
...ository/store/graph/v2/AtlasClassificationDefStoreV2.java
+11
-11
AtlasEntityChangeNotifier.java
.../repository/store/graph/v2/AtlasEntityChangeNotifier.java
+5
-5
AtlasEntityDefStoreV2.java
...tlas/repository/store/graph/v2/AtlasEntityDefStoreV2.java
+13
-13
AtlasEntityGraphDiscoveryV2.java
...epository/store/graph/v2/AtlasEntityGraphDiscoveryV2.java
+4
-4
AtlasEntityStoreV2.java
...e/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
+20
-21
AtlasEntityStream.java
...he/atlas/repository/store/graph/v2/AtlasEntityStream.java
+1
-1
AtlasEntityStreamForImport.java
...repository/store/graph/v2/AtlasEntityStreamForImport.java
+1
-1
AtlasEnumDefStoreV2.java
.../atlas/repository/store/graph/v2/AtlasEnumDefStoreV2.java
+15
-15
AtlasGraphUtilsV2.java
...he/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java
+8
-8
AtlasRelationshipDefStoreV2.java
...epository/store/graph/v2/AtlasRelationshipDefStoreV2.java
+12
-12
AtlasRelationshipStoreV2.java
...s/repository/store/graph/v2/AtlasRelationshipStoreV2.java
+32
-31
AtlasStructDefStoreV2.java
...tlas/repository/store/graph/v2/AtlasStructDefStoreV2.java
+30
-30
AtlasTypeDefGraphStoreV2.java
...s/repository/store/graph/v2/AtlasTypeDefGraphStoreV2.java
+17
-17
AttributeMutationContext.java
...s/repository/store/graph/v2/AttributeMutationContext.java
+1
-1
BulkImporterImpl.java
...che/atlas/repository/store/graph/v2/BulkImporterImpl.java
+4
-4
EntityGraphMapper.java
...he/atlas/repository/store/graph/v2/EntityGraphMapper.java
+47
-46
EntityGraphRetriever.java
...atlas/repository/store/graph/v2/EntityGraphRetriever.java
+8
-8
EntityImportStream.java
...e/atlas/repository/store/graph/v2/EntityImportStream.java
+1
-1
EntityMutationContext.java
...tlas/repository/store/graph/v2/EntityMutationContext.java
+1
-1
EntityStream.java
.../apache/atlas/repository/store/graph/v2/EntityStream.java
+1
-1
IDBasedEntityResolver.java
...tlas/repository/store/graph/v2/IDBasedEntityResolver.java
+3
-3
InMemoryMapEntityStream.java
...as/repository/store/graph/v2/InMemoryMapEntityStream.java
+1
-1
InstanceGraphMapper.java
.../atlas/repository/store/graph/v2/InstanceGraphMapper.java
+1
-1
UniqAttrBasedEntityResolver.java
...epository/store/graph/v2/UniqAttrBasedEntityResolver.java
+2
-2
AtlasRepositoryConfiguration.java
...a/org/apache/atlas/util/AtlasRepositoryConfiguration.java
+1
-1
SearchPredicateUtil.java
.../main/java/org/apache/atlas/util/SearchPredicateUtil.java
+2
-2
TestModules.java
repository/src/test/java/org/apache/atlas/TestModules.java
+9
-9
GlossaryServiceTest.java
...t/java/org/apache/atlas/glossary/GlossaryServiceTest.java
+1
-1
BasicTestSetup.java
.../src/test/java/org/apache/atlas/query/BasicTestSetup.java
+1
-3
ExportServiceTest.java
...org/apache/atlas/repository/impexp/ExportServiceTest.java
+9
-10
ImportServiceTest.java
...org/apache/atlas/repository/impexp/ImportServiceTest.java
+3
-3
ZipFileResourceTestUtils.java
...che/atlas/repository/impexp/ZipFileResourceTestUtils.java
+3
-3
AtlasTypeDefGraphStoreTest.java
...as/repository/store/graph/AtlasTypeDefGraphStoreTest.java
+3
-3
AtlasComplexAttributesTest.java
...repository/store/graph/v2/AtlasComplexAttributesTest.java
+2
-2
AtlasEntityDefStoreV2Test.java
.../repository/store/graph/v2/AtlasEntityDefStoreV2Test.java
+4
-4
AtlasEntityStoreV2BulkImportPercentTest.java
...ore/graph/v2/AtlasEntityStoreV2BulkImportPercentTest.java
+2
-2
AtlasEntityStoreV2Test.java
...las/repository/store/graph/v2/AtlasEntityStoreV2Test.java
+2
-2
AtlasEntityTestBase.java
.../atlas/repository/store/graph/v2/AtlasEntityTestBase.java
+8
-7
AtlasRelationshipDefStoreV2Test.java
...itory/store/graph/v2/AtlasRelationshipDefStoreV2Test.java
+9
-9
AtlasRelationshipStoreHardDeleteV2Test.java
...tore/graph/v2/AtlasRelationshipStoreHardDeleteV2Test.java
+3
-2
AtlasRelationshipStoreSoftDeleteV2Test.java
...tore/graph/v2/AtlasRelationshipStoreSoftDeleteV2Test.java
+3
-2
AtlasRelationshipStoreV2Test.java
...pository/store/graph/v2/AtlasRelationshipStoreV2Test.java
+9
-9
InverseReferenceUpdateHardDeleteV2Test.java
...tore/graph/v2/InverseReferenceUpdateHardDeleteV2Test.java
+3
-2
InverseReferenceUpdateSoftDeleteV2Test.java
...tore/graph/v2/InverseReferenceUpdateSoftDeleteV2Test.java
+3
-2
InverseReferenceUpdateV2Test.java
...pository/store/graph/v2/InverseReferenceUpdateV2Test.java
+7
-7
ClassificationPropagationTest.java
...ository/tagpropagation/ClassificationPropagationTest.java
+2
-2
RequestContext.java
...er-api/src/main/java/org/apache/atlas/RequestContext.java
+8
-8
EntityNotificationListenerV2.java
...ache/atlas/notification/EntityNotificationListenerV2.java
+8
-8
NotificationHookConsumer.java
...g/apache/atlas/notification/NotificationHookConsumer.java
+7
-8
AtlasAuthenticationFilter.java
...g/apache/atlas/web/filters/AtlasAuthenticationFilter.java
+0
-1
AuditFilter.java
...c/main/java/org/apache/atlas/web/filters/AuditFilter.java
+4
-4
EntityResource.java
...n/java/org/apache/atlas/web/resources/EntityResource.java
+3
-3
EntityREST.java
...p/src/main/java/org/apache/atlas/web/rest/EntityREST.java
+2
-3
NotificationHookConsumerKafkaTest.java
...atlas/notification/NotificationHookConsumerKafkaTest.java
+1
-1
NotificationHookConsumerTest.java
...ache/atlas/notification/NotificationHookConsumerTest.java
+1
-1
RestUtilsTest.java
...pp/src/test/java/org/apache/atlas/util/RestUtilsTest.java
+11
-11
TestEntitiesREST.java
.../java/org/apache/atlas/web/adapters/TestEntitiesREST.java
+2
-2
TestEntityREST.java
...st/java/org/apache/atlas/web/adapters/TestEntityREST.java
+2
-2
AtlasAuthenticationKerberosFilterTest.java
...as/web/filters/AtlasAuthenticationKerberosFilterTest.java
+2
-2
No files found.
authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizationUtils.java
View file @
3d5b4880
...
...
@@ -20,6 +20,7 @@
package
org
.
apache
.
atlas
.
authorize
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -33,7 +34,6 @@ import java.net.InetAddress;
import
java.net.UnknownHostException
;
import
java.util.HashSet
;
import
java.util.Set
;
import
org.apache.atlas.RequestContextV1
;
public
class
AtlasAuthorizationUtils
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasAuthorizationUtils
.
class
);
...
...
@@ -71,7 +71,7 @@ public class AtlasAuthorizationUtils {
AtlasAuthorizer
authorizer
=
AtlasAuthorizerFactory
.
getAtlasAuthorizer
();
request
.
setUser
(
userName
,
getCurrentUserGroups
());
request
.
setClientIPAddress
(
RequestContext
V1
.
get
().
getClientIPAddress
());
request
.
setClientIPAddress
(
RequestContext
.
get
().
getClientIPAddress
());
ret
=
authorizer
.
isAccessAllowed
(
request
);
}
catch
(
AtlasAuthorizationException
e
)
{
LOG
.
error
(
"Unable to obtain AtlasAuthorizer"
,
e
);
...
...
@@ -92,7 +92,7 @@ public class AtlasAuthorizationUtils {
AtlasAuthorizer
authorizer
=
AtlasAuthorizerFactory
.
getAtlasAuthorizer
();
request
.
setUser
(
getCurrentUserName
(),
getCurrentUserGroups
());
request
.
setClientIPAddress
(
RequestContext
V1
.
get
().
getClientIPAddress
());
request
.
setClientIPAddress
(
RequestContext
.
get
().
getClientIPAddress
());
ret
=
authorizer
.
isAccessAllowed
(
request
);
}
catch
(
AtlasAuthorizationException
e
)
{
LOG
.
error
(
"Unable to obtain AtlasAuthorizer"
,
e
);
...
...
@@ -113,7 +113,7 @@ public class AtlasAuthorizationUtils {
AtlasAuthorizer
authorizer
=
AtlasAuthorizerFactory
.
getAtlasAuthorizer
();
request
.
setUser
(
getCurrentUserName
(),
getCurrentUserGroups
());
request
.
setClientIPAddress
(
RequestContext
V1
.
get
().
getClientIPAddress
());
request
.
setClientIPAddress
(
RequestContext
.
get
().
getClientIPAddress
());
ret
=
authorizer
.
isAccessAllowed
(
request
);
}
catch
(
AtlasAuthorizationException
e
)
{
LOG
.
error
(
"Unable to obtain AtlasAuthorizer"
,
e
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
View file @
3d5b4880
...
...
@@ -27,7 +27,7 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
import
org.apache.atlas.repository.graphdb.AtlasGraphQuery
;
import
org.apache.atlas.repository.graphdb.AtlasIndexQuery
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.util.AtlasGremlinQueryProvider
;
import
org.apache.atlas.util.SearchPredicateUtil
;
...
...
@@ -268,11 +268,11 @@ public class ClassificationSearchProcessor extends SearchProcessor {
for
(
AtlasEdge
edge
:
edges
)
{
AtlasVertex
entityVertex
=
edge
.
getOutVertex
();
if
(
activeOnly
&&
AtlasGraphUtilsV
1
.
getState
(
entityVertex
)
!=
AtlasEntity
.
Status
.
ACTIVE
)
{
if
(
activeOnly
&&
AtlasGraphUtilsV
2
.
getState
(
entityVertex
)
!=
AtlasEntity
.
Status
.
ACTIVE
)
{
continue
;
}
String
guid
=
AtlasGraphUtilsV
1
.
getIdFromVertex
(
entityVertex
);
String
guid
=
AtlasGraphUtilsV
2
.
getIdFromVertex
(
entityVertex
);
if
(
processedGuids
.
contains
(
guid
))
{
continue
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
View file @
3d5b4880
...
...
@@ -42,8 +42,8 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
import
org.apache.atlas.repository.graphdb.AtlasIndexQuery
;
import
org.apache.atlas.repository.graphdb.AtlasIndexQuery.Result
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityGraphRetriever
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityGraphRetriever
;
import
org.apache.atlas.repository.userprofile.UserProfileService
;
import
org.apache.atlas.type.AtlasArrayType
;
import
org.apache.atlas.type.AtlasBuiltInTypes.AtlasObjectIdType
;
...
...
@@ -112,7 +112,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
this
.
maxResultSetSize
=
ApplicationProperties
.
get
().
getInt
(
Constants
.
INDEX_SEARCH_MAX_RESULT_SET_SIZE
,
150
);
this
.
maxTypesLengthInIdxQuery
=
ApplicationProperties
.
get
().
getInt
(
Constants
.
INDEX_SEARCH_TYPES_MAX_QUERY_STR_LENGTH
,
512
);
this
.
maxTagsLengthInIdxQuery
=
ApplicationProperties
.
get
().
getInt
(
Constants
.
INDEX_SEARCH_TAGS_MAX_QUERY_STR_LENGTH
,
512
);
this
.
indexSearchPrefix
=
AtlasGraphUtilsV
1
.
getIndexSearchPrefix
();
this
.
indexSearchPrefix
=
AtlasGraphUtilsV
2
.
getIndexSearchPrefix
();
this
.
userProfileService
=
userProfileService
;
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/EntityLineageService.java
View file @
3d5b4880
...
...
@@ -37,8 +37,8 @@ import org.apache.atlas.repository.Constants;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityGraphRetriever
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityGraphRetriever
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
...
...
@@ -126,7 +126,7 @@ public class EntityLineageService implements AtlasLineageService {
Map
<
String
,
Object
>
lookupAttributes
=
new
HashMap
<>();
lookupAttributes
.
put
(
"qualifiedName"
,
datasetName
);
String
guid
=
AtlasGraphUtilsV
1
.
getGuidByUniqueAttributes
(
hive_table
,
lookupAttributes
);
String
guid
=
AtlasGraphUtilsV
2
.
getGuidByUniqueAttributes
(
hive_table
,
lookupAttributes
);
return
getSchemaForHiveTableByGuid
(
guid
);
}
...
...
@@ -220,9 +220,9 @@ public class EntityLineageService implements AtlasLineageService {
private
void
processEdge
(
final
AtlasEdge
edge
,
final
Map
<
String
,
AtlasEntityHeader
>
entities
,
final
Set
<
LineageRelation
>
relations
)
throws
AtlasBaseException
{
AtlasVertex
inVertex
=
edge
.
getInVertex
();
AtlasVertex
outVertex
=
edge
.
getOutVertex
();
String
inGuid
=
AtlasGraphUtilsV
1
.
getIdFromVertex
(
inVertex
);
String
outGuid
=
AtlasGraphUtilsV
1
.
getIdFromVertex
(
outVertex
);
String
relationGuid
=
AtlasGraphUtilsV
1
.
getProperty
(
edge
,
Constants
.
RELATIONSHIP_GUID_PROPERTY_KEY
,
String
.
class
);
String
inGuid
=
AtlasGraphUtilsV
2
.
getIdFromVertex
(
inVertex
);
String
outGuid
=
AtlasGraphUtilsV
2
.
getIdFromVertex
(
outVertex
);
String
relationGuid
=
AtlasGraphUtilsV
2
.
getProperty
(
edge
,
Constants
.
RELATIONSHIP_GUID_PROPERTY_KEY
,
String
.
class
);
boolean
isInputEdge
=
edge
.
getLabel
().
equalsIgnoreCase
(
PROCESS_INPUTS_EDGE
);
if
(!
entities
.
containsKey
(
inGuid
))
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/FullTextSearchProcessor.java
View file @
3d5b4880
...
...
@@ -22,7 +22,7 @@ import org.apache.atlas.model.instance.AtlasEntity;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.graphdb.AtlasIndexQuery
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.atlas.utils.AtlasPerfTracer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -124,7 +124,7 @@ public class FullTextSearchProcessor extends SearchProcessor {
AtlasVertex
vertex
=
idxQueryResult
.
next
().
getVertex
();
// skip non-entity vertices
if
(!
AtlasGraphUtilsV
1
.
isEntityVertex
(
vertex
))
{
if
(!
AtlasGraphUtilsV
2
.
isEntityVertex
(
vertex
))
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"FullTextSearchProcessor.execute(): ignoring non-entity vertex (id={})"
,
vertex
.
getId
());
}
...
...
@@ -132,7 +132,7 @@ public class FullTextSearchProcessor extends SearchProcessor {
continue
;
}
if
(
activeOnly
&&
AtlasGraphUtilsV
1
.
getState
(
vertex
)
!=
AtlasEntity
.
Status
.
ACTIVE
)
{
if
(
activeOnly
&&
AtlasGraphUtilsV
2
.
getState
(
vertex
)
!=
AtlasEntity
.
Status
.
ACTIVE
)
{
continue
;
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/SearchContext.java
View file @
3d5b4880
...
...
@@ -30,7 +30,7 @@ import org.apache.atlas.repository.graphdb.AtlasEdge;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.graphdb.AtlasGraphQuery
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasStructType
;
...
...
@@ -238,7 +238,7 @@ public class SearchContext {
AtlasEdge
edge
=
edges
.
next
();
AtlasVertex
inVertex
=
edge
.
getInVertex
();
if
(
excludeDeletedEntities
&&
AtlasGraphUtilsV
1
.
getState
(
inVertex
)
==
AtlasEntity
.
Status
.
DELETED
)
{
if
(
excludeDeletedEntities
&&
AtlasGraphUtilsV
2
.
getState
(
inVertex
)
==
AtlasEntity
.
Status
.
DELETED
)
{
continue
;
}
ret
.
add
(
inVertex
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
View file @
3d5b4880
...
...
@@ -28,7 +28,7 @@ import org.apache.atlas.repository.Constants;
import
org.apache.atlas.repository.graphdb.AtlasGraphQuery
;
import
org.apache.atlas.repository.graphdb.AtlasIndexQuery
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.atlas.type.AtlasArrayType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasEnumType
;
...
...
@@ -68,7 +68,7 @@ public abstract class SearchProcessor {
public
static
final
int
MAX_RESULT_SIZE
=
getApplicationProperty
(
Constants
.
INDEX_SEARCH_MAX_RESULT_SET_SIZE
,
150
);
public
static
final
int
MAX_QUERY_STR_LENGTH_TYPES
=
getApplicationProperty
(
Constants
.
INDEX_SEARCH_TYPES_MAX_QUERY_STR_LENGTH
,
512
);
public
static
final
int
MAX_QUERY_STR_LENGTH_TAGS
=
getApplicationProperty
(
Constants
.
INDEX_SEARCH_TAGS_MAX_QUERY_STR_LENGTH
,
512
);
public
static
final
String
INDEX_SEARCH_PREFIX
=
AtlasGraphUtilsV
1
.
getIndexSearchPrefix
();
public
static
final
String
INDEX_SEARCH_PREFIX
=
AtlasGraphUtilsV
2
.
getIndexSearchPrefix
();
public
static
final
String
AND_STR
=
" AND "
;
public
static
final
String
EMPTY_STRING
=
""
;
public
static
final
String
SPACE_STRING
=
" "
;
...
...
@@ -784,7 +784,7 @@ public abstract class SearchProcessor {
if
(
vertices
!=
null
)
{
for
(
AtlasVertex
vertex
:
vertices
)
{
String
guid
=
AtlasGraphUtilsV
1
.
getIdFromVertex
(
vertex
);
String
guid
=
AtlasGraphUtilsV
2
.
getIdFromVertex
(
vertex
);
if
(
StringUtils
.
isNotEmpty
(
guid
))
{
ret
.
add
(
guid
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/glossary/GlossaryService.java
View file @
3d5b4880
...
...
@@ -31,8 +31,8 @@ import org.apache.atlas.model.instance.AtlasRelatedObjectId;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.ogm.DataAccess
;
import
org.apache.atlas.repository.store.graph.AtlasRelationshipStore
;
import
org.apache.atlas.repository.store.graph.v
1
.AtlasEntityChangeNotifier
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
2
.AtlasEntityChangeNotifier
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -94,7 +94,7 @@ public class GlossaryService {
LOG
.
debug
(
"==> GlossaryService.getGlossaries({}, {}, {})"
,
limit
,
offset
,
sortOrder
);
}
List
<
String
>
glossaryGuids
=
AtlasGraphUtilsV
1
.
findEntityGUIDsByType
(
GlossaryUtils
.
ATLAS_GLOSSARY_TYPENAME
,
sortOrder
);
List
<
String
>
glossaryGuids
=
AtlasGraphUtilsV
2
.
findEntityGUIDsByType
(
GlossaryUtils
.
ATLAS_GLOSSARY_TYPENAME
,
sortOrder
);
PaginationHelper
paginationHelper
=
new
PaginationHelper
<>(
glossaryGuids
,
offset
,
limit
);
List
<
AtlasGlossary
>
ret
;
...
...
@@ -916,21 +916,21 @@ public class GlossaryService {
}
private
boolean
glossaryExists
(
AtlasGlossary
atlasGlossary
)
{
AtlasVertex
vertex
=
AtlasGraphUtilsV
1
.
findByUniqueAttributes
(
atlasTypeRegistry
.
getEntityTypeByName
(
GlossaryUtils
.
ATLAS_GLOSSARY_TYPENAME
),
new
HashMap
<
String
,
Object
>()
{{
AtlasVertex
vertex
=
AtlasGraphUtilsV
2
.
findByUniqueAttributes
(
atlasTypeRegistry
.
getEntityTypeByName
(
GlossaryUtils
.
ATLAS_GLOSSARY_TYPENAME
),
new
HashMap
<
String
,
Object
>()
{{
put
(
QUALIFIED_NAME_ATTR
,
atlasGlossary
.
getQualifiedName
());
}});
return
Objects
.
nonNull
(
vertex
);
}
private
boolean
termExists
(
AtlasGlossaryTerm
term
)
{
AtlasVertex
vertex
=
AtlasGraphUtilsV
1
.
findByUniqueAttributes
(
atlasTypeRegistry
.
getEntityTypeByName
(
GlossaryUtils
.
ATLAS_GLOSSARY_TERM_TYPENAME
),
new
HashMap
<
String
,
Object
>()
{{
AtlasVertex
vertex
=
AtlasGraphUtilsV
2
.
findByUniqueAttributes
(
atlasTypeRegistry
.
getEntityTypeByName
(
GlossaryUtils
.
ATLAS_GLOSSARY_TERM_TYPENAME
),
new
HashMap
<
String
,
Object
>()
{{
put
(
QUALIFIED_NAME_ATTR
,
term
.
getQualifiedName
());
}});
return
Objects
.
nonNull
(
vertex
);
}
private
boolean
categoryExists
(
AtlasGlossaryCategory
category
)
{
AtlasVertex
vertex
=
AtlasGraphUtilsV
1
.
findByUniqueAttributes
(
atlasTypeRegistry
.
getEntityTypeByName
(
GlossaryUtils
.
ATLAS_GLOSSARY_CATEGORY_TYPENAME
),
new
HashMap
<
String
,
Object
>()
{{
AtlasVertex
vertex
=
AtlasGraphUtilsV
2
.
findByUniqueAttributes
(
atlasTypeRegistry
.
getEntityTypeByName
(
GlossaryUtils
.
ATLAS_GLOSSARY_CATEGORY_TYPENAME
),
new
HashMap
<
String
,
Object
>()
{{
put
(
QUALIFIED_NAME_ATTR
,
category
.
getQualifiedName
());
}});
return
Objects
.
nonNull
(
vertex
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListener.java
View file @
3d5b4880
...
...
@@ -21,7 +21,7 @@ package org.apache.atlas.repository.audit;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.EntityAuditEvent
;
import
org.apache.atlas.EntityAuditEvent.EntityAuditAction
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.listener.EntityChangeListener
;
import
org.apache.atlas.model.glossary.AtlasGlossaryTerm
;
import
org.apache.atlas.v1.model.instance.Referenceable
;
...
...
@@ -166,7 +166,7 @@ public class EntityAuditListener implements EntityChangeListener {
private
EntityAuditEvent
createEvent
(
Referenceable
entity
,
EntityAuditAction
action
,
String
details
)
throws
AtlasException
{
return
new
EntityAuditEvent
(
entity
.
getId
().
_getId
(),
RequestContext
V1
.
get
().
getRequestTime
(),
RequestContextV1
.
get
().
getUser
(),
action
,
details
,
entity
);
return
new
EntityAuditEvent
(
entity
.
getId
().
_getId
(),
RequestContext
.
get
().
getRequestTime
(),
RequestContext
.
get
().
getUser
(),
action
,
details
,
entity
);
}
private
String
getAuditEventDetail
(
Referenceable
entity
,
EntityAuditAction
action
)
throws
AtlasException
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/audit/EntityAuditListenerV2.java
View file @
3d5b4880
...
...
@@ -18,7 +18,7 @@
package
org
.
apache
.
atlas
.
repository
.
audit
;
import
org.apache.atlas.EntityAuditEvent.EntityAuditAction
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.model.audit.EntityAuditEventV2
;
import
org.apache.atlas.model.audit.EntityAuditEventV2.EntityAuditActionV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -211,8 +211,8 @@ public class EntityAuditListenerV2 implements EntityChangeListenerV2 {
}
private
EntityAuditEventV2
createEvent
(
AtlasEntity
entity
,
EntityAuditActionV2
action
,
String
details
)
{
return
new
EntityAuditEventV2
(
entity
.
getGuid
(),
RequestContext
V1
.
get
().
getRequestTime
(),
RequestContext
V1
.
get
().
getUser
(),
action
,
details
,
entity
);
return
new
EntityAuditEventV2
(
entity
.
getGuid
(),
RequestContext
.
get
().
getRequestTime
(),
RequestContext
.
get
().
getUser
(),
action
,
details
,
entity
);
}
private
EntityAuditEventV2
createEvent
(
AtlasEntity
entity
,
EntityAuditActionV2
action
)
{
...
...
@@ -249,13 +249,13 @@ public class EntityAuditListenerV2 implements EntityChangeListenerV2 {
}
private
boolean
isPropagatedClassificationAdded
(
String
guid
,
AtlasClassification
classification
)
{
Map
<
String
,
List
<
AtlasClassification
>>
addedPropagations
=
RequestContext
V1
.
get
().
getAddedPropagations
();
Map
<
String
,
List
<
AtlasClassification
>>
addedPropagations
=
RequestContext
.
get
().
getAddedPropagations
();
return
hasPropagatedEntry
(
addedPropagations
,
guid
,
classification
);
}
private
boolean
isPropagatedClassificationDeleted
(
String
guid
,
AtlasClassification
classification
)
{
Map
<
String
,
List
<
AtlasClassification
>>
removedPropagations
=
RequestContext
V1
.
get
().
getRemovedPropagations
();
Map
<
String
,
List
<
AtlasClassification
>>
removedPropagations
=
RequestContext
.
get
().
getRemovedPropagations
();
return
hasPropagatedEntry
(
removedPropagations
,
guid
,
classification
);
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
View file @
3d5b4880
...
...
@@ -21,7 +21,7 @@ import org.apache.atlas.AtlasErrorCode;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.CreateUpdateEntitiesResult
;
import
org.apache.atlas.EntityAuditEvent
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.model.audit.EntityAuditEventV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
...
...
@@ -33,7 +33,7 @@ import org.apache.atlas.model.instance.EntityMutationResponse;
import
org.apache.atlas.model.instance.EntityMutations.EntityOperation
;
import
org.apache.atlas.model.instance.GuidMapping
;
import
org.apache.atlas.model.legacy.EntityResult
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityGraphRetriever
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityGraphRetriever
;
import
org.apache.atlas.v1.model.instance.Referenceable
;
import
org.apache.atlas.v1.model.instance.Struct
;
import
org.apache.atlas.repository.converters.AtlasFormatConverter.ConverterContext
;
...
...
@@ -293,7 +293,7 @@ public class AtlasInstanceConverter {
public
AtlasEntity
.
AtlasEntityWithExtInfo
getAndCacheEntity
(
String
guid
)
throws
AtlasBaseException
{
RequestContext
V1
context
=
RequestContextV1
.
get
();
RequestContext
context
=
RequestContext
.
get
();
AtlasEntity
.
AtlasEntityWithExtInfo
entityWithExtInfo
=
context
.
getInstanceV2
(
guid
);
if
(
entityWithExtInfo
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java
View file @
3d5b4880
...
...
@@ -44,7 +44,7 @@ import org.apache.atlas.v1.model.typedef.Multiplicity;
import
org.apache.atlas.v1.model.typedef.StructTypeDefinition
;
import
org.apache.atlas.v1.model.typedef.TraitTypeDefinition
;
import
org.apache.atlas.v1.model.typedef.TypesDef
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasStructDefStoreV1
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasStructDefStoreV2
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasEnumType
;
...
...
@@ -360,7 +360,7 @@ public final class TypeConverterUtil {
for
(
AtlasAttributeDef
attrDef
:
attrDefs
)
{
AtlasAttribute
attribute
=
structType
.
getAttribute
(
attrDef
.
getName
());
AttributeDefinition
oldAttrDef
=
AtlasStructDefStoreV
1
.
toAttributeDefinition
(
attribute
);
AttributeDefinition
oldAttrDef
=
AtlasStructDefStoreV
2
.
toAttributeDefinition
(
attribute
);
ret
.
add
(
new
AttributeDefinition
(
oldAttrDef
.
getName
(),
oldAttrDef
.
getDataTypeName
(),
new
Multiplicity
(
oldAttrDef
.
getMultiplicity
()),
oldAttrDef
.
getIsComposite
(),
oldAttrDef
.
getIsUnique
(),
oldAttrDef
.
getIsIndexable
(),
oldAttrDef
.
getReverseAttributeName
()));
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java
View file @
3d5b4880
...
...
@@ -17,7 +17,7 @@
*/
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
...
@@ -25,7 +25,7 @@ import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityExtInfo;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityGraphRetriever
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityGraphRetriever
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
...
...
@@ -203,7 +203,7 @@ public class FullTextMapperV2 {
}
private
AtlasEntityWithExtInfo
getAndCacheEntity
(
String
guid
)
throws
AtlasBaseException
{
RequestContext
V1
context
=
RequestContextV1
.
get
();
RequestContext
context
=
RequestContext
.
get
();
AtlasEntityWithExtInfo
entityWithExtInfo
=
context
.
getInstanceV2
(
guid
);
if
(
entityWithExtInfo
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
View file @
3d5b4880
...
...
@@ -42,7 +42,6 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
import
org.apache.atlas.repository.graphdb.AtlasGraphIndex
;
import
org.apache.atlas.repository.graphdb.AtlasGraphManagement
;
import
org.apache.atlas.repository.graphdb.AtlasPropertyKey
;
import
org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1
;
import
org.apache.atlas.type.AtlasArrayType
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasEntityType
;
...
...
@@ -75,7 +74,7 @@ import static org.apache.atlas.repository.Constants.*;
import
static
org
.
apache
.
atlas
.
repository
.
graphdb
.
AtlasCardinality
.
LIST
;
import
static
org
.
apache
.
atlas
.
repository
.
graphdb
.
AtlasCardinality
.
SET
;
import
static
org
.
apache
.
atlas
.
repository
.
graphdb
.
AtlasCardinality
.
SINGLE
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
isReference
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
isReference
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasTypeUtil
.
isArrayType
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasTypeUtil
.
isMapType
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
View file @
3d5b4880
...
...
@@ -24,13 +24,14 @@ import com.google.common.collect.HashBiMap;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasEntity.Status
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasRelationship
;
import
org.apache.atlas.model.typedef.AtlasRelationshipDef
;
import
org.apache.atlas.repository.graphdb.AtlasVertexQuery
;
import
org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2
;
import
org.apache.atlas.type.AtlasArrayType
;
import
org.apache.atlas.type.AtlasMapType
;
import
org.apache.atlas.util.AtlasGremlinQueryProvider
;
...
...
@@ -47,7 +48,6 @@ import org.apache.atlas.repository.graphdb.AtlasElement;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.graphdb.AtlasGraphQuery
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasRelationshipType
;
import
org.apache.atlas.type.AtlasType
;
...
...
@@ -86,7 +86,7 @@ import static org.apache.atlas.repository.Constants.CLASSIFICATION_EDGE_NAME_PRO
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
CLASSIFICATION_VERTEX_NAME_KEY
;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
CLASSIFICATION_VERTEX_PROPAGATE_KEY
;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
PROPAGATED_TRAIT_NAMES_PROPERTY_KEY
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
isReference
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
isReference
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasStructType
.
AtlasAttribute
.
AtlasRelationshipEdgeDirection
.
BOTH
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasStructType
.
AtlasAttribute
.
AtlasRelationshipEdgeDirection
.
IN
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasStructType
.
AtlasAttribute
.
AtlasRelationshipEdgeDirection
.
OUT
;
...
...
@@ -185,12 +185,12 @@ public final class GraphHelper {
setProperty
(
vertexWithoutIdentity
,
Constants
.
STATE_PROPERTY_KEY
,
Id
.
EntityState
.
ACTIVE
.
name
());
// add timestamp information
setProperty
(
vertexWithoutIdentity
,
Constants
.
TIMESTAMP_PROPERTY_KEY
,
RequestContext
V1
.
get
().
getRequestTime
());
setProperty
(
vertexWithoutIdentity
,
Constants
.
TIMESTAMP_PROPERTY_KEY
,
RequestContext
.
get
().
getRequestTime
());
setProperty
(
vertexWithoutIdentity
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContextV1
.
get
().
getRequestTime
());
RequestContext
.
get
().
getRequestTime
());
setProperty
(
vertexWithoutIdentity
,
Constants
.
CREATED_BY_KEY
,
RequestContext
V1
.
get
().
getUser
());
setProperty
(
vertexWithoutIdentity
,
Constants
.
MODIFIED_BY_KEY
,
RequestContext
V1
.
get
().
getUser
());
setProperty
(
vertexWithoutIdentity
,
Constants
.
CREATED_BY_KEY
,
RequestContext
.
get
().
getUser
());
setProperty
(
vertexWithoutIdentity
,
Constants
.
MODIFIED_BY_KEY
,
RequestContext
.
get
().
getUser
());
return
vertexWithoutIdentity
;
}
...
...
@@ -198,8 +198,8 @@ public final class GraphHelper {
AtlasEdge
ret
=
addEdge
(
entityVertex
,
classificationVertex
,
CLASSIFICATION_LABEL
);
if
(
ret
!=
null
)
{
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
CLASSIFICATION_EDGE_NAME_PROPERTY_KEY
,
getTypeName
(
classificationVertex
));
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
CLASSIFICATION_EDGE_IS_PROPAGATED_PROPERTY_KEY
,
isPropagated
);
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
CLASSIFICATION_EDGE_NAME_PROPERTY_KEY
,
getTypeName
(
classificationVertex
));
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
CLASSIFICATION_EDGE_IS_PROPAGATED_PROPERTY_KEY
,
isPropagated
);
}
return
ret
;
...
...
@@ -216,10 +216,10 @@ public final class GraphHelper {
if
(
ret
!=
null
)
{
setProperty
(
ret
,
Constants
.
STATE_PROPERTY_KEY
,
Id
.
EntityState
.
ACTIVE
.
name
());
setProperty
(
ret
,
Constants
.
TIMESTAMP_PROPERTY_KEY
,
RequestContext
V1
.
get
().
getRequestTime
());
setProperty
(
ret
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContext
V1
.
get
().
getRequestTime
());
setProperty
(
ret
,
Constants
.
CREATED_BY_KEY
,
RequestContext
V1
.
get
().
getUser
());
setProperty
(
ret
,
Constants
.
MODIFIED_BY_KEY
,
RequestContext
V1
.
get
().
getUser
());
setProperty
(
ret
,
Constants
.
TIMESTAMP_PROPERTY_KEY
,
RequestContext
.
get
().
getRequestTime
());
setProperty
(
ret
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContext
.
get
().
getRequestTime
());
setProperty
(
ret
,
Constants
.
CREATED_BY_KEY
,
RequestContext
.
get
().
getUser
());
setProperty
(
ret
,
Constants
.
MODIFIED_BY_KEY
,
RequestContext
.
get
().
getUser
());
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Added {}"
,
string
(
ret
));
...
...
@@ -376,7 +376,7 @@ public final class GraphHelper {
boolean
ret
=
false
;
if
(
classificationVertex
!=
null
)
{
Boolean
enabled
=
AtlasGraphUtilsV
1
.
getProperty
(
classificationVertex
,
CLASSIFICATION_VERTEX_PROPAGATE_KEY
,
Boolean
.
class
);
Boolean
enabled
=
AtlasGraphUtilsV
2
.
getProperty
(
classificationVertex
,
CLASSIFICATION_VERTEX_PROPAGATE_KEY
,
Boolean
.
class
);
ret
=
(
enabled
==
null
)
?
true
:
enabled
;
}
...
...
@@ -433,7 +433,7 @@ public final class GraphHelper {
AtlasVertex
classificationVertex
=
(
edge
!=
null
)
?
edge
.
getInVertex
()
:
null
;
if
(
classificationVertex
!=
null
)
{
String
guid
=
AtlasGraphUtilsV
1
.
getProperty
(
classificationVertex
,
CLASSIFICATION_ENTITY_GUID
,
String
.
class
);
String
guid
=
AtlasGraphUtilsV
2
.
getProperty
(
classificationVertex
,
CLASSIFICATION_ENTITY_GUID
,
String
.
class
);
if
(
StringUtils
.
equals
(
guid
,
associatedEntityGuid
))
{
ret
=
edge
;
...
...
@@ -960,8 +960,8 @@ public final class GraphHelper {
}
public
static
void
updateModificationMetadata
(
AtlasVertex
vertex
)
{
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContextV1
.
get
().
getRequestTime
());
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
Constants
.
MODIFIED_BY_KEY
,
RequestContextV1
.
get
().
getUser
());
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContext
.
get
().
getRequestTime
());
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
Constants
.
MODIFIED_BY_KEY
,
RequestContext
.
get
().
getUser
());
}
public
static
String
getQualifiedNameForMapKey
(
String
prefix
,
String
key
)
{
...
...
@@ -1000,7 +1000,7 @@ public final class GraphHelper {
while
(
iterator
.
hasNext
())
{
AtlasEdge
edge
=
iterator
.
next
();
ret
.
add
(
AtlasGraphUtilsV
1
.
getProperty
(
edge
,
CLASSIFICATION_EDGE_NAME_PROPERTY_KEY
,
String
.
class
));
ret
.
add
(
AtlasGraphUtilsV
2
.
getProperty
(
edge
,
CLASSIFICATION_EDGE_NAME_PROPERTY_KEY
,
String
.
class
));
}
}
...
...
@@ -1168,11 +1168,11 @@ public final class GraphHelper {
}
public
static
String
getClassificationName
(
AtlasVertex
classificationVertex
)
{
return
AtlasGraphUtilsV
1
.
getProperty
(
classificationVertex
,
CLASSIFICATION_VERTEX_NAME_KEY
,
String
.
class
);
return
AtlasGraphUtilsV
2
.
getProperty
(
classificationVertex
,
CLASSIFICATION_VERTEX_NAME_KEY
,
String
.
class
);
}
public
static
String
getClassificationEntityGuid
(
AtlasVertex
classificationVertex
)
{
return
AtlasGraphUtilsV
1
.
getProperty
(
classificationVertex
,
CLASSIFICATION_ENTITY_GUID
,
String
.
class
);
return
AtlasGraphUtilsV
2
.
getProperty
(
classificationVertex
,
CLASSIFICATION_ENTITY_GUID
,
String
.
class
);
}
public
static
Integer
getIndexValue
(
AtlasEdge
edge
)
{
...
...
@@ -1198,7 +1198,7 @@ public final class GraphHelper {
List
<
String
>
ret
=
null
;
if
(
edge
!=
null
)
{
List
<
String
>
classificationIds
=
AtlasGraphUtilsV
1
.
getProperty
(
edge
,
Constants
.
RELATIONSHIPTYPE_BLOCKED_PROPAGATED_CLASSIFICATIONS_KEY
,
List
.
class
);
List
<
String
>
classificationIds
=
AtlasGraphUtilsV
2
.
getProperty
(
edge
,
Constants
.
RELATIONSHIPTYPE_BLOCKED_PROPAGATED_CLASSIFICATIONS_KEY
,
List
.
class
);
ret
=
CollectionUtils
.
isNotEmpty
(
classificationIds
)
?
classificationIds
:
Collections
.
emptyList
();
}
...
...
@@ -1825,7 +1825,7 @@ public final class GraphHelper {
Iterator
<
AtlasEdge
>
iter
=
entityVertex
.
getEdges
(
AtlasEdgeDirection
.
IN
).
iterator
();
while
(
iter
.
hasNext
()
&&
ret
==
null
)
{
String
edgeTypeName
=
AtlasGraphUtilsV
1
.
getTypeName
(
iter
.
next
());
String
edgeTypeName
=
AtlasGraphUtilsV
2
.
getTypeName
(
iter
.
next
());
for
(
AtlasRelationshipType
relationType
:
relationshipTypes
)
{
AtlasRelationshipDef
relationshipDef
=
relationType
.
getRelationshipDef
();
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
View file @
3d5b4880
...
...
@@ -37,7 +37,7 @@ import org.apache.atlas.model.typedef.AtlasStructDef;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityGraphRetriever
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityGraphRetriever
;
import
org.apache.atlas.type.AtlasArrayType
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasEntityType
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java
View file @
3d5b4880
...
...
@@ -22,7 +22,7 @@ import org.apache.atlas.model.impexp.AtlasExportResult;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityImportStream
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityImportStream
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/ogm/DataAccess.java
View file @
3d5b4880
...
...
@@ -24,7 +24,7 @@ import org.apache.atlas.model.instance.AtlasEntity;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo
;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.v
1
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v
2
.AtlasEntityStream
;
import
org.apache.atlas.utils.AtlasPerfTracer
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityStore.java
View file @
3d5b4880
...
...
@@ -23,7 +23,7 @@ import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityStream
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityStream
;
import
org.apache.atlas.type.AtlasEntityType
;
import
java.util.List
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/BulkImporter.java
View file @
3d5b4880
...
...
@@ -20,7 +20,7 @@ package org.apache.atlas.repository.store.graph;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.impexp.AtlasImportResult
;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityImportStream
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityImportStream
;
public
interface
BulkImporter
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/EntityGraphDiscovery.java
View file @
3d5b4880
...
...
@@ -20,10 +20,6 @@ package org.apache.atlas.repository.store.graph;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.repository.store.graph.v1.AtlasEntityStream
;
import
java.util.List
;
import
java.util.Map
;
public
interface
EntityGraphDiscovery
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/EntityGraphDiscoveryContext.java
View file @
3d5b4880
...
...
@@ -20,7 +20,7 @@ package org.apache.atlas.repository.store.graph;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityStream
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityStream
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.slf4j.Logger
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
View file @
3d5b4880
...
...
@@ -20,7 +20,7 @@ package org.apache.atlas.repository.store.graph.v1;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.instance.AtlasClassification
;
...
...
@@ -35,6 +35,8 @@ import org.apache.atlas.repository.graph.GraphHelper;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
import
org.apache.atlas.repository.graphdb.AtlasEdgeDirection
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2
;
import
org.apache.atlas.repository.store.graph.v2.EntityGraphRetriever
;
import
org.apache.atlas.type.AtlasArrayType
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasEntityType
;
...
...
@@ -61,10 +63,10 @@ import static org.apache.atlas.repository.Constants.CLASSIFICATION_LABEL;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
PROPAGATED_TRAIT_NAMES_PROPERTY_KEY
;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
RELATIONSHIP_GUID_PROPERTY_KEY
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.*;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
getIdFromEdge
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
getQualifiedAttributePropertyKey
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
getState
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
isReference
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
getIdFromEdge
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
getQualifiedAttributePropertyKey
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
getState
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
isReference
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasStructType
.
AtlasAttribute
.
AtlasRelationshipEdgeDirection
.
OUT
;
public
abstract
class
DeleteHandlerV1
{
...
...
@@ -91,11 +93,11 @@ public abstract class DeleteHandlerV1 {
* @throws AtlasException
*/
public
void
deleteEntities
(
Collection
<
AtlasVertex
>
instanceVertices
)
throws
AtlasBaseException
{
RequestContext
V1
requestContext
=
RequestContextV1
.
get
();
RequestContext
requestContext
=
RequestContext
.
get
();
Set
<
AtlasVertex
>
deletionCandidateVertices
=
new
HashSet
<>();
for
(
AtlasVertex
instanceVertex
:
instanceVertices
)
{
String
guid
=
AtlasGraphUtilsV
1
.
getIdFromVertex
(
instanceVertex
);
String
guid
=
AtlasGraphUtilsV
2
.
getIdFromVertex
(
instanceVertex
);
AtlasEntity
.
Status
state
=
getState
(
instanceVertex
);
if
(
state
==
DELETED
||
requestContext
.
isDeletedEntity
(
guid
))
{
...
...
@@ -295,7 +297,7 @@ public abstract class DeleteHandlerV1 {
AtlasVertex
referencedVertex
=
entityRetriever
.
getReferencedEntityVertex
(
edge
,
relationshipDirection
,
entityVertex
);
if
(
referencedVertex
!=
null
)
{
RequestContext
V1
requestContext
=
RequestContextV1
.
get
();
RequestContext
requestContext
=
RequestContext
.
get
();
if
(!
requestContext
.
isUpdatedEntity
(
GraphHelper
.
getGuid
(
referencedVertex
)))
{
GraphHelper
.
setProperty
(
referencedVertex
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
requestContext
.
getRequestTime
());
...
...
@@ -407,7 +409,7 @@ public abstract class DeleteHandlerV1 {
addToPropagatedTraitNames
(
propagatedEntityVertex
,
classificationName
);
// record add propagation details to send notifications at the end
RequestContext
V1
context
=
RequestContextV1
.
get
();
RequestContext
context
=
RequestContext
.
get
();
AtlasClassification
classification
=
entityRetriever
.
toAtlasClassification
(
classificationVertex
);
context
.
recordAddedPropagation
(
entityGuid
,
classification
);
...
...
@@ -475,7 +477,7 @@ public abstract class DeleteHandlerV1 {
ret
.
add
(
entityVertex
);
// record remove propagation details to send notifications at the end
RequestContext
V1
.
get
().
recordRemovedPropagation
(
getGuid
(
entityVertex
),
classification
);
RequestContext
.
get
().
recordRemovedPropagation
(
getGuid
(
entityVertex
),
classification
);
deletePropagatedEdge
(
propagatedEdge
);
}
...
...
@@ -490,7 +492,7 @@ public abstract class DeleteHandlerV1 {
String
classificationName
=
getClassificationName
(
classificationVertex
);
AtlasClassification
classification
=
entityRetriever
.
toAtlasClassification
(
classificationVertex
);
String
entityGuid
=
getClassificationEntityGuid
(
classificationVertex
);
RequestContext
V1
context
=
RequestContextV1
.
get
();
RequestContext
context
=
RequestContext
.
get
();
for
(
AtlasVertex
entityVertex
:
entityVertices
)
{
AtlasEdge
propagatedEdge
=
getPropagatedClassificationEdge
(
entityVertex
,
classificationName
,
entityGuid
);
...
...
@@ -575,7 +577,7 @@ public abstract class DeleteHandlerV1 {
}
public
void
deletePropagatedEdge
(
AtlasEdge
edge
)
throws
AtlasBaseException
{
String
classificationName
=
AtlasGraphUtilsV
1
.
getProperty
(
edge
,
CLASSIFICATION_EDGE_NAME_PROPERTY_KEY
,
String
.
class
);
String
classificationName
=
AtlasGraphUtilsV
2
.
getProperty
(
edge
,
CLASSIFICATION_EDGE_NAME_PROPERTY_KEY
,
String
.
class
);
AtlasVertex
entityVertex
=
edge
.
getOutVertex
();
if
(
LOG
.
isDebugEnabled
())
{
...
...
@@ -738,7 +740,7 @@ public abstract class DeleteHandlerV1 {
final
String
outId
=
GraphHelper
.
getGuid
(
outVertex
);
final
Status
state
=
getState
(
outVertex
);
if
(
state
==
DELETED
||
(
outId
!=
null
&&
RequestContext
V1
.
get
().
isDeletedEntity
(
outId
)))
{
if
(
state
==
DELETED
||
(
outId
!=
null
&&
RequestContext
.
get
().
isDeletedEntity
(
outId
)))
{
//If the reference vertex is marked for deletion, skip updating the reference
return
;
}
...
...
@@ -832,7 +834,7 @@ public abstract class DeleteHandlerV1 {
if
(
edge
!=
null
)
{
deleteEdge
(
edge
,
isInternalType
(
inVertex
)
&&
isInternalType
(
outVertex
));
RequestContext
V1
requestContext
=
RequestContextV1
.
get
();
RequestContext
requestContext
=
RequestContext
.
get
();
if
(!
requestContext
.
isUpdatedEntity
(
outId
))
{
GraphHelper
.
setProperty
(
outVertex
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
requestContext
.
getRequestTime
());
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/SoftDeleteHandlerV1.java
View file @
3d5b4880
...
...
@@ -18,13 +18,14 @@
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v1
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.annotation.ConditionalOnAtlasProperty
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.repository.graph.GraphHelper
;
import
org.apache.atlas.repository.graphdb.AtlasEdge
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.springframework.stereotype.Component
;
...
...
@@ -52,12 +53,12 @@ public class SoftDeleteHandlerV1 extends DeleteHandlerV1 {
if
(
force
)
{
graphHelper
.
removeVertex
(
instanceVertex
);
}
else
{
AtlasEntity
.
Status
state
=
AtlasGraphUtilsV
1
.
getState
(
instanceVertex
);
AtlasEntity
.
Status
state
=
AtlasGraphUtilsV
2
.
getState
(
instanceVertex
);
if
(
state
!=
AtlasEntity
.
Status
.
DELETED
)
{
GraphHelper
.
setProperty
(
instanceVertex
,
STATE_PROPERTY_KEY
,
AtlasEntity
.
Status
.
DELETED
.
name
());
GraphHelper
.
setProperty
(
instanceVertex
,
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContext
V1
.
get
().
getRequestTime
());
GraphHelper
.
setProperty
(
instanceVertex
,
MODIFIED_BY_KEY
,
RequestContext
V1
.
get
().
getUser
());
GraphHelper
.
setProperty
(
instanceVertex
,
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContext
.
get
().
getRequestTime
());
GraphHelper
.
setProperty
(
instanceVertex
,
MODIFIED_BY_KEY
,
RequestContext
.
get
().
getUser
());
}
}
}
...
...
@@ -74,12 +75,12 @@ public class SoftDeleteHandlerV1 extends DeleteHandlerV1 {
if
(
force
)
{
graphHelper
.
removeEdge
(
edge
);
}
else
{
AtlasEntity
.
Status
state
=
AtlasGraphUtilsV
1
.
getState
(
edge
);
AtlasEntity
.
Status
state
=
AtlasGraphUtilsV
2
.
getState
(
edge
);
if
(
state
!=
AtlasEntity
.
Status
.
DELETED
)
{
GraphHelper
.
setProperty
(
edge
,
STATE_PROPERTY_KEY
,
AtlasEntity
.
Status
.
DELETED
.
name
());
GraphHelper
.
setProperty
(
edge
,
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContext
V1
.
get
().
getRequestTime
());
GraphHelper
.
setProperty
(
edge
,
MODIFIED_BY_KEY
,
RequestContext
V1
.
get
().
getUser
());
GraphHelper
.
setProperty
(
edge
,
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContext
.
get
().
getRequestTime
());
GraphHelper
.
setProperty
(
edge
,
MODIFIED_BY_KEY
,
RequestContext
.
get
().
getUser
());
}
}
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasAbstractDefStoreV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasAbstractDefStoreV2
.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasErrorCode
;
...
...
@@ -36,9 +36,10 @@ import java.util.regex.Pattern;
/**
* Abstract typedef-store for v1 format.
*/
abstract
class
AtlasAbstractDefStoreV1
<
T
extends
AtlasBaseTypeDef
>
implements
AtlasDefStore
<
T
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasAbstractDefStoreV1
.
class
);
protected
final
AtlasTypeDefGraphStoreV1
typeDefStore
;
abstract
class
AtlasAbstractDefStoreV2
<
T
extends
AtlasBaseTypeDef
>
implements
AtlasDefStore
<
T
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasAbstractDefStoreV2
.
class
);
protected
final
AtlasTypeDefGraphStoreV2
typeDefStore
;
protected
final
AtlasTypeRegistry
typeRegistry
;
private
static
final
String
NAME_REGEX
=
"[a-zA-Z][a-zA-Z0-9_ ]*"
;
...
...
@@ -48,7 +49,7 @@ import java.util.regex.Pattern;
public
static
final
String
ALLOW_RESERVED_KEYWORDS
=
"atlas.types.allowReservedKeywords"
;
public
AtlasAbstractDefStoreV
1
(
AtlasTypeDefGraphStoreV1
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
public
AtlasAbstractDefStoreV
2
(
AtlasTypeDefGraphStoreV2
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
this
.
typeDefStore
=
typeDefStore
;
this
.
typeRegistry
=
typeRegistry
;
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasClassificationDefStoreV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasClassificationDefStoreV2
.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasErrorCode
;
...
...
@@ -43,14 +43,14 @@ import java.util.regex.Pattern;
/**
* ClassificationDef store in v1 format.
*/
class
AtlasClassificationDefStoreV
1
extends
AtlasAbstractDefStoreV1
<
AtlasClassificationDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasClassificationDefStoreV
1
.
class
);
class
AtlasClassificationDefStoreV
2
extends
AtlasAbstractDefStoreV2
<
AtlasClassificationDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasClassificationDefStoreV
2
.
class
);
private
static
final
String
TRAIT_NAME_REGEX
=
"[a-zA-Z][a-zA-Z0-9_ .]*"
;
private
static
final
Pattern
TRAIT_NAME_PATTERN
=
Pattern
.
compile
(
TRAIT_NAME_REGEX
);
public
AtlasClassificationDefStoreV
1
(
AtlasTypeDefGraphStoreV1
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
public
AtlasClassificationDefStoreV
2
(
AtlasTypeDefGraphStoreV2
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
super
(
typeDefStore
,
typeRegistry
);
}
...
...
@@ -272,7 +272,7 @@ class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasClassif
AtlasVertex
ret
=
typeDefStore
.
findTypeVertexByNameAndCategory
(
name
,
TypeCategory
.
TRAIT
);
if
(
AtlasGraphUtilsV
1
.
typeHasInstanceVertex
(
name
))
{
if
(
AtlasGraphUtilsV
2
.
typeHasInstanceVertex
(
name
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_HAS_REFERENCES
,
name
);
}
...
...
@@ -301,9 +301,9 @@ class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasClassif
AtlasVertex
ret
=
typeDefStore
.
findTypeVertexByGuidAndCategory
(
guid
,
TypeCategory
.
TRAIT
);
String
typeName
=
AtlasGraphUtilsV
1
.
getProperty
(
ret
,
Constants
.
TYPENAME_PROPERTY_KEY
,
String
.
class
);
String
typeName
=
AtlasGraphUtilsV
2
.
getProperty
(
ret
,
Constants
.
TYPENAME_PROPERTY_KEY
,
String
.
class
);
if
(
AtlasGraphUtilsV
1
.
typeHasInstanceVertex
(
typeName
))
{
if
(
AtlasGraphUtilsV
2
.
typeHasInstanceVertex
(
typeName
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_HAS_REFERENCES
,
typeName
);
}
...
...
@@ -323,17 +323,17 @@ class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasClassif
private
void
updateVertexPreCreate
(
AtlasClassificationDef
classificationDef
,
AtlasClassificationType
classificationType
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
AtlasStructDefStoreV
1
.
updateVertexPreCreate
(
classificationDef
,
classificationType
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexPreCreate
(
classificationDef
,
classificationType
,
vertex
,
typeDefStore
);
}
private
void
updateVertexPreUpdate
(
AtlasClassificationDef
classificationDef
,
AtlasClassificationType
classificationType
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
AtlasStructDefStoreV
1
.
updateVertexPreUpdate
(
classificationDef
,
classificationType
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexPreUpdate
(
classificationDef
,
classificationType
,
vertex
,
typeDefStore
);
}
private
void
updateVertexAddReferences
(
AtlasClassificationDef
classificationDef
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
AtlasStructDefStoreV
1
.
updateVertexAddReferences
(
classificationDef
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexAddReferences
(
classificationDef
,
vertex
,
typeDefStore
);
typeDefStore
.
createSuperTypeEdges
(
vertex
,
classificationDef
.
getSuperTypes
(),
TypeCategory
.
TRAIT
);
// create edges from this vertex to entity Type vertices with the supplied entity type names
...
...
@@ -346,7 +346,7 @@ class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasClassif
if
(
vertex
!=
null
&&
typeDefStore
.
isTypeVertex
(
vertex
,
TypeCategory
.
TRAIT
))
{
ret
=
new
AtlasClassificationDef
();
AtlasStructDefStoreV
1
.
toStructDef
(
vertex
,
ret
,
typeDefStore
);
AtlasStructDefStoreV
2
.
toStructDef
(
vertex
,
ret
,
typeDefStore
);
ret
.
setSuperTypes
(
typeDefStore
.
getSuperTypeNames
(
vertex
));
ret
.
setEntityTypes
(
typeDefStore
.
getEntityTypeNames
(
vertex
));
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/AtlasEntityChangeNotifier.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/AtlasEntityChangeNotifier.java
View file @
3d5b4880
...
...
@@ -15,12 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.listener.EntityChangeListener
;
import
org.apache.atlas.listener.EntityChangeListenerV2
;
...
...
@@ -233,7 +233,7 @@ public class AtlasEntityChangeNotifier {
}
public
void
notifyPropagatedEntities
()
throws
AtlasBaseException
{
RequestContext
V1
context
=
RequestContextV1
.
get
();
RequestContext
context
=
RequestContext
.
get
();
Map
<
String
,
List
<
AtlasClassification
>>
addedPropagations
=
context
.
getAddedPropagations
();
Map
<
String
,
List
<
AtlasClassification
>>
removedPropagations
=
context
.
getRemovedPropagations
();
...
...
@@ -424,7 +424,7 @@ public class AtlasEntityChangeNotifier {
}
String
guid
=
entityHeader
.
getGuid
();
AtlasVertex
vertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
guid
);
AtlasVertex
vertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
guid
);
if
(
vertex
==
null
)
{
continue
;
...
...
@@ -453,7 +453,7 @@ public class AtlasEntityChangeNotifier {
return
;
}
AtlasVertex
atlasVertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
entityId
);
AtlasVertex
atlasVertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
entityId
);
if
(
atlasVertex
==
null
||
GraphHelper
.
isInternalType
(
atlasVertex
))
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasEntityDefStoreV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasEntityDefStoreV2
.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.authorize.AtlasPrivilege
;
...
...
@@ -41,11 +41,11 @@ import java.util.List;
/**
* EntityDef store in v1 format.
*/
public
class
AtlasEntityDefStoreV
1
extends
AtlasAbstractDefStoreV1
<
AtlasEntityDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEntityDefStoreV
1
.
class
);
public
class
AtlasEntityDefStoreV
2
extends
AtlasAbstractDefStoreV2
<
AtlasEntityDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEntityDefStoreV
2
.
class
);
@Inject
public
AtlasEntityDefStoreV
1
(
AtlasTypeDefGraphStoreV1
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
public
AtlasEntityDefStoreV
2
(
AtlasTypeDefGraphStoreV2
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
super
(
typeDefStore
,
typeRegistry
);
}
...
...
@@ -269,7 +269,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEntityDe
AtlasVertex
ret
=
typeDefStore
.
findTypeVertexByNameAndCategory
(
name
,
TypeCategory
.
CLASS
);
if
(
AtlasGraphUtilsV
1
.
typeHasInstanceVertex
(
name
))
{
if
(
AtlasGraphUtilsV
2
.
typeHasInstanceVertex
(
name
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_HAS_REFERENCES
,
name
);
}
...
...
@@ -278,7 +278,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEntityDe
}
// error if we are trying to delete an entityDef that has a relationshipDef
if
(
typeDefStore
.
hasIncomingEdgesWithLabel
(
ret
,
AtlasGraphUtilsV
1
.
RELATIONSHIPTYPE_EDGE_LABEL
)){
if
(
typeDefStore
.
hasIncomingEdgesWithLabel
(
ret
,
AtlasGraphUtilsV
2
.
RELATIONSHIPTYPE_EDGE_LABEL
)){
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_HAS_RELATIONSHIPS
,
name
);
}
...
...
@@ -303,9 +303,9 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEntityDe
AtlasVertex
ret
=
typeDefStore
.
findTypeVertexByGuidAndCategory
(
guid
,
TypeCategory
.
CLASS
);
String
typeName
=
AtlasGraphUtilsV
1
.
getProperty
(
ret
,
Constants
.
TYPENAME_PROPERTY_KEY
,
String
.
class
);
String
typeName
=
AtlasGraphUtilsV
2
.
getProperty
(
ret
,
Constants
.
TYPENAME_PROPERTY_KEY
,
String
.
class
);
if
(
AtlasGraphUtilsV
1
.
typeHasInstanceVertex
(
typeName
))
{
if
(
AtlasGraphUtilsV
2
.
typeHasInstanceVertex
(
typeName
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_HAS_REFERENCES
,
typeName
);
}
...
...
@@ -314,7 +314,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEntityDe
}
// error if we are trying to delete an entityDef that has a relationshipDef
if
(
typeDefStore
.
hasIncomingEdgesWithLabel
(
ret
,
AtlasGraphUtilsV
1
.
RELATIONSHIPTYPE_EDGE_LABEL
)){
if
(
typeDefStore
.
hasIncomingEdgesWithLabel
(
ret
,
AtlasGraphUtilsV
2
.
RELATIONSHIPTYPE_EDGE_LABEL
)){
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_HAS_RELATIONSHIPS
,
typeName
);
}
...
...
@@ -328,16 +328,16 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEntityDe
}
private
void
updateVertexPreCreate
(
AtlasEntityDef
entityDef
,
AtlasEntityType
entityType
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
AtlasStructDefStoreV
1
.
updateVertexPreCreate
(
entityDef
,
entityType
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexPreCreate
(
entityDef
,
entityType
,
vertex
,
typeDefStore
);
}
private
void
updateVertexPreUpdate
(
AtlasEntityDef
entityDef
,
AtlasEntityType
entityType
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
AtlasStructDefStoreV
1
.
updateVertexPreUpdate
(
entityDef
,
entityType
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexPreUpdate
(
entityDef
,
entityType
,
vertex
,
typeDefStore
);
}
private
void
updateVertexAddReferences
(
AtlasEntityDef
entityDef
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
AtlasStructDefStoreV
1
.
updateVertexAddReferences
(
entityDef
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexAddReferences
(
entityDef
,
vertex
,
typeDefStore
);
typeDefStore
.
createSuperTypeEdges
(
vertex
,
entityDef
.
getSuperTypes
(),
TypeCategory
.
CLASS
);
}
...
...
@@ -348,7 +348,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEntityDe
if
(
vertex
!=
null
&&
typeDefStore
.
isTypeVertex
(
vertex
,
TypeCategory
.
CLASS
))
{
ret
=
new
AtlasEntityDef
();
AtlasStructDefStoreV
1
.
toStructDef
(
vertex
,
ret
,
typeDefStore
);
AtlasStructDefStoreV
2
.
toStructDef
(
vertex
,
ret
,
typeDefStore
);
ret
.
setSuperTypes
(
typeDefStore
.
getSuperTypeNames
(
vertex
));
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasEntityGraphDiscoveryV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasEntityGraphDiscoveryV2
.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -47,13 +47,13 @@ import java.util.Map;
import
java.util.Set
;
public
class
AtlasEntityGraphDiscoveryV
1
implements
EntityGraphDiscovery
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEntityGraphDiscoveryV
1
.
class
);
public
class
AtlasEntityGraphDiscoveryV
2
implements
EntityGraphDiscovery
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEntityGraphDiscoveryV
2
.
class
);
private
final
AtlasTypeRegistry
typeRegistry
;
private
final
EntityGraphDiscoveryContext
discoveryContext
;
public
AtlasEntityGraphDiscoveryV
1
(
AtlasTypeRegistry
typeRegistry
,
EntityStream
entityStream
)
{
public
AtlasEntityGraphDiscoveryV
2
(
AtlasTypeRegistry
typeRegistry
,
EntityStream
entityStream
)
{
this
.
typeRegistry
=
typeRegistry
;
this
.
discoveryContext
=
new
EntityGraphDiscoveryContext
(
typeRegistry
,
entityStream
);
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasEntityStoreV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasEntityStoreV2
.java
View file @
3d5b4880
...
...
@@ -15,12 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.GraphTransactionInterceptor
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.annotation.GraphTransaction
;
import
org.apache.atlas.authorize.AtlasEntityAccessRequest
;
import
org.apache.atlas.authorize.AtlasPrivilege
;
...
...
@@ -33,6 +33,7 @@ import org.apache.atlas.repository.graphdb.AtlasVertex;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.EntityGraphDiscovery
;
import
org.apache.atlas.repository.store.graph.EntityGraphDiscoveryContext
;
import
org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasStructType.AtlasAttribute
;
...
...
@@ -43,7 +44,6 @@ import org.apache.atlas.utils.AtlasEntityUtil;
import
org.apache.atlas.utils.AtlasPerfTracer
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.configuration.Configuration
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -52,25 +52,24 @@ import org.springframework.stereotype.Component;
import
javax.inject.Inject
;
import
java.util.*
;
import
static
org
.
apache
.
atlas
.
AtlasConstants
.
ATLAS_MIGRATION_MODE_FILENAME
;
import
static
org
.
apache
.
atlas
.
model
.
instance
.
EntityMutations
.
EntityOperation
.
DELETE
;
import
static
org
.
apache
.
atlas
.
model
.
instance
.
EntityMutations
.
EntityOperation
.
UPDATE
;
@Component
public
class
AtlasEntityStoreV
1
implements
AtlasEntityStore
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEntityStoreV
1
.
class
);
public
class
AtlasEntityStoreV
2
implements
AtlasEntityStore
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEntityStoreV
2
.
class
);
private
static
final
Logger
PERF_LOG
=
AtlasPerfTracer
.
getPerfLogger
(
"store.EntityStore"
);
private
final
DeleteHandlerV1
deleteHandler
;
private
final
DeleteHandlerV1
deleteHandler
;
private
final
AtlasTypeRegistry
typeRegistry
;
private
final
AtlasEntityChangeNotifier
entityChangeNotifier
;
private
final
EntityGraphMapper
entityGraphMapper
;
private
final
EntityGraphRetriever
entityRetriever
;
@Inject
public
AtlasEntityStoreV
1
(
DeleteHandlerV1
deleteHandler
,
AtlasTypeRegistry
typeRegistry
,
public
AtlasEntityStoreV
2
(
DeleteHandlerV1
deleteHandler
,
AtlasTypeRegistry
typeRegistry
,
AtlasEntityChangeNotifier
entityChangeNotifier
,
EntityGraphMapper
entityGraphMapper
)
{
this
.
deleteHandler
=
deleteHandler
;
this
.
typeRegistry
=
typeRegistry
;
...
...
@@ -90,7 +89,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
UNKNOWN_TYPENAME
);
}
List
<
String
>
ret
=
AtlasGraphUtilsV
1
.
findEntityGUIDsByType
(
typename
);
List
<
String
>
ret
=
AtlasGraphUtilsV
2
.
findEntityGUIDsByType
(
typename
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== getEntityGUIDS({})"
,
typename
);
...
...
@@ -149,7 +148,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
LOG
.
debug
(
"==> getByUniqueAttribute({}, {})"
,
entityType
.
getTypeName
(),
uniqAttributes
);
}
AtlasVertex
entityVertex
=
AtlasGraphUtilsV
1
.
getVertexByUniqueAttributes
(
entityType
,
uniqAttributes
);
AtlasVertex
entityVertex
=
AtlasGraphUtilsV
2
.
getVertexByUniqueAttributes
(
entityType
,
uniqAttributes
);
AtlasEntityWithExtInfo
ret
=
entityRetriever
.
toAtlasEntityWithExtInfo
(
entityVertex
);
AtlasAuthorizationUtils
.
verifyAccess
(
new
AtlasEntityAccessRequest
(
typeRegistry
,
AtlasPrivilege
.
ENTITY_READ
,
new
AtlasEntityHeader
(
ret
.
getEntity
())),
"read entity: typeName="
,
entityType
.
getTypeName
(),
", uniqueAttributes="
,
uniqAttributes
);
...
...
@@ -195,7 +194,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
UNKNOWN_TYPENAME
,
objectId
.
getTypeName
());
}
guid
=
AtlasGraphUtilsV
1
.
getGuidByUniqueAttributes
(
typeRegistry
.
getEntityTypeByName
(
objectId
.
getTypeName
()),
objectId
.
getUniqueAttributes
());
guid
=
AtlasGraphUtilsV
2
.
getGuidByUniqueAttributes
(
typeRegistry
.
getEntityTypeByName
(
objectId
.
getTypeName
()),
objectId
.
getUniqueAttributes
());
}
AtlasEntity
entity
=
updatedEntityInfo
.
getEntity
();
...
...
@@ -217,7 +216,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_PARAMETERS
,
"no entity to update."
);
}
String
guid
=
AtlasGraphUtilsV
1
.
getGuidByUniqueAttributes
(
entityType
,
uniqAttributes
);
String
guid
=
AtlasGraphUtilsV
2
.
getGuidByUniqueAttributes
(
entityType
,
uniqAttributes
);
AtlasEntity
entity
=
updatedEntityInfo
.
getEntity
();
entity
.
setGuid
(
guid
);
...
...
@@ -278,7 +277,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
}
Collection
<
AtlasVertex
>
deletionCandidates
=
new
ArrayList
<>();
AtlasVertex
vertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
guid
);
AtlasVertex
vertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
guid
);
if
(
vertex
!=
null
)
{
AtlasEntityHeader
entityHeader
=
entityRetriever
.
toAtlasEntityHeaderWithClassifications
(
vertex
);
...
...
@@ -312,7 +311,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
Collection
<
AtlasVertex
>
deletionCandidates
=
new
ArrayList
<>();
for
(
String
guid
:
guids
)
{
AtlasVertex
vertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
guid
);
AtlasVertex
vertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
guid
);
if
(
vertex
==
null
)
{
if
(
LOG
.
isDebugEnabled
())
{
...
...
@@ -351,7 +350,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
}
Collection
<
AtlasVertex
>
deletionCandidates
=
new
ArrayList
<>();
AtlasVertex
vertex
=
AtlasGraphUtilsV
1
.
findByUniqueAttributes
(
entityType
,
uniqAttributes
);
AtlasVertex
vertex
=
AtlasGraphUtilsV
2
.
findByUniqueAttributes
(
entityType
,
uniqAttributes
);
if
(
vertex
!=
null
)
{
AtlasEntityHeader
entityHeader
=
entityRetriever
.
toAtlasEntityHeaderWithClassifications
(
vertex
);
...
...
@@ -378,7 +377,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
@Override
@GraphTransaction
public
String
getGuidByUniqueAttributes
(
AtlasEntityType
entityType
,
Map
<
String
,
Object
>
uniqAttributes
)
throws
AtlasBaseException
{
return
AtlasGraphUtilsV
1
.
getGuidByUniqueAttributes
(
entityType
,
uniqAttributes
);
return
AtlasGraphUtilsV
2
.
getGuidByUniqueAttributes
(
entityType
,
uniqAttributes
);
}
@Override
...
...
@@ -640,7 +639,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
}
private
EntityMutationContext
preCreateOrUpdate
(
EntityStream
entityStream
,
EntityGraphMapper
entityGraphMapper
,
boolean
isPartialUpdate
)
throws
AtlasBaseException
{
EntityGraphDiscovery
graphDiscoverer
=
new
AtlasEntityGraphDiscoveryV
1
(
typeRegistry
,
entityStream
);
EntityGraphDiscovery
graphDiscoverer
=
new
AtlasEntityGraphDiscoveryV
2
(
typeRegistry
,
entityStream
);
EntityGraphDiscoveryContext
discoveryContext
=
graphDiscoverer
.
discoverEntities
();
EntityMutationContext
context
=
new
EntityMutationContext
(
discoveryContext
);
...
...
@@ -658,7 +657,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
entity
.
getTypeName
());
String
guidVertex
=
AtlasGraphUtilsV
1
.
getIdFromVertex
(
vertex
);
String
guidVertex
=
AtlasGraphUtilsV
2
.
getIdFromVertex
(
vertex
);
if
(!
StringUtils
.
equals
(
guidVertex
,
guid
))
{
// if entity was found by unique attribute
entity
.
setGuid
(
guidVertex
);
...
...
@@ -680,7 +679,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
discoveryContext
.
addResolvedGuid
(
guid
,
vertex
);
String
generatedGuid
=
AtlasGraphUtilsV
1
.
getIdFromVertex
(
vertex
);
String
generatedGuid
=
AtlasGraphUtilsV
2
.
getIdFromVertex
(
vertex
);
entity
.
setGuid
(
generatedGuid
);
...
...
@@ -699,7 +698,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
private
EntityMutationResponse
deleteVertices
(
Collection
<
AtlasVertex
>
deletionCandidates
)
throws
AtlasBaseException
{
EntityMutationResponse
response
=
new
EntityMutationResponse
();
RequestContext
V1
req
=
RequestContextV1
.
get
();
RequestContext
req
=
RequestContext
.
get
();
deleteHandler
.
deleteEntities
(
deletionCandidates
);
// this will update req with list of deleted/updated entities
...
...
@@ -740,7 +739,7 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore {
*/
private
void
validateEntityAssociations
(
String
guid
,
List
<
AtlasClassification
>
classifications
)
throws
AtlasBaseException
{
List
<
String
>
entityClassifications
=
getClassificationNames
(
guid
);
String
entityTypeName
=
AtlasGraphUtilsV
1
.
getTypeNameFromGuid
(
guid
);
String
entityTypeName
=
AtlasGraphUtilsV
2
.
getTypeNameFromGuid
(
guid
);
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
entityTypeName
);
for
(
AtlasClassification
classification
:
classifications
)
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/AtlasEntityStream.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/AtlasEntityStream.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/AtlasEntityStreamForImport.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/AtlasEntityStreamForImport.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasEnumDefStoreV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasEnumDefStoreV2
.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -39,10 +39,10 @@ import java.util.List;
/**
* EnumDef store in v1 format.
*/
class
AtlasEnumDefStoreV
1
extends
AtlasAbstractDefStoreV1
<
AtlasEnumDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEnumDefStoreV
1
.
class
);
class
AtlasEnumDefStoreV
2
extends
AtlasAbstractDefStoreV2
<
AtlasEnumDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEnumDefStoreV
2
.
class
);
public
AtlasEnumDefStoreV
1
(
AtlasTypeDefGraphStoreV1
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
public
AtlasEnumDefStoreV
2
(
AtlasTypeDefGraphStoreV2
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
super
(
typeDefStore
,
typeRegistry
);
}
...
...
@@ -277,19 +277,19 @@ class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEnumDef> {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
MISSING_MANDATORY_ATTRIBUTE
,
enumDef
.
getName
(),
"elementValue"
);
}
String
elemKey
=
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
enumDef
,
element
.
getValue
());
String
elemKey
=
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
enumDef
,
element
.
getValue
());
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
elemKey
,
element
.
getOrdinal
());
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
elemKey
,
element
.
getOrdinal
());
if
(
StringUtils
.
isNotBlank
(
element
.
getDescription
()))
{
String
descKey
=
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
elemKey
,
"description"
);
String
descKey
=
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
elemKey
,
"description"
);
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
descKey
,
element
.
getDescription
());
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
descKey
,
element
.
getDescription
());
}
values
.
add
(
element
.
getValue
());
}
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
AtlasGraphUtilsV1
.
getTypeDefPropertyKey
(
enumDef
),
values
);
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
AtlasGraphUtilsV2
.
getTypeDefPropertyKey
(
enumDef
),
values
);
}
private
AtlasEnumDef
toEnumDef
(
AtlasVertex
vertex
)
{
...
...
@@ -302,19 +302,19 @@ class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEnumDef> {
return
ret
;
}
private
static
AtlasEnumDef
toEnumDef
(
AtlasVertex
vertex
,
AtlasEnumDef
enumDef
,
AtlasTypeDefGraphStoreV
1
typeDefStore
)
{
private
static
AtlasEnumDef
toEnumDef
(
AtlasVertex
vertex
,
AtlasEnumDef
enumDef
,
AtlasTypeDefGraphStoreV
2
typeDefStore
)
{
AtlasEnumDef
ret
=
enumDef
!=
null
?
enumDef
:
new
AtlasEnumDef
();
typeDefStore
.
vertexToTypeDef
(
vertex
,
ret
);
List
<
AtlasEnumElementDef
>
elements
=
new
ArrayList
<>();
List
<
String
>
elemValues
=
vertex
.
getProperty
(
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
ret
),
List
.
class
);
List
<
String
>
elemValues
=
vertex
.
getProperty
(
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
ret
),
List
.
class
);
for
(
String
elemValue
:
elemValues
)
{
String
elemKey
=
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
ret
,
elemValue
);
String
descKey
=
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
elemKey
,
"description"
);
String
elemKey
=
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
ret
,
elemValue
);
String
descKey
=
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
elemKey
,
"description"
);
Integer
ordinal
=
AtlasGraphUtilsV
1
.
getProperty
(
vertex
,
elemKey
,
Integer
.
class
);
String
desc
=
AtlasGraphUtilsV
1
.
getProperty
(
vertex
,
descKey
,
String
.
class
);
Integer
ordinal
=
AtlasGraphUtilsV
2
.
getProperty
(
vertex
,
elemKey
,
Integer
.
class
);
String
desc
=
AtlasGraphUtilsV
2
.
getProperty
(
vertex
,
descKey
,
String
.
class
);
elements
.
add
(
new
AtlasEnumElementDef
(
elemValue
,
desc
,
ordinal
));
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasGraphUtilsV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasGraphUtilsV2
.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.ApplicationProperties
;
...
...
@@ -60,8 +60,8 @@ import static org.apache.atlas.repository.graphdb.AtlasGraphQuery.SortOrder.*;
/**
* Utility methods for Graph.
*/
public
class
AtlasGraphUtilsV
1
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasGraphUtilsV
1
.
class
);
public
class
AtlasGraphUtilsV
2
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasGraphUtilsV
2
.
class
);
public
static
final
String
PROPERTY_PREFIX
=
Constants
.
INTERNAL_PROPERTY_KEY_PREFIX
+
"type."
;
public
static
final
String
SUPERTYPE_EDGE_LABEL
=
PROPERTY_PREFIX
+
".supertype"
;
...
...
@@ -250,13 +250,13 @@ public class AtlasGraphUtilsV1 {
}
if
(
canUseIndexQuery
(
entityType
,
attribute
.
getName
()))
{
vertex
=
AtlasGraphUtilsV
1
.
getAtlasVertexFromIndexQuery
(
entityType
,
attribute
,
attrValue
);
vertex
=
AtlasGraphUtilsV
2
.
getAtlasVertexFromIndexQuery
(
entityType
,
attribute
,
attrValue
);
}
else
{
vertex
=
AtlasGraphUtilsV
1
.
findByTypeAndPropertyName
(
entityType
.
getTypeName
(),
attribute
.
getVertexPropertyName
(),
attrValue
);
vertex
=
AtlasGraphUtilsV
2
.
findByTypeAndPropertyName
(
entityType
.
getTypeName
(),
attribute
.
getVertexPropertyName
(),
attrValue
);
// if no instance of given typeName is found, try to find an instance of type's sub-type
if
(
vertex
==
null
&&
!
entityType
.
getAllSubTypes
().
isEmpty
())
{
vertex
=
AtlasGraphUtilsV
1
.
findBySuperTypeAndPropertyName
(
entityType
.
getTypeName
(),
attribute
.
getVertexPropertyName
(),
attrValue
);
vertex
=
AtlasGraphUtilsV
2
.
findBySuperTypeAndPropertyName
(
entityType
.
getTypeName
(),
attribute
.
getVertexPropertyName
(),
attrValue
);
}
}
...
...
@@ -289,9 +289,9 @@ public class AtlasGraphUtilsV1 {
String
ret
=
null
;
if
(
StringUtils
.
isNotEmpty
(
guid
))
{
AtlasVertex
vertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
guid
);
AtlasVertex
vertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
guid
);
ret
=
(
vertex
!=
null
)
?
AtlasGraphUtilsV
1
.
getTypeName
(
vertex
)
:
null
;
ret
=
(
vertex
!=
null
)
?
AtlasGraphUtilsV
2
.
getTypeName
(
vertex
)
:
null
;
}
return
ret
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasRelationshipDefStoreV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasRelationshipDefStoreV2
.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasErrorCode
;
...
...
@@ -47,11 +47,11 @@ import java.util.List;
/**
* RelationshipDef store in v1 format.
*/
public
class
AtlasRelationshipDefStoreV
1
extends
AtlasAbstractDefStoreV1
<
AtlasRelationshipDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasRelationshipDefStoreV
1
.
class
);
public
class
AtlasRelationshipDefStoreV
2
extends
AtlasAbstractDefStoreV2
<
AtlasRelationshipDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasRelationshipDefStoreV
2
.
class
);
@Inject
public
AtlasRelationshipDefStoreV
1
(
AtlasTypeDefGraphStoreV1
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
public
AtlasRelationshipDefStoreV
2
(
AtlasTypeDefGraphStoreV2
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
super
(
typeDefStore
,
typeRegistry
);
}
...
...
@@ -97,7 +97,7 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasRe
}
// create an edge between the relationshipDef and each of the entityDef vertices.
AtlasEdge
edge1
=
typeDefStore
.
getOrCreateEdge
(
relationshipDefVertex
,
end1TypeVertex
,
AtlasGraphUtilsV
1
.
RELATIONSHIPTYPE_EDGE_LABEL
);
AtlasEdge
edge1
=
typeDefStore
.
getOrCreateEdge
(
relationshipDefVertex
,
end1TypeVertex
,
AtlasGraphUtilsV
2
.
RELATIONSHIPTYPE_EDGE_LABEL
);
/*
Where edge1 and edge2 have the same names and types we do not need a second edge.
...
...
@@ -111,7 +111,7 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasRe
}
}
else
{
AtlasEdge
edge2
=
typeDefStore
.
getOrCreateEdge
(
relationshipDefVertex
,
end2TypeVertex
,
AtlasGraphUtilsV
1
.
RELATIONSHIPTYPE_EDGE_LABEL
);
AtlasEdge
edge2
=
typeDefStore
.
getOrCreateEdge
(
relationshipDefVertex
,
end2TypeVertex
,
AtlasGraphUtilsV
2
.
RELATIONSHIPTYPE_EDGE_LABEL
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"AtlasRelationshipDefStoreV1.preCreate({}): created relationshipDef vertex {},"
+
" edge1 as {}, edge2 as {} "
,
relationshipDef
,
relationshipDefVertex
,
edge1
,
edge2
);
...
...
@@ -316,7 +316,7 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasRe
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_NAME_NOT_FOUND
,
name
);
}
if
(
AtlasGraphUtilsV
1
.
relationshipTypeHasInstanceEdges
(
name
))
{
if
(
AtlasGraphUtilsV
2
.
relationshipTypeHasInstanceEdges
(
name
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_HAS_REFERENCES
,
name
);
}
...
...
@@ -345,9 +345,9 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasRe
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_GUID_NOT_FOUND
,
guid
);
}
String
typeName
=
AtlasGraphUtilsV
1
.
getProperty
(
ret
,
Constants
.
TYPENAME_PROPERTY_KEY
,
String
.
class
);
String
typeName
=
AtlasGraphUtilsV
2
.
getProperty
(
ret
,
Constants
.
TYPENAME_PROPERTY_KEY
,
String
.
class
);
if
(
AtlasGraphUtilsV
1
.
relationshipTypeHasInstanceEdges
(
typeName
))
{
if
(
AtlasGraphUtilsV
2
.
relationshipTypeHasInstanceEdges
(
typeName
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_HAS_REFERENCES
,
typeName
);
}
...
...
@@ -383,7 +383,7 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasRe
}
}
AtlasStructDefStoreV
1
.
updateVertexPreCreate
(
relationshipDef
,
relationshipType
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexPreCreate
(
relationshipDef
,
relationshipType
,
vertex
,
typeDefStore
);
// Update ends
setVertexPropertiesFromRelationshipDef
(
relationshipDef
,
vertex
);
}
...
...
@@ -396,7 +396,7 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasRe
preUpdateCheck
(
newRelationshipDef
,
existingRelationshipDef
);
// we do allow change to tag propagation and the addition of new attributes.
AtlasStructDefStoreV
1
.
updateVertexPreUpdate
(
newRelationshipDef
,
relationshipType
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexPreUpdate
(
newRelationshipDef
,
relationshipType
,
vertex
,
typeDefStore
);
setVertexPropertiesFromRelationshipDef
(
newRelationshipDef
,
vertex
);
}
...
...
@@ -499,7 +499,7 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasRe
ret
=
new
AtlasRelationshipDef
(
name
,
description
,
version
,
relationshipCategory
,
propagateTags
,
endDef1
,
endDef2
);
// add in the attributes
AtlasStructDefStoreV
1
.
toStructDef
(
vertex
,
ret
,
typeDefStore
);
AtlasStructDefStoreV
2
.
toStructDef
(
vertex
,
ret
,
typeDefStore
);
}
return
ret
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasRelationshipStoreV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasRelationshipStoreV2
.java
View file @
3d5b4880
...
...
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.annotation.GraphTransaction
;
...
...
@@ -37,6 +37,7 @@ import org.apache.atlas.repository.graphdb.AtlasEdge;
import
org.apache.atlas.repository.graphdb.AtlasEdgeDirection
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.AtlasRelationshipStore
;
import
org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasRelationshipType
;
import
org.apache.atlas.type.AtlasStructType.AtlasAttribute
;
...
...
@@ -71,24 +72,24 @@ import static org.apache.atlas.repository.graph.GraphHelper.getClassificationNam
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getClassificationVertices
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getOutGoingEdgesByLabel
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getPropagateTags
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
getIdFromVertex
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
getState
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
getTypeName
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
getIdFromVertex
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
getState
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
getTypeName
;
@Component
public
class
AtlasRelationshipStoreV
1
implements
AtlasRelationshipStore
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasRelationshipStoreV
1
.
class
);
public
class
AtlasRelationshipStoreV
2
implements
AtlasRelationshipStore
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasRelationshipStoreV
2
.
class
);
private
static
final
Long
DEFAULT_RELATIONSHIP_VERSION
=
0L
;
private
final
AtlasTypeRegistry
typeRegistry
;
private
final
EntityGraphRetriever
entityRetriever
;
private
final
DeleteHandlerV1
deleteHandler
;
private
final
DeleteHandlerV1
deleteHandler
;
private
final
GraphHelper
graphHelper
=
GraphHelper
.
getInstance
();
private
final
AtlasEntityChangeNotifier
entityChangeNotifier
;
@Inject
public
AtlasRelationshipStoreV
1
(
AtlasTypeRegistry
typeRegistry
,
DeleteHandlerV1
deleteHandler
,
AtlasEntityChangeNotifier
entityChangeNotifier
)
{
public
AtlasRelationshipStoreV
2
(
AtlasTypeRegistry
typeRegistry
,
DeleteHandlerV1
deleteHandler
,
AtlasEntityChangeNotifier
entityChangeNotifier
)
{
this
.
typeRegistry
=
typeRegistry
;
this
.
entityRetriever
=
new
EntityGraphRetriever
(
typeRegistry
);
this
.
deleteHandler
=
deleteHandler
;
...
...
@@ -135,7 +136,7 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
}
AtlasEdge
edge
=
graphHelper
.
getEdgeForGUID
(
guid
);
String
edgeType
=
AtlasGraphUtilsV
1
.
getTypeName
(
edge
);
String
edgeType
=
AtlasGraphUtilsV
2
.
getTypeName
(
edge
);
AtlasVertex
end1Vertex
=
edge
.
getOutVertex
();
AtlasVertex
end2Vertex
=
edge
.
getInVertex
();
...
...
@@ -151,11 +152,11 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
if
(
updatedEnd1Guid
==
null
)
{
AtlasVertex
updatedEnd1Vertex
=
getVertexFromEndPoint
(
relationship
.
getEnd1
());
updatedEnd1Guid
=
updatedEnd1Vertex
==
null
?
null
:
AtlasGraphUtilsV
1
.
getIdFromVertex
(
updatedEnd1Vertex
);
updatedEnd1Guid
=
updatedEnd1Vertex
==
null
?
null
:
AtlasGraphUtilsV
2
.
getIdFromVertex
(
updatedEnd1Vertex
);
}
if
(
updatedEnd1Guid
!=
null
)
{
String
end1Guid
=
AtlasGraphUtilsV
1
.
getIdFromVertex
(
end1Vertex
);
String
end1Guid
=
AtlasGraphUtilsV
2
.
getIdFromVertex
(
end1Vertex
);
if
(!
StringUtils
.
equalsIgnoreCase
(
relationship
.
getEnd1
().
getGuid
(),
end1Guid
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIP_UPDATE_END_CHANGE_NOT_ALLOWED
,
edgeType
,
guid
,
end1Guid
,
relationship
.
getEnd1
().
getGuid
());
...
...
@@ -170,14 +171,14 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
if
(
updatedEnd2Guid
==
null
)
{
AtlasVertex
updatedEnd2Vertex
=
getVertexFromEndPoint
(
relationship
.
getEnd2
());
updatedEnd2Guid
=
updatedEnd2Vertex
==
null
?
null
:
AtlasGraphUtilsV
1
.
getIdFromVertex
(
updatedEnd2Vertex
);
updatedEnd2Guid
=
updatedEnd2Vertex
==
null
?
null
:
AtlasGraphUtilsV
2
.
getIdFromVertex
(
updatedEnd2Vertex
);
}
if
(
updatedEnd2Guid
!=
null
)
{
String
end2Guid
=
AtlasGraphUtilsV
1
.
getIdFromVertex
(
end2Vertex
);
String
end2Guid
=
AtlasGraphUtilsV
2
.
getIdFromVertex
(
end2Vertex
);
if
(!
StringUtils
.
equalsIgnoreCase
(
relationship
.
getEnd2
().
getGuid
(),
end2Guid
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIP_UPDATE_END_CHANGE_NOT_ALLOWED
,
AtlasGraphUtilsV
1
.
getTypeName
(
edge
),
guid
,
end2Guid
,
relationship
.
getEnd2
().
getGuid
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIP_UPDATE_END_CHANGE_NOT_ALLOWED
,
AtlasGraphUtilsV
2
.
getTypeName
(
edge
),
guid
,
end2Guid
,
relationship
.
getEnd2
().
getGuid
());
}
}
}
...
...
@@ -330,12 +331,12 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
String
attrVertexProperty
=
attr
.
getVertexPropertyName
();
Object
attrValue
=
relationship
.
getAttribute
(
attrName
);
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
attrVertexProperty
,
attrValue
);
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
attrVertexProperty
,
attrValue
);
}
}
}
else
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIP_ALREADY_EXISTS
,
relationship
.
getTypeName
(),
AtlasGraphUtilsV
1
.
getIdFromVertex
(
end1Vertex
),
AtlasGraphUtilsV1
.
getIdFromVertex
(
end2Vertex
));
AtlasGraphUtilsV
2
.
getIdFromVertex
(
end1Vertex
),
AtlasGraphUtilsV2
.
getIdFromVertex
(
end2Vertex
));
}
}
catch
(
RepositoryException
e
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INTERNAL_ERROR
,
e
);
...
...
@@ -355,7 +356,7 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
String
attrVertexProperty
=
attr
.
getVertexPropertyName
();
if
(
relationship
.
hasAttribute
(
attrName
))
{
AtlasGraphUtilsV
1
.
setProperty
(
relationshipEdge
,
attrVertexProperty
,
relationship
.
getAttribute
(
attrName
));
AtlasGraphUtilsV
2
.
setProperty
(
relationshipEdge
,
attrVertexProperty
,
relationship
.
getAttribute
(
attrName
));
}
}
}
...
...
@@ -460,7 +461,7 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
Map
<
AtlasVertex
,
List
<
AtlasVertex
>>
currentClassificationsMap
=
graphHelper
.
getClassificationPropagatedEntitiesMapping
(
currentClassificationVertices
);
// Update propagation edge
AtlasGraphUtilsV
1
.
setProperty
(
edge
,
Constants
.
RELATIONSHIPTYPE_TAG_PROPAGATION_KEY
,
newTagPropagation
.
name
());
AtlasGraphUtilsV
2
.
setProperty
(
edge
,
Constants
.
RELATIONSHIPTYPE_TAG_PROPAGATION_KEY
,
newTagPropagation
.
name
());
List
<
AtlasVertex
>
updatedClassificationVertices
=
getClassificationVertices
(
edge
);
List
<
AtlasVertex
>
classificationVerticesUnion
=
(
List
<
AtlasVertex
>)
CollectionUtils
.
union
(
currentClassificationVertices
,
updatedClassificationVertices
);
...
...
@@ -557,8 +558,8 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
RELATIONSHIP_END_IS_NULL
,
relationshipType
.
getEnd2Type
().
getTypeName
());
}
String
end1TypeName
=
AtlasGraphUtilsV
1
.
getTypeName
(
end1Vertex
);
String
end2TypeName
=
AtlasGraphUtilsV
1
.
getTypeName
(
end2Vertex
);
String
end1TypeName
=
AtlasGraphUtilsV
2
.
getTypeName
(
end1Vertex
);
String
end2TypeName
=
AtlasGraphUtilsV
2
.
getTypeName
(
end2Vertex
);
boolean
validEndTypes
=
false
;
...
...
@@ -609,7 +610,7 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
String
guid
=
end
.
getGuid
();
String
typeName
=
end
.
getTypeName
();
Map
<
String
,
Object
>
uniqueAttributes
=
end
.
getUniqueAttributes
();
AtlasVertex
endVertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
guid
);
AtlasVertex
endVertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
guid
);
if
(!
AtlasTypeUtil
.
isValidGuid
(
guid
)
||
endVertex
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
...
...
@@ -617,7 +618,7 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
}
else
if
(
MapUtils
.
isNotEmpty
(
uniqueAttributes
))
{
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
typeName
);
if
(
AtlasGraphUtilsV
1
.
findByUniqueAttributes
(
entityType
,
uniqueAttributes
)
==
null
)
{
if
(
AtlasGraphUtilsV
2
.
findByUniqueAttributes
(
entityType
,
uniqueAttributes
)
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND
,
typeName
,
uniqueAttributes
.
toString
());
}
}
else
{
...
...
@@ -691,11 +692,11 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
AtlasVertex
ret
=
null
;
if
(
StringUtils
.
isNotEmpty
(
endPoint
.
getGuid
()))
{
ret
=
AtlasGraphUtilsV
1
.
findByGuid
(
endPoint
.
getGuid
());
ret
=
AtlasGraphUtilsV
2
.
findByGuid
(
endPoint
.
getGuid
());
}
else
if
(
StringUtils
.
isNotEmpty
(
endPoint
.
getTypeName
())
&&
MapUtils
.
isNotEmpty
(
endPoint
.
getUniqueAttributes
()))
{
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
endPoint
.
getTypeName
());
ret
=
AtlasGraphUtilsV
1
.
findByUniqueAttributes
(
entityType
,
endPoint
.
getUniqueAttributes
());
ret
=
AtlasGraphUtilsV
2
.
findByUniqueAttributes
(
entityType
,
endPoint
.
getUniqueAttributes
());
}
return
ret
;
...
...
@@ -714,10 +715,10 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
if
(
ret
!=
null
)
{
final
String
guid
=
UUID
.
randomUUID
().
toString
();
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
ENTITY_TYPE_PROPERTY_KEY
,
relationship
.
getTypeName
());
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
RELATIONSHIP_GUID_PROPERTY_KEY
,
guid
);
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
VERSION_PROPERTY_KEY
,
getRelationshipVersion
(
relationship
));
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
RELATIONSHIPTYPE_TAG_PROPAGATION_KEY
,
tagPropagation
.
name
());
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
ENTITY_TYPE_PROPERTY_KEY
,
relationship
.
getTypeName
());
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
RELATIONSHIP_GUID_PROPERTY_KEY
,
guid
);
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
VERSION_PROPERTY_KEY
,
getRelationshipVersion
(
relationship
));
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
RELATIONSHIPTYPE_TAG_PROPAGATION_KEY
,
tagPropagation
.
name
());
// blocked propagated classifications
handleBlockedClassifications
(
ret
,
relationship
.
getBlockedPropagatedClassifications
());
...
...
@@ -760,8 +761,8 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
String
ret
=
relationshipType
.
getRelationshipDef
().
getRelationshipLabel
();
AtlasRelationshipEndDef
endDef1
=
relationshipType
.
getRelationshipDef
().
getEndDef1
();
AtlasRelationshipEndDef
endDef2
=
relationshipType
.
getRelationshipDef
().
getEndDef2
();
Set
<
String
>
fromVertexTypes
=
getTypeAndAllSuperTypes
(
AtlasGraphUtilsV
1
.
getTypeName
(
fromVertex
));
Set
<
String
>
toVertexTypes
=
getTypeAndAllSuperTypes
(
AtlasGraphUtilsV
1
.
getTypeName
(
toVertex
));
Set
<
String
>
fromVertexTypes
=
getTypeAndAllSuperTypes
(
AtlasGraphUtilsV
2
.
getTypeName
(
fromVertex
));
Set
<
String
>
toVertexTypes
=
getTypeAndAllSuperTypes
(
AtlasGraphUtilsV
2
.
getTypeName
(
toVertex
));
AtlasAttribute
attribute
=
null
;
// validate entity type and all its supertypes contains relationshipDefs end type
...
...
@@ -794,7 +795,7 @@ public class AtlasRelationshipStoreV1 implements AtlasRelationshipStore {
String
typeName
=
objectId
.
getTypeName
();
if
(
StringUtils
.
isBlank
(
typeName
))
{
typeName
=
AtlasGraphUtilsV
1
.
getTypeNameFromGuid
(
objectId
.
getGuid
());
typeName
=
AtlasGraphUtilsV
2
.
getTypeNameFromGuid
(
objectId
.
getGuid
());
}
return
typeName
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasStructDefStoreV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasStructDefStoreV2
.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.common.annotations.VisibleForTesting
;
import
org.apache.atlas.AtlasErrorCode
;
...
...
@@ -52,10 +52,10 @@ import java.util.Set;
/**
* StructDef store in v1 format.
*/
public
class
AtlasStructDefStoreV
1
extends
AtlasAbstractDefStoreV1
<
AtlasStructDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasStructDefStoreV
1
.
class
);
public
class
AtlasStructDefStoreV
2
extends
AtlasAbstractDefStoreV2
<
AtlasStructDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasStructDefStoreV
2
.
class
);
public
AtlasStructDefStoreV
1
(
AtlasTypeDefGraphStoreV1
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
public
AtlasStructDefStoreV
2
(
AtlasTypeDefGraphStoreV2
typeDefStore
,
AtlasTypeRegistry
typeRegistry
)
{
super
(
typeDefStore
,
typeRegistry
);
}
...
...
@@ -81,7 +81,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
ret
=
typeDefStore
.
createTypeVertex
(
structDef
);
AtlasStructDefStoreV
1
.
updateVertexPreCreate
(
structDef
,
(
AtlasStructType
)
type
,
ret
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexPreCreate
(
structDef
,
(
AtlasStructType
)
type
,
ret
,
typeDefStore
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasStructDefStoreV1.preCreate({}): {}"
,
structDef
,
ret
);
...
...
@@ -104,7 +104,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
AtlasVertex
vertex
=
(
preCreateResult
==
null
)
?
preCreate
(
structDef
)
:
preCreateResult
;
AtlasStructDefStoreV
1
.
updateVertexAddReferences
(
structDef
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexAddReferences
(
structDef
,
vertex
,
typeDefStore
);
AtlasStructDef
ret
=
toStructDef
(
vertex
);
...
...
@@ -220,8 +220,8 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_NAME_NOT_FOUND
,
name
);
}
AtlasStructDefStoreV
1
.
updateVertexPreUpdate
(
structDef
,
(
AtlasStructType
)
type
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
1
.
updateVertexAddReferences
(
structDef
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexPreUpdate
(
structDef
,
(
AtlasStructType
)
type
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexAddReferences
(
structDef
,
vertex
,
typeDefStore
);
AtlasStructDef
ret
=
toStructDef
(
vertex
);
...
...
@@ -256,8 +256,8 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_GUID_NOT_FOUND
,
guid
);
}
AtlasStructDefStoreV
1
.
updateVertexPreUpdate
(
structDef
,
(
AtlasStructType
)
type
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
1
.
updateVertexAddReferences
(
structDef
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexPreUpdate
(
structDef
,
(
AtlasStructType
)
type
,
vertex
,
typeDefStore
);
AtlasStructDefStoreV
2
.
updateVertexAddReferences
(
structDef
,
vertex
,
typeDefStore
);
AtlasStructDef
ret
=
toStructDef
(
vertex
);
...
...
@@ -280,7 +280,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
AtlasVertex
ret
=
typeDefStore
.
findTypeVertexByNameAndCategory
(
name
,
TypeCategory
.
STRUCT
);
if
(
AtlasGraphUtilsV
1
.
typeHasInstanceVertex
(
name
))
{
if
(
AtlasGraphUtilsV
2
.
typeHasInstanceVertex
(
name
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_HAS_REFERENCES
,
name
);
}
...
...
@@ -309,9 +309,9 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
AtlasVertex
ret
=
typeDefStore
.
findTypeVertexByGuidAndCategory
(
guid
,
TypeCategory
.
STRUCT
);
String
typeName
=
AtlasGraphUtilsV
1
.
getProperty
(
ret
,
Constants
.
TYPENAME_PROPERTY_KEY
,
String
.
class
);
String
typeName
=
AtlasGraphUtilsV
2
.
getProperty
(
ret
,
Constants
.
TYPENAME_PROPERTY_KEY
,
String
.
class
);
if
(
AtlasGraphUtilsV
1
.
typeHasInstanceVertex
(
typeName
))
{
if
(
AtlasGraphUtilsV
2
.
typeHasInstanceVertex
(
typeName
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_HAS_REFERENCES
,
typeName
);
}
...
...
@@ -339,7 +339,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
}
public
static
void
updateVertexPreCreate
(
AtlasStructDef
structDef
,
AtlasStructType
structType
,
AtlasVertex
vertex
,
AtlasTypeDefGraphStoreV
1
typeDefStore
)
throws
AtlasBaseException
{
AtlasVertex
vertex
,
AtlasTypeDefGraphStoreV
2
typeDefStore
)
throws
AtlasBaseException
{
List
<
String
>
attrNames
=
new
ArrayList
<>(
structDef
.
getAttributeDefs
().
size
());
for
(
AtlasAttributeDef
attributeDef
:
structDef
.
getAttributeDefs
())
{
...
...
@@ -351,17 +351,17 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
throw
new
AtlasBaseException
(
AtlasErrorCode
.
MISSING_MANDATORY_ATTRIBUTE
,
structDef
.
getName
(),
"typeName"
);
}
String
propertyKey
=
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
structDef
,
attributeDef
.
getName
());
String
propertyKey
=
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
structDef
,
attributeDef
.
getName
());
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
propertyKey
,
toJsonFromAttribute
(
structType
.
getAttribute
(
attributeDef
.
getName
())));
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
propertyKey
,
toJsonFromAttribute
(
structType
.
getAttribute
(
attributeDef
.
getName
())));
attrNames
.
add
(
attributeDef
.
getName
());
}
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
AtlasGraphUtilsV1
.
getTypeDefPropertyKey
(
structDef
),
attrNames
);
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
AtlasGraphUtilsV2
.
getTypeDefPropertyKey
(
structDef
),
attrNames
);
}
public
static
void
updateVertexPreUpdate
(
AtlasStructDef
structDef
,
AtlasStructType
structType
,
AtlasVertex
vertex
,
AtlasTypeDefGraphStoreV
1
typeDefStore
)
AtlasVertex
vertex
,
AtlasTypeDefGraphStoreV
2
typeDefStore
)
throws
AtlasBaseException
{
List
<
String
>
attrNames
=
new
ArrayList
<>();
...
...
@@ -371,7 +371,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
}
}
List
<
String
>
currAttrNames
=
vertex
.
getProperty
(
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
structDef
),
List
.
class
);
List
<
String
>
currAttrNames
=
vertex
.
getProperty
(
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
structDef
),
List
.
class
);
// delete attributes that are not present in updated structDef
if
(
CollectionUtils
.
isNotEmpty
(
currAttrNames
))
{
...
...
@@ -411,34 +411,34 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
throw
new
AtlasBaseException
(
AtlasErrorCode
.
BAD_REQUEST
,
"Data type update for attribute is not supported"
);
}
String
propertyKey
=
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
structDef
,
attributeDef
.
getName
());
String
propertyKey
=
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
structDef
,
attributeDef
.
getName
());
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
propertyKey
,
toJsonFromAttribute
(
structType
.
getAttribute
(
attributeDef
.
getName
())));
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
propertyKey
,
toJsonFromAttribute
(
structType
.
getAttribute
(
attributeDef
.
getName
())));
}
}
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
AtlasGraphUtilsV1
.
getTypeDefPropertyKey
(
structDef
),
attrNames
);
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
AtlasGraphUtilsV2
.
getTypeDefPropertyKey
(
structDef
),
attrNames
);
}
public
static
void
updateVertexAddReferences
(
AtlasStructDef
structDef
,
AtlasVertex
vertex
,
AtlasTypeDefGraphStoreV
1
typeDefStore
)
throws
AtlasBaseException
{
AtlasTypeDefGraphStoreV
2
typeDefStore
)
throws
AtlasBaseException
{
for
(
AtlasAttributeDef
attributeDef
:
structDef
.
getAttributeDefs
())
{
addReferencesForAttribute
(
vertex
,
attributeDef
,
typeDefStore
);
}
}
public
static
AtlasStructDef
toStructDef
(
AtlasVertex
vertex
,
AtlasStructDef
structDef
,
AtlasTypeDefGraphStoreV
1
typeDefStore
)
throws
AtlasBaseException
{
AtlasTypeDefGraphStoreV
2
typeDefStore
)
throws
AtlasBaseException
{
AtlasStructDef
ret
=
(
structDef
!=
null
)
?
structDef
:
new
AtlasStructDef
();
typeDefStore
.
vertexToTypeDef
(
vertex
,
ret
);
List
<
AtlasAttributeDef
>
attributeDefs
=
new
ArrayList
<>();
List
<
String
>
attrNames
=
vertex
.
getProperty
(
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
ret
),
List
.
class
);
List
<
String
>
attrNames
=
vertex
.
getProperty
(
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
ret
),
List
.
class
);
if
(
CollectionUtils
.
isNotEmpty
(
attrNames
))
{
for
(
String
attrName
:
attrNames
)
{
String
propertyKey
=
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
ret
,
attrName
);
String
propertyKey
=
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
ret
,
attrName
);
String
attribJson
=
vertex
.
getProperty
(
GraphHelper
.
encodePropertyKey
(
propertyKey
),
String
.
class
);
attributeDefs
.
add
(
toAttributeDefFromJson
(
structDef
,
AtlasType
.
fromJson
(
attribJson
,
Map
.
class
),
...
...
@@ -451,7 +451,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
}
private
static
void
addReferencesForAttribute
(
AtlasVertex
vertex
,
AtlasAttributeDef
attributeDef
,
AtlasTypeDefGraphStoreV
1
typeDefStore
)
throws
AtlasBaseException
{
AtlasTypeDefGraphStoreV
2
typeDefStore
)
throws
AtlasBaseException
{
Set
<
String
>
referencedTypeNames
=
AtlasTypeUtil
.
getReferencedTypeNames
(
attributeDef
.
getTypeName
());
String
typeName
=
vertex
.
getProperty
(
Constants
.
TYPENAME_PROPERTY_KEY
,
String
.
class
);
...
...
@@ -464,7 +464,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
throw
new
AtlasBaseException
(
AtlasErrorCode
.
UNKNOWN_TYPE
,
referencedTypeName
,
typeName
,
attributeDef
.
getName
());
}
String
label
=
AtlasGraphUtilsV
1
.
getEdgeLabel
(
typeName
,
attributeDef
.
getName
());
String
label
=
AtlasGraphUtilsV
2
.
getEdgeLabel
(
typeName
,
attributeDef
.
getName
());
typeDefStore
.
getOrCreateEdge
(
vertex
,
referencedTypeVertex
,
label
);
}
...
...
@@ -514,8 +514,8 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
@VisibleForTesting
public
static
AtlasAttributeDef
toAttributeDefFromJson
(
AtlasStructDef
structDef
,
Map
attribInfo
,
AtlasTypeDefGraphStoreV1
typeDefStore
)
Map
attribInfo
,
AtlasTypeDefGraphStoreV2
typeDefStore
)
throws
AtlasBaseException
{
AtlasAttributeDef
ret
=
new
AtlasAttributeDef
();
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1/AtlasTypeDefGraphStoreV1
.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2/AtlasTypeDefGraphStoreV2
.java
View file @
3d5b4880
...
...
@@ -15,14 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.common.annotations.VisibleForTesting
;
import
com.google.common.base.Preconditions
;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
TYPE_CATEGORY_PROPERTY_KEY
;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
VERTEX_TYPE_PROPERTY_KEY
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
VERTEX_TYPE
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
VERTEX_TYPE
;
import
java.util.Date
;
import
java.util.HashSet
;
...
...
@@ -31,7 +31,7 @@ import java.util.Map;
import
java.util.Set
;
import
java.util.UUID
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.annotation.GraphTransaction
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.listener.TypeDefChangeListener
;
...
...
@@ -57,13 +57,13 @@ import javax.inject.Singleton;
*/
@Singleton
@Component
public
class
AtlasTypeDefGraphStoreV
1
extends
AtlasTypeDefGraphStore
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasTypeDefGraphStoreV
1
.
class
);
public
class
AtlasTypeDefGraphStoreV
2
extends
AtlasTypeDefGraphStore
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasTypeDefGraphStoreV
2
.
class
);
protected
final
AtlasGraph
atlasGraph
;
@Inject
public
AtlasTypeDefGraphStoreV
1
(
AtlasTypeRegistry
typeRegistry
,
public
AtlasTypeDefGraphStoreV
2
(
AtlasTypeRegistry
typeRegistry
,
Set
<
TypeDefChangeListener
>
typeDefChangeListeners
,
AtlasGraph
atlasGraph
)
{
super
(
typeRegistry
,
typeDefChangeListeners
);
...
...
@@ -74,27 +74,27 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
@Override
protected
AtlasDefStore
<
AtlasEnumDef
>
getEnumDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
return
new
AtlasEnumDefStoreV
1
(
this
,
typeRegistry
);
return
new
AtlasEnumDefStoreV
2
(
this
,
typeRegistry
);
}
@Override
protected
AtlasDefStore
<
AtlasStructDef
>
getStructDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
return
new
AtlasStructDefStoreV
1
(
this
,
typeRegistry
);
return
new
AtlasStructDefStoreV
2
(
this
,
typeRegistry
);
}
@Override
protected
AtlasDefStore
<
AtlasClassificationDef
>
getClassificationDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
return
new
AtlasClassificationDefStoreV
1
(
this
,
typeRegistry
);
return
new
AtlasClassificationDefStoreV
2
(
this
,
typeRegistry
);
}
@Override
protected
AtlasDefStore
<
AtlasEntityDef
>
getEntityDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
return
new
AtlasEntityDefStoreV
1
(
this
,
typeRegistry
);
return
new
AtlasEntityDefStoreV
2
(
this
,
typeRegistry
);
}
@Override
protected
AtlasDefStore
<
AtlasRelationshipDef
>
getRelationshipDefStore
(
AtlasTypeRegistry
typeRegistry
)
{
return
new
AtlasRelationshipDefStoreV
1
(
this
,
typeRegistry
);
return
new
AtlasRelationshipDefStoreV
2
(
this
,
typeRegistry
);
}
...
...
@@ -399,7 +399,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
for
(
String
superType
:
superTypes
)
{
AtlasVertex
superTypeVertex
=
findTypeVertexByNameAndCategory
(
superType
,
typeCategory
);
getOrCreateEdge
(
vertex
,
superTypeVertex
,
AtlasGraphUtilsV
1
.
SUPERTYPE_EDGE_LABEL
);
getOrCreateEdge
(
vertex
,
superTypeVertex
,
AtlasGraphUtilsV
2
.
SUPERTYPE_EDGE_LABEL
);
}
}
else
if
(
CollectionUtils
.
isNotEmpty
(
currentSuperTypes
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
SUPERTYPE_REMOVAL_NOT_SUPPORTED
);
...
...
@@ -421,7 +421,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
CLASSIFICATIONDEF_INVALID_ENTITYTYPES
,
classificationTypeName
,
entityType
);
}
getOrCreateEdge
(
classificationVertex
,
entityTypeVertex
,
AtlasGraphUtilsV
1
.
ENTITYTYPE_EDGE_LABEL
);
getOrCreateEdge
(
classificationVertex
,
entityTypeVertex
,
AtlasGraphUtilsV
2
.
ENTITYTYPE_EDGE_LABEL
);
}
}
else
if
(
CollectionUtils
.
isNotEmpty
(
currentEntityTypes
))
{
// remove the restrictions, if present
for
(
String
entityType
:
currentEntityTypes
)
{
...
...
@@ -432,18 +432,18 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
}
removeEdge
(
classificationVertex
,
entityTypeVertex
,
AtlasGraphUtilsV
1
.
ENTITYTYPE_EDGE_LABEL
);
removeEdge
(
classificationVertex
,
entityTypeVertex
,
AtlasGraphUtilsV
2
.
ENTITYTYPE_EDGE_LABEL
);
}
}
}
Set
<
String
>
getSuperTypeNames
(
AtlasVertex
vertex
)
{
return
getTypeNamesFromEdges
(
vertex
,
AtlasGraphUtilsV1
.
SUPERTYPE_EDGE_LABEL
);
return
getTypeNamesFromEdges
(
vertex
,
AtlasGraphUtilsV2
.
SUPERTYPE_EDGE_LABEL
);
}
Set
<
String
>
getEntityTypeNames
(
AtlasVertex
vertex
)
{
return
getTypeNamesFromEdges
(
vertex
,
AtlasGraphUtilsV1
.
ENTITYTYPE_EDGE_LABEL
);
return
getTypeNamesFromEdges
(
vertex
,
AtlasGraphUtilsV2
.
ENTITYTYPE_EDGE_LABEL
);
}
/**
...
...
@@ -524,7 +524,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
}
private
String
getCurrentUser
()
{
String
ret
=
RequestContext
V1
.
get
().
getUser
();
String
ret
=
RequestContext
.
get
().
getUser
();
if
(
StringUtils
.
isBlank
(
ret
))
{
ret
=
System
.
getProperty
(
"user.name"
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/AttributeMutationContext.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/AttributeMutationContext.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.model.instance.EntityMutations.EntityOperation
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/BulkImporterImpl.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/BulkImporterImpl.java
View file @
3d5b4880
...
...
@@ -15,11 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.common.annotations.VisibleForTesting
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.impexp.AtlasImportResult
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
...
@@ -41,7 +41,7 @@ import java.util.Set;
@Component
public
class
BulkImporterImpl
implements
BulkImporter
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEntityStoreV
1
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEntityStoreV
2
.
class
);
private
final
AtlasEntityStore
entityStore
;
...
...
@@ -100,7 +100,7 @@ public class BulkImporterImpl implements BulkImporter {
throw
abe
;
}
}
finally
{
RequestContext
V1
.
clear
();
RequestContext
.
clear
();
}
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/EntityGraphMapper.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/EntityGraphMapper.java
View file @
3d5b4880
...
...
@@ -15,11 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TimeBoundary
;
import
org.apache.atlas.model.TypeCategory
;
...
...
@@ -43,6 +43,7 @@ import org.apache.atlas.repository.graphdb.AtlasEdge;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.AtlasRelationshipStore
;
import
org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1
;
import
org.apache.atlas.type.AtlasArrayType
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasEntityType
;
...
...
@@ -91,8 +92,8 @@ import static org.apache.atlas.repository.graph.GraphHelper.isPropagationEnabled
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
isRelationshipEdge
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
string
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
updateModificationMetadata
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
getIdFromVertex
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
isReference
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
getIdFromVertex
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
isReference
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasStructType
.
AtlasAttribute
.
AtlasRelationshipEdgeDirection
.
IN
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasStructType
.
AtlasAttribute
.
AtlasRelationshipEdgeDirection
.
OUT
;
...
...
@@ -102,7 +103,7 @@ public class EntityGraphMapper {
private
final
GraphHelper
graphHelper
=
GraphHelper
.
getInstance
();
private
final
AtlasGraph
graph
;
private
final
DeleteHandlerV1
deleteHandler
;
private
final
DeleteHandlerV1
deleteHandler
;
private
final
AtlasTypeRegistry
typeRegistry
;
private
final
AtlasRelationshipStore
relationshipStore
;
private
final
AtlasEntityChangeNotifier
entityChangeNotifier
;
...
...
@@ -137,34 +138,34 @@ public class EntityGraphMapper {
AtlasVertex
ret
=
createStructVertex
(
entity
);
for
(
String
superTypeName
:
entityType
.
getAllSuperTypes
())
{
AtlasGraphUtilsV
1
.
addProperty
(
ret
,
Constants
.
SUPER_TYPES_PROPERTY_KEY
,
superTypeName
);
AtlasGraphUtilsV
2
.
addProperty
(
ret
,
Constants
.
SUPER_TYPES_PROPERTY_KEY
,
superTypeName
);
}
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
GUID_PROPERTY_KEY
,
guid
);
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
VERSION_PROPERTY_KEY
,
getEntityVersion
(
entity
));
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
GUID_PROPERTY_KEY
,
guid
);
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
VERSION_PROPERTY_KEY
,
getEntityVersion
(
entity
));
return
ret
;
}
public
void
updateSystemAttributes
(
AtlasVertex
vertex
,
AtlasEntity
entity
)
{
if
(
entity
.
getStatus
()
!=
null
)
{
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
Constants
.
STATE_PROPERTY_KEY
,
entity
.
getStatus
().
name
());
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
Constants
.
STATE_PROPERTY_KEY
,
entity
.
getStatus
().
name
());
}
if
(
entity
.
getCreateTime
()
!=
null
)
{
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
Constants
.
TIMESTAMP_PROPERTY_KEY
,
entity
.
getCreateTime
().
getTime
());
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
Constants
.
TIMESTAMP_PROPERTY_KEY
,
entity
.
getCreateTime
().
getTime
());
}
if
(
entity
.
getUpdateTime
()
!=
null
)
{
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
entity
.
getUpdateTime
().
getTime
());
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
entity
.
getUpdateTime
().
getTime
());
}
if
(
StringUtils
.
isNotEmpty
(
entity
.
getCreatedBy
()))
{
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
Constants
.
CREATED_BY_KEY
,
entity
.
getCreatedBy
());
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
Constants
.
CREATED_BY_KEY
,
entity
.
getCreatedBy
());
}
if
(
StringUtils
.
isNotEmpty
(
entity
.
getUpdatedBy
()))
{
AtlasGraphUtilsV
1
.
setProperty
(
vertex
,
Constants
.
MODIFIED_BY_KEY
,
entity
.
getUpdatedBy
());
AtlasGraphUtilsV
2
.
setProperty
(
vertex
,
Constants
.
MODIFIED_BY_KEY
,
entity
.
getUpdatedBy
());
}
}
...
...
@@ -216,7 +217,7 @@ public class EntityGraphMapper {
}
}
RequestContext
V1
req
=
RequestContextV1
.
get
();
RequestContext
req
=
RequestContext
.
get
();
for
(
AtlasObjectId
entity
:
req
.
getDeletedEntities
())
{
resp
.
addEntity
(
DELETE
,
entity
);
...
...
@@ -241,12 +242,12 @@ public class EntityGraphMapper {
final
AtlasVertex
ret
=
graph
.
addVertex
();
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
ENTITY_TYPE_PROPERTY_KEY
,
struct
.
getTypeName
());
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
STATE_PROPERTY_KEY
,
AtlasEntity
.
Status
.
ACTIVE
.
name
());
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
TIMESTAMP_PROPERTY_KEY
,
RequestContextV1
.
get
().
getRequestTime
());
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContextV1
.
get
().
getRequestTime
());
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
CREATED_BY_KEY
,
RequestContextV1
.
get
().
getUser
());
GraphHelper
.
setProperty
(
ret
,
Constants
.
MODIFIED_BY_KEY
,
RequestContext
V1
.
get
().
getUser
());
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
ENTITY_TYPE_PROPERTY_KEY
,
struct
.
getTypeName
());
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
STATE_PROPERTY_KEY
,
AtlasEntity
.
Status
.
ACTIVE
.
name
());
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
TIMESTAMP_PROPERTY_KEY
,
RequestContext
.
get
().
getRequestTime
());
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
MODIFICATION_TIMESTAMP_PROPERTY_KEY
,
RequestContext
.
get
().
getRequestTime
());
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
CREATED_BY_KEY
,
RequestContext
.
get
().
getUser
());
GraphHelper
.
setProperty
(
ret
,
Constants
.
MODIFIED_BY_KEY
,
RequestContext
.
get
().
getUser
());
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== createStructVertex({})"
,
struct
.
getTypeName
());
...
...
@@ -264,8 +265,8 @@ public class EntityGraphMapper {
AtlasVertex
ret
=
createStructVertex
(
classification
);
AtlasGraphUtilsV
1
.
addProperty
(
ret
,
Constants
.
SUPER_TYPES_PROPERTY_KEY
,
classificationType
.
getAllSuperTypes
());
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
CLASSIFICATION_ENTITY_GUID
,
classification
.
getEntityGuid
());
AtlasGraphUtilsV
2
.
addProperty
(
ret
,
Constants
.
SUPER_TYPES_PROPERTY_KEY
,
classificationType
.
getAllSuperTypes
());
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
CLASSIFICATION_ENTITY_GUID
,
classification
.
getEntityGuid
());
return
ret
;
}
...
...
@@ -376,7 +377,7 @@ public class EntityGraphMapper {
return
mapPrimitiveValue
(
ctx
);
case
STRUCT:
{
String
edgeLabel
=
AtlasGraphUtilsV
1
.
getEdgeLabel
(
ctx
.
getVertexProperty
());
String
edgeLabel
=
AtlasGraphUtilsV
2
.
getEdgeLabel
(
ctx
.
getVertexProperty
());
AtlasEdge
currentEdge
=
graphHelper
.
getEdgeForLabel
(
ctx
.
getReferringVertex
(),
edgeLabel
);
AtlasEdge
edge
=
currentEdge
!=
null
?
currentEdge
:
null
;
...
...
@@ -397,7 +398,7 @@ public class EntityGraphMapper {
// if relationshipDefs doesn't exist, use legacy way of finding edge label.
if
(
StringUtils
.
isEmpty
(
edgeLabel
))
{
edgeLabel
=
AtlasGraphUtilsV
1
.
getEdgeLabel
(
ctx
.
getVertexProperty
());
edgeLabel
=
AtlasGraphUtilsV
2
.
getEdgeLabel
(
ctx
.
getVertexProperty
());
}
String
relationshipGuid
=
getRelationshipGuid
(
ctx
.
getValue
());
...
...
@@ -476,7 +477,7 @@ public class EntityGraphMapper {
AtlasVertex
inverseVertex
=
edge
.
getInVertex
();
String
inverseEdgeLabel
=
inverseAttribute
.
getRelationshipEdgeLabel
();
AtlasEdge
inverseEdge
=
graphHelper
.
getEdgeForLabel
(
inverseVertex
,
inverseEdgeLabel
);
String
propertyName
=
AtlasGraphUtilsV
1
.
getQualifiedAttributePropertyKey
(
inverseType
,
inverseAttribute
.
getName
());
String
propertyName
=
AtlasGraphUtilsV
2
.
getQualifiedAttributePropertyKey
(
inverseType
,
inverseAttribute
.
getName
());
// create new inverse reference
AtlasEdge
newEdge
=
createInverseReferenceUsingRelationship
(
context
,
inverseAttribute
,
edge
,
relationshipAttributes
);
...
...
@@ -520,7 +521,7 @@ public class EntityGraphMapper {
}
if
(
inverseUpdated
)
{
RequestContext
V1
requestContext
=
RequestContextV1
.
get
();
RequestContext
requestContext
=
RequestContext
.
get
();
if
(!
requestContext
.
isDeletedEntity
(
GraphHelper
.
getGuid
(
inverseVertex
)))
{
updateModificationMetadata
(
inverseVertex
);
...
...
@@ -552,7 +553,7 @@ public class EntityGraphMapper {
}
else
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"No RelationshipDef defined between {} and {} on attribute: {}"
,
inverseAttributeType
,
AtlasGraphUtilsV1
.
getTypeName
(
vertex
),
inverseAttributeName
);
AtlasGraphUtilsV2
.
getTypeName
(
vertex
),
inverseAttributeName
);
}
// if no RelationshipDef found, use legacy way to create edges
ret
=
createInverseReference
(
inverseAttribute
,
(
AtlasStructType
)
inverseAttributeType
,
inverseVertex
,
vertex
);
...
...
@@ -591,15 +592,15 @@ public class EntityGraphMapper {
return
;
}
AtlasGraphUtilsV
1
.
setProperty
(
edge
,
Constants
.
RELATIONSHIP_GUID_PROPERTY_KEY
,
parentRelationshipGuid
);
AtlasGraphUtilsV
2
.
setProperty
(
edge
,
Constants
.
RELATIONSHIP_GUID_PROPERTY_KEY
,
parentRelationshipGuid
);
}
// legacy method to create edges for inverse reference
private
AtlasEdge
createInverseReference
(
AtlasAttribute
inverseAttribute
,
AtlasStructType
inverseAttributeType
,
AtlasVertex
inverseVertex
,
AtlasVertex
vertex
)
throws
AtlasBaseException
{
String
propertyName
=
AtlasGraphUtilsV
1
.
getQualifiedAttributePropertyKey
(
inverseAttributeType
,
inverseAttribute
.
getName
());
String
inverseEdgeLabel
=
AtlasGraphUtilsV
1
.
getEdgeLabel
(
propertyName
);
String
propertyName
=
AtlasGraphUtilsV
2
.
getQualifiedAttributePropertyKey
(
inverseAttributeType
,
inverseAttribute
.
getName
());
String
inverseEdgeLabel
=
AtlasGraphUtilsV
2
.
getEdgeLabel
(
propertyName
);
AtlasEdge
ret
;
try
{
...
...
@@ -613,7 +614,7 @@ public class EntityGraphMapper {
}
private
Object
mapPrimitiveValue
(
AttributeMutationContext
ctx
)
{
AtlasGraphUtilsV
1
.
setProperty
(
ctx
.
getReferringVertex
(),
ctx
.
getVertexProperty
(),
ctx
.
getValue
());
AtlasGraphUtilsV
2
.
setProperty
(
ctx
.
getReferringVertex
(),
ctx
.
getVertexProperty
(),
ctx
.
getValue
());
return
ctx
.
getValue
();
}
...
...
@@ -639,7 +640,7 @@ public class EntityGraphMapper {
ret
=
ctx
.
getCurrentEdge
();
}
else
if
(
ctx
.
getValue
()
!=
null
)
{
String
edgeLabel
=
AtlasGraphUtilsV
1
.
getEdgeLabel
(
ctx
.
getVertexProperty
());
String
edgeLabel
=
AtlasGraphUtilsV
2
.
getEdgeLabel
(
ctx
.
getVertexProperty
());
AtlasStruct
structVal
=
null
;
if
(
ctx
.
getValue
()
instanceof
AtlasStruct
)
{
...
...
@@ -686,7 +687,7 @@ public class EntityGraphMapper {
if
(
ctx
.
getCurrentEdge
()
!=
null
)
{
ret
=
updateEdge
(
ctx
.
getAttributeDef
(),
ctx
.
getValue
(),
ctx
.
getCurrentEdge
(),
entityVertex
);
}
else
if
(
ctx
.
getValue
()
!=
null
)
{
String
edgeLabel
=
AtlasGraphUtilsV
1
.
getEdgeLabel
(
ctx
.
getVertexProperty
());
String
edgeLabel
=
AtlasGraphUtilsV
2
.
getEdgeLabel
(
ctx
.
getVertexProperty
());
try
{
ret
=
graphHelper
.
getOrCreateEdge
(
ctx
.
getReferringVertex
(),
entityVertex
,
edgeLabel
);
...
...
@@ -726,7 +727,7 @@ public class EntityGraphMapper {
}
String
attributeName
=
ctx
.
getAttribute
().
getName
();
AtlasType
type
=
typeRegistry
.
getType
(
AtlasGraphUtilsV
1
.
getTypeName
(
entityVertex
));
AtlasType
type
=
typeRegistry
.
getType
(
AtlasGraphUtilsV
2
.
getTypeName
(
entityVertex
));
AtlasRelationshipEdgeDirection
edgeDirection
=
ctx
.
getAttribute
().
getRelationshipEdgeDirection
();
String
edgeLabel
=
ctx
.
getAttribute
().
getRelationshipEdgeLabel
();
...
...
@@ -762,7 +763,7 @@ public class EntityGraphMapper {
if
(
context
.
isImport
())
{
String
relationshipGuid
=
getRelationshipGuid
(
ctx
.
getValue
());
if
(!
StringUtils
.
isEmpty
(
relationshipGuid
))
{
AtlasGraphUtilsV
1
.
setProperty
(
ret
,
Constants
.
RELATIONSHIP_GUID_PROPERTY_KEY
,
relationshipGuid
);
AtlasGraphUtilsV
2
.
setProperty
(
ret
,
Constants
.
RELATIONSHIP_GUID_PROPERTY_KEY
,
relationshipGuid
);
}
}
...
...
@@ -911,7 +912,7 @@ public class EntityGraphMapper {
Object
element
=
newElementsCreated
.
get
(
index
);
if
(
element
instanceof
AtlasEdge
)
{
AtlasGraphUtilsV
1
.
setProperty
((
AtlasEdge
)
element
,
ATTRIBUTE_INDEX_PROPERTY_KEY
,
index
);
AtlasGraphUtilsV
2
.
setProperty
((
AtlasEdge
)
element
,
ATTRIBUTE_INDEX_PROPERTY_KEY
,
index
);
}
}
...
...
@@ -1162,7 +1163,7 @@ public class EntityGraphMapper {
if
(!
currentEntityId
.
equals
(
newEntityId
))
{
// create a new relationship edge to the new attribute vertex from the instance
String
relationshipName
=
AtlasGraphUtilsV
1
.
getTypeName
(
currentEdge
);
String
relationshipName
=
AtlasGraphUtilsV
2
.
getTypeName
(
currentEdge
);
if
(
relationshipName
==
null
)
{
relationshipName
=
currentEdge
.
getLabel
();
...
...
@@ -1270,13 +1271,13 @@ public class EntityGraphMapper {
public
void
addClassifications
(
final
EntityMutationContext
context
,
String
guid
,
List
<
AtlasClassification
>
classifications
)
throws
AtlasBaseException
{
if
(
CollectionUtils
.
isNotEmpty
(
classifications
))
{
AtlasVertex
entityVertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
guid
);
AtlasVertex
entityVertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
guid
);
if
(
entityVertex
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
}
final
String
entityTypeName
=
AtlasGraphUtilsV
1
.
getTypeName
(
entityVertex
);
final
String
entityTypeName
=
AtlasGraphUtilsV
2
.
getTypeName
(
entityVertex
);
final
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
entityTypeName
);
List
<
AtlasVertex
>
entitiesToPropagateTo
=
null
;
Map
<
AtlasVertex
,
List
<
AtlasClassification
>>
propagations
=
null
;
...
...
@@ -1390,7 +1391,7 @@ public class EntityGraphMapper {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_CLASSIFICATION_PARAMS
,
"delete"
,
entityGuid
);
}
AtlasVertex
entityVertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
entityGuid
);
AtlasVertex
entityVertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
entityGuid
);
if
(
entityVertex
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
entityGuid
);
...
...
@@ -1473,13 +1474,13 @@ public class EntityGraphMapper {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_CLASSIFICATION_PARAMS
,
"update"
,
guid
);
}
AtlasVertex
entityVertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
guid
);
AtlasVertex
entityVertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
guid
);
if
(
entityVertex
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
}
String
entityTypeName
=
AtlasGraphUtilsV
1
.
getTypeName
(
entityVertex
);
String
entityTypeName
=
AtlasGraphUtilsV
2
.
getTypeName
(
entityVertex
);
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
entityTypeName
);
List
<
AtlasClassification
>
updatedClassifications
=
new
ArrayList
<>();
List
<
AtlasVertex
>
entitiesToPropagateTo
=
new
ArrayList
<>();
...
...
@@ -1634,13 +1635,13 @@ public class EntityGraphMapper {
if
(
classification
.
getValidityPeriods
()
!=
null
)
{
String
strValidityPeriods
=
AtlasJson
.
toJson
(
classification
.
getValidityPeriods
());
AtlasGraphUtilsV
1
.
setProperty
(
traitInstanceVertex
,
Constants
.
CLASSIFICATION_VALIDITY_PERIODS_KEY
,
strValidityPeriods
);
AtlasGraphUtilsV
2
.
setProperty
(
traitInstanceVertex
,
Constants
.
CLASSIFICATION_VALIDITY_PERIODS_KEY
,
strValidityPeriods
);
}
else
{
// if 'null', don't update existing value in the classification
}
if
(
classification
.
isPropagate
()
!=
null
)
{
AtlasGraphUtilsV
1
.
setProperty
(
traitInstanceVertex
,
Constants
.
CLASSIFICATION_VERTEX_PROPAGATE_KEY
,
classification
.
isPropagate
());
AtlasGraphUtilsV
2
.
setProperty
(
traitInstanceVertex
,
Constants
.
CLASSIFICATION_VERTEX_PROPAGATE_KEY
,
classification
.
isPropagate
());
}
// map all the attributes to this newly created AtlasVertex
...
...
@@ -1656,7 +1657,7 @@ public class EntityGraphMapper {
}
public
void
deleteClassifications
(
String
guid
)
throws
AtlasBaseException
{
AtlasVertex
instanceVertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
guid
);
AtlasVertex
instanceVertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
guid
);
if
(
instanceVertex
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
...
...
@@ -1710,7 +1711,7 @@ public class EntityGraphMapper {
}
private
void
recordEntityUpdate
(
AtlasVertex
vertex
)
throws
AtlasBaseException
{
RequestContext
V1
req
=
RequestContextV1
.
get
();
RequestContext
req
=
RequestContext
.
get
();
if
(!
req
.
isUpdatedEntity
(
GraphHelper
.
getGuid
(
vertex
)))
{
updateModificationMetadata
(
vertex
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/EntityGraphRetriever.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/EntityGraphRetriever.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
org.apache.atlas.AtlasErrorCode
;
...
...
@@ -110,8 +110,8 @@ import static org.apache.atlas.repository.graph.GraphHelper.getPropagateTags;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getRelationshipGuid
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
getTypeName
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
isPropagationEnabled
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
getIdFromVertex
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
AtlasGraphUtilsV1
.
isReference
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
getIdFromVertex
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
AtlasGraphUtilsV2
.
isReference
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasStructType
.
AtlasAttribute
.
AtlasRelationshipEdgeDirection
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasStructType
.
AtlasAttribute
.
AtlasRelationshipEdgeDirection
.
BOTH
;
import
static
org
.
apache
.
atlas
.
type
.
AtlasStructType
.
AtlasAttribute
.
AtlasRelationshipEdgeDirection
.
IN
;
...
...
@@ -279,10 +279,10 @@ public final class EntityGraphRetriever {
public
AtlasClassification
toAtlasClassification
(
AtlasVertex
classificationVertex
)
throws
AtlasBaseException
{
AtlasClassification
ret
=
new
AtlasClassification
(
getTypeName
(
classificationVertex
));
ret
.
setEntityGuid
(
AtlasGraphUtilsV
1
.
getProperty
(
classificationVertex
,
CLASSIFICATION_ENTITY_GUID
,
String
.
class
));
ret
.
setEntityGuid
(
AtlasGraphUtilsV
2
.
getProperty
(
classificationVertex
,
CLASSIFICATION_ENTITY_GUID
,
String
.
class
));
ret
.
setPropagate
(
isPropagationEnabled
(
classificationVertex
));
String
strValidityPeriods
=
AtlasGraphUtilsV
1
.
getProperty
(
classificationVertex
,
CLASSIFICATION_VALIDITY_PERIODS_KEY
,
String
.
class
);
String
strValidityPeriods
=
AtlasGraphUtilsV
2
.
getProperty
(
classificationVertex
,
CLASSIFICATION_VALIDITY_PERIODS_KEY
,
String
.
class
);
if
(
strValidityPeriods
!=
null
)
{
ret
.
setValidityPeriods
(
AtlasJson
.
fromJson
(
strValidityPeriods
,
TIME_BOUNDARIES_LIST_TYPE
));
...
...
@@ -314,7 +314,7 @@ public final class EntityGraphRetriever {
}
public
AtlasVertex
getEntityVertex
(
String
guid
)
throws
AtlasBaseException
{
AtlasVertex
ret
=
AtlasGraphUtilsV
1
.
findByGuid
(
guid
);
AtlasVertex
ret
=
AtlasGraphUtilsV
2
.
findByGuid
(
guid
);
if
(
ret
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
...
...
@@ -331,12 +331,12 @@ public final class EntityGraphRetriever {
}
if
(
AtlasTypeUtil
.
isAssignedGuid
(
objId
))
{
ret
=
AtlasGraphUtilsV
1
.
findByGuid
(
objId
.
getGuid
());
ret
=
AtlasGraphUtilsV
2
.
findByGuid
(
objId
.
getGuid
());
}
else
{
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
objId
.
getTypeName
());
Map
<
String
,
Object
>
uniqAttributes
=
objId
.
getUniqueAttributes
();
ret
=
AtlasGraphUtilsV
1
.
getVertexByUniqueAttributes
(
entityType
,
uniqAttributes
);
ret
=
AtlasGraphUtilsV
2
.
getVertexByUniqueAttributes
(
entityType
,
uniqAttributes
);
}
if
(
ret
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/EntityImportStream.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/EntityImportStream.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/EntityMutationContext.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/EntityMutationContext.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/EntityStream.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/EntityStream.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/IDBasedEntityResolver.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/IDBasedEntityResolver.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -49,7 +49,7 @@ public class IDBasedEntityResolver implements EntityResolver {
for
(
String
guid
:
context
.
getReferencedGuids
())
{
boolean
isAssignedGuid
=
AtlasTypeUtil
.
isAssignedGuid
(
guid
);
AtlasVertex
vertex
=
isAssignedGuid
?
AtlasGraphUtilsV
1
.
findByGuid
(
guid
)
:
null
;
AtlasVertex
vertex
=
isAssignedGuid
?
AtlasGraphUtilsV
2
.
findByGuid
(
guid
)
:
null
;
if
(
vertex
==
null
&&
!(
entityStream
instanceof
EntityImportStream
))
{
// if not found in the store, look if the entity is present in the stream
AtlasEntity
entity
=
entityStream
.
getByGuid
(
guid
);
...
...
@@ -61,7 +61,7 @@ public class IDBasedEntityResolver implements EntityResolver {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_NAME_INVALID
,
TypeCategory
.
ENTITY
.
name
(),
entity
.
getTypeName
());
}
vertex
=
AtlasGraphUtilsV
1
.
findByUniqueAttributes
(
entityType
,
entity
.
getAttributes
());
vertex
=
AtlasGraphUtilsV
2
.
findByUniqueAttributes
(
entityType
,
entity
.
getAttributes
());
}
else
if
(!
isAssignedGuid
)
{
// for local-guids, entity must be in the stream
throw
new
AtlasBaseException
(
AtlasErrorCode
.
REFERENCED_ENTITY_NOT_FOUND
,
guid
);
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/InMemoryMapEntityStream.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/InMemoryMapEntityStream.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/InstanceGraphMapper.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/InstanceGraphMapper.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v
1
/UniqAttrBasedEntityResolver.java
→
repository/src/main/java/org/apache/atlas/repository/store/graph/v
2
/UniqAttrBasedEntityResolver.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -59,7 +59,7 @@ public class UniqAttrBasedEntityResolver implements EntityResolver {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_NAME_INVALID
,
TypeCategory
.
ENTITY
.
name
(),
objId
.
getTypeName
());
}
AtlasVertex
vertex
=
AtlasGraphUtilsV
1
.
findByUniqueAttributes
(
entityType
,
objId
.
getUniqueAttributes
());
AtlasVertex
vertex
=
AtlasGraphUtilsV
2
.
findByUniqueAttributes
(
entityType
,
objId
.
getUniqueAttributes
());
if
(
vertex
!=
null
)
{
context
.
addResolvedIdByUniqAttribs
(
objId
,
vertex
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
View file @
3d5b4880
...
...
@@ -96,7 +96,7 @@ public class AtlasRepositoryConfiguration {
try
{
Configuration
config
=
ApplicationProperties
.
get
();
return
ApplicationProperties
.
getClass
(
config
,
DELETE_HANDLER_V1_IMPLEMENTATION_PROPERTY
,
SoftDeleteHandlerV1
.
class
.
getName
(),
DeleteHandlerV1
.
class
);
DELETE_HANDLER_V1_IMPLEMENTATION_PROPERTY
,
SoftDeleteHandlerV1
.
class
.
getName
(),
DeleteHandlerV1
.
class
);
}
catch
(
AtlasException
e
)
{
throw
new
RuntimeException
(
e
);
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/util/SearchPredicateUtil.java
View file @
3d5b4880
...
...
@@ -18,7 +18,7 @@
package
org
.
apache
.
atlas
.
util
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.Predicate
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -680,7 +680,7 @@ public class SearchPredicateUtil {
if
(
Collection
.
class
.
isAssignableFrom
(
attrClass
))
{
attrValue
=
vertex
.
getPropertyValues
(
attrName
,
attrClass
);
}
else
{
attrValue
=
AtlasGraphUtilsV
1
.
getProperty
(
vertex
,
attrName
,
attrClass
);
attrValue
=
AtlasGraphUtilsV
2
.
getProperty
(
vertex
,
attrName
,
attrClass
);
}
ret
=
(
isNullValid
||
attrValue
!=
null
)
&&
compareValue
(
attrValue
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/TestModules.java
View file @
3d5b4880
...
...
@@ -50,13 +50,13 @@ import org.apache.atlas.repository.ogm.glossary.AtlasGlossaryTermDTO;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.AtlasRelationshipStore
;
import
org.apache.atlas.repository.store.graph.BulkImporter
;
import
org.apache.atlas.repository.store.graph.v
1
.AtlasEntityChangeNotifier
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasEntityStoreV1
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasRelationshipStoreV1
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasTypeDefGraphStoreV1
;
import
org.apache.atlas.repository.store.graph.v
1
.BulkImporterImpl
;
import
org.apache.atlas.repository.store.graph.v
2
.AtlasEntityChangeNotifier
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasEntityStoreV2
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasRelationshipStoreV2
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasTypeDefGraphStoreV2
;
import
org.apache.atlas.repository.store.graph.v
2
.BulkImporterImpl
;
import
org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityGraphMapper
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityGraphMapper
;
import
org.apache.atlas.repository.store.graph.v1.HardDeleteHandlerV1
;
import
org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1
;
import
org.apache.atlas.runner.LocalSolrRunner
;
...
...
@@ -129,7 +129,7 @@ public class TestModules {
bind
(
Configuration
.
class
).
toProvider
(
AtlasConfigurationProvider
.
class
).
in
(
Singleton
.
class
);
// bind the AtlasTypeDefStore interface to an implementation
bind
(
AtlasTypeDefStore
.
class
).
to
(
AtlasTypeDefGraphStoreV
1
.
class
).
asEagerSingleton
();
bind
(
AtlasTypeDefStore
.
class
).
to
(
AtlasTypeDefGraphStoreV
2
.
class
).
asEagerSingleton
();
bind
(
AtlasTypeRegistry
.
class
).
asEagerSingleton
();
bind
(
EntityGraphMapper
.
class
).
asEagerSingleton
();
...
...
@@ -142,8 +142,8 @@ public class TestModules {
bind
(
SearchTracker
.
class
).
asEagerSingleton
();
bind
(
AtlasEntityStore
.
class
).
to
(
AtlasEntityStoreV
1
.
class
);
bind
(
AtlasRelationshipStore
.
class
).
to
(
AtlasRelationshipStoreV
1
.
class
);
bind
(
AtlasEntityStore
.
class
).
to
(
AtlasEntityStoreV
2
.
class
);
bind
(
AtlasRelationshipStore
.
class
).
to
(
AtlasRelationshipStoreV
2
.
class
);
// bind the DiscoveryService interface to an implementation
bind
(
AtlasDiscoveryService
.
class
).
to
(
EntityDiscoveryService
.
class
).
asEagerSingleton
();
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/glossary/GlossaryServiceTest.java
View file @
3d5b4880
...
...
@@ -38,7 +38,7 @@ import org.apache.atlas.model.typedef.AtlasClassificationDef;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.repository.impexp.ZipFileResourceTestUtils
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.v
1
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v
2
.AtlasEntityStream
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.utils.AtlasJson
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/query/BasicTestSetup.java
View file @
3d5b4880
...
...
@@ -24,13 +24,11 @@ import org.apache.atlas.exception.AtlasBaseException;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.typedef.*
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.v
1
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v
2
.AtlasEntityStream
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
javax.inject.Inject
;
import
java.io.IOException
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
View file @
3d5b4880
...
...
@@ -18,7 +18,7 @@
package
org
.
apache
.
atlas
.
repository
.
impexp
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -29,11 +29,11 @@ import org.apache.atlas.model.instance.AtlasObjectId;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer
;
import
org.apache.atlas.repository.store.graph.v
1
.AtlasEntityChangeNotifier
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasEntityStoreV1
;
import
org.apache.atlas.repository.store.graph.v
1
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v
2
.AtlasEntityChangeNotifier
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasEntityStoreV2
;
import
org.apache.atlas.repository.store.graph.v
2
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityGraphMapper
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityGraphMapper
;
import
org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1
;
import
org.apache.atlas.runner.LocalSolrRunner
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
...
...
@@ -51,7 +51,6 @@ import org.testng.annotations.Test;
import
javax.inject.Inject
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.ArrayList
;
...
...
@@ -81,17 +80,17 @@ public class ExportServiceTest {
ExportService
exportService
;
private
DeleteHandlerV1
deleteHandler
=
mock
(
SoftDeleteHandlerV1
.
class
);;
private
AtlasEntityChangeNotifier
mockChangeNotifier
=
mock
(
AtlasEntityChangeNotifier
.
class
);
private
AtlasEntityStoreV
1
entityStore
;
private
AtlasEntityStoreV
2
entityStore
;
@BeforeTest
public
void
setupTest
()
{
RequestContext
V1
.
clear
();
RequestContext
V1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
RequestContext
.
clear
();
RequestContext
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
}
@BeforeClass
public
void
setupSampleData
()
throws
AtlasBaseException
{
entityStore
=
new
AtlasEntityStoreV
1
(
deleteHandler
,
typeRegistry
,
mockChangeNotifier
,
graphMapper
);;
entityStore
=
new
AtlasEntityStoreV
2
(
deleteHandler
,
typeRegistry
,
mockChangeNotifier
,
graphMapper
);;
AtlasTypesDef
sampleTypes
=
TestUtilsV2
.
defineDeptEmployeeTypes
();
AtlasTypesDef
typesToCreate
=
AtlasTypeDefStoreInitializer
.
getTypesToCreate
(
sampleTypes
,
typeRegistry
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
View file @
3d5b4880
...
...
@@ -19,7 +19,7 @@ package org.apache.atlas.repository.impexp;
import
com.google.inject.Inject
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.discovery.EntityDiscoveryService
;
...
...
@@ -81,8 +81,8 @@ public class ImportServiceTest {
@BeforeTest
public
void
setupTest
()
{
RequestContext
V1
.
clear
();
RequestContext
V1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
RequestContext
.
clear
();
RequestContext
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
}
@AfterClass
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/impexp/ZipFileResourceTestUtils.java
View file @
3d5b4880
...
...
@@ -18,7 +18,7 @@
package
org
.
apache
.
atlas
.
repository
.
impexp
;
import
com.google.common.collect.Sets
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.impexp.AtlasExportResult
;
...
...
@@ -247,8 +247,8 @@ public class ZipFileResourceTestUtils {
AtlasExportResult
exportResult
=
zipSource
.
getExportResult
();
List
<
String
>
creationOrder
=
zipSource
.
getCreationOrder
();
RequestContext
V1
.
clear
();
RequestContext
V1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
RequestContext
.
clear
();
RequestContext
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
AtlasImportRequest
request
=
getDefaultImportRequest
();
AtlasImportResult
result
=
runImportWithParameters
(
importService
,
request
,
zipSource
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
View file @
3d5b4880
...
...
@@ -18,7 +18,7 @@
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
;
import
com.google.inject.Inject
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -56,8 +56,8 @@ public class AtlasTypeDefGraphStoreTest {
@BeforeTest
public
void
setupTest
()
{
RequestContext
V1
.
clear
();
RequestContext
V1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
RequestContext
.
clear
();
RequestContext
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
}
@AfterClass
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1
/AtlasComplexAttributesTest.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2
/AtlasComplexAttributesTest.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.TestUtilsV2
;
...
...
@@ -486,7 +486,7 @@ public class AtlasComplexAttributesTest extends AtlasEntityTestBase {
AtlasEntityHeader
entityDeleted
=
response
.
getFirstDeletedEntityByTypeName
(
ENTITY_TYPE_WITH_COMPLEX_COLLECTION_ATTR
);
AtlasEntityWithExtInfo
deletedEntityWithExtInfo
=
entityStore
.
getById
(
entityDeleted
.
getGuid
());
AtlasVertex
deletedEntityVertex
=
AtlasGraphUtilsV
1
.
findByGuid
(
entityDeleted
.
getGuid
());
AtlasVertex
deletedEntityVertex
=
AtlasGraphUtilsV
2
.
findByGuid
(
entityDeleted
.
getGuid
());
Iterator
<
AtlasEdge
>
edges
=
deletedEntityVertex
.
getEdges
(
AtlasEdgeDirection
.
OUT
).
iterator
();
// validate all attribute edges are deleted
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1/AtlasEntityDefStoreV1
Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2/AtlasEntityDefStoreV2
Test.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.inject.Inject
;
import
org.apache.atlas.ApplicationProperties
;
...
...
@@ -41,11 +41,11 @@ import static org.apache.atlas.graph.GraphSandboxUtil.useLocalSolr;
* Tests for AtlasEntityStoreV1
*/
@Guice
(
modules
=
TestModules
.
TestOnlyModule
.
class
)
public
class
AtlasEntityDefStoreV
1
Test
{
public
class
AtlasEntityDefStoreV
2
Test
{
@Inject
private
AtlasEntityDefStoreV
1
entityDefStore
;
AtlasEntityDefStoreV
2
entityDefStore
;
@DataProvider
public
Object
[][]
invalidAttributeNameWithReservedKeywords
(){
...
...
@@ -62,7 +62,7 @@ public class AtlasEntityDefStoreV1Test {
@Test
(
dataProvider
=
"invalidAttributeNameWithReservedKeywords"
)
public
void
testCreateTypeWithReservedKeywords
(
AtlasEntityDef
atlasEntityDef
)
throws
AtlasException
{
try
{
ApplicationProperties
.
get
().
setProperty
(
AtlasAbstractDefStoreV
1
.
ALLOW_RESERVED_KEYWORDS
,
false
);
ApplicationProperties
.
get
().
setProperty
(
AtlasAbstractDefStoreV
2
.
ALLOW_RESERVED_KEYWORDS
,
false
);
entityDefStore
.
create
(
atlasEntityDef
,
null
);
}
catch
(
AtlasBaseException
e
)
{
Assert
.
assertEquals
(
e
.
getAtlasErrorCode
(),
AtlasErrorCode
.
ATTRIBUTE_NAME_INVALID
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1/AtlasEntityStoreV1
BulkImportPercentTest.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2/AtlasEntityStoreV2
BulkImportPercentTest.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.mockito.invocation.InvocationOnMock
;
import
org.mockito.stubbing.Answer
;
...
...
@@ -32,7 +32,7 @@ import static org.mockito.Mockito.mock;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
public
class
AtlasEntityStoreV
1
BulkImportPercentTest
{
public
class
AtlasEntityStoreV
2
BulkImportPercentTest
{
private
final
int
MAX_PERCENT
=
100
;
private
List
<
Integer
>
percentHolder
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1/AtlasEntityStoreV1
Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2/AtlasEntityStoreV2
Test.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.atlas.AtlasErrorCode
;
...
...
@@ -62,7 +62,7 @@ import static org.testng.Assert.assertTrue;
import
static
org
.
testng
.
Assert
.
fail
;
@Guice
(
modules
=
TestModules
.
TestOnlyModule
.
class
)
public
class
AtlasEntityStoreV
1
Test
extends
AtlasEntityTestBase
{
public
class
AtlasEntityStoreV
2
Test
extends
AtlasEntityTestBase
{
private
AtlasEntitiesWithExtInfo
deptEntity
;
private
AtlasEntityWithExtInfo
dbEntity
;
private
AtlasEntityWithExtInfo
tblEntity
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1
/AtlasEntityTestBase.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2
/AtlasEntityTestBase.java
View file @
3d5b4880
...
...
@@ -15,10 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -38,6 +38,7 @@ import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1
;
import
org.apache.atlas.runner.LocalSolrRunner
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasArrayType
;
...
...
@@ -89,8 +90,8 @@ public class AtlasEntityTestBase {
@BeforeClass
public
void
setUp
()
throws
Exception
{
RequestContext
V1
.
clear
();
RequestContext
V1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
RequestContext
.
clear
();
RequestContext
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
new
GraphBackedSearchIndexer
(
typeRegistry
);
}
...
...
@@ -106,10 +107,10 @@ public class AtlasEntityTestBase {
@BeforeTest
public
void
init
()
throws
Exception
{
entityStore
=
new
AtlasEntityStoreV
1
(
deleteHandler
,
typeRegistry
,
mockChangeNotifier
,
graphMapper
);
entityStore
=
new
AtlasEntityStoreV
2
(
deleteHandler
,
typeRegistry
,
mockChangeNotifier
,
graphMapper
);
RequestContext
V1
.
clear
();
RequestContext
V1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
RequestContext
.
clear
();
RequestContext
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
}
protected
AtlasClassificationDef
getTagWithName
(
AtlasTypesDef
typesDef
,
String
tagName
,
String
attributeType
)
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1/AtlasRelationshipDefStoreV1
Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2/AtlasRelationshipDefStoreV2
Test.java
View file @
3d5b4880
...
...
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.inject.Inject
;
import
org.apache.atlas.ApplicationProperties
;
...
...
@@ -42,11 +42,11 @@ import static org.testng.AssertJUnit.fail;
* Tests for AtlasRelationshipStoreV1
*/
@Guice
(
modules
=
TestModules
.
TestOnlyModule
.
class
)
public
class
AtlasRelationshipDefStoreV
1
Test
{
public
class
AtlasRelationshipDefStoreV
2
Test
{
@Inject
private
AtlasRelationshipDefStoreV
1
relationshipDefStore
;
AtlasRelationshipDefStoreV
2
relationshipDefStore
;
@DataProvider
public
Object
[][]
invalidAttributeNameWithReservedKeywords
(){
...
...
@@ -264,7 +264,7 @@ public class AtlasRelationshipDefStoreV1Test {
@Test
(
dataProvider
=
"invalidAttributeNameWithReservedKeywords"
)
public
void
testCreateTypeWithReservedKeywords
(
AtlasRelationshipDef
atlasRelationshipDef
)
throws
AtlasException
{
try
{
ApplicationProperties
.
get
().
setProperty
(
AtlasAbstractDefStoreV
1
.
ALLOW_RESERVED_KEYWORDS
,
false
);
ApplicationProperties
.
get
().
setProperty
(
AtlasAbstractDefStoreV
2
.
ALLOW_RESERVED_KEYWORDS
,
false
);
relationshipDefStore
.
create
(
atlasRelationshipDef
,
null
);
}
catch
(
AtlasBaseException
e
)
{
Assert
.
assertEquals
(
e
.
getAtlasErrorCode
(),
AtlasErrorCode
.
ATTRIBUTE_NAME_INVALID
);
...
...
@@ -273,14 +273,14 @@ public class AtlasRelationshipDefStoreV1Test {
@Test
(
dataProvider
=
"updateValidProperties"
)
public
void
testupdateVertexPreUpdatepropagateTags
(
AtlasRelationshipDef
existingRelationshipDef
,
AtlasRelationshipDef
newRelationshipDef
)
throws
AtlasBaseException
{
AtlasRelationshipDefStoreV
1
.
preUpdateCheck
(
existingRelationshipDef
,
newRelationshipDef
);
AtlasRelationshipDefStoreV
2
.
preUpdateCheck
(
existingRelationshipDef
,
newRelationshipDef
);
}
@Test
(
dataProvider
=
"updateRename"
)
public
void
testupdateVertexPreUpdateRename
(
AtlasRelationshipDef
existingRelationshipDef
,
AtlasRelationshipDef
newRelationshipDef
)
{
try
{
AtlasRelationshipDefStoreV
1
.
preUpdateCheck
(
existingRelationshipDef
,
newRelationshipDef
);
AtlasRelationshipDefStoreV
2
.
preUpdateCheck
(
existingRelationshipDef
,
newRelationshipDef
);
fail
(
"expected error"
);
}
catch
(
AtlasBaseException
e
)
{
if
(!
e
.
getAtlasErrorCode
().
equals
(
AtlasErrorCode
.
RELATIONSHIPDEF_INVALID_NAME_UPDATE
)){
...
...
@@ -292,7 +292,7 @@ public class AtlasRelationshipDefStoreV1Test {
public
void
testupdateVertexPreUpdateRelcat
(
AtlasRelationshipDef
existingRelationshipDef
,
AtlasRelationshipDef
newRelationshipDef
)
{
try
{
AtlasRelationshipDefStoreV
1
.
preUpdateCheck
(
existingRelationshipDef
,
newRelationshipDef
);
AtlasRelationshipDefStoreV
2
.
preUpdateCheck
(
existingRelationshipDef
,
newRelationshipDef
);
fail
(
"expected error"
);
}
catch
(
AtlasBaseException
e
)
{
if
(!
e
.
getAtlasErrorCode
().
equals
(
AtlasErrorCode
.
RELATIONSHIPDEF_INVALID_CATEGORY_UPDATE
)){
...
...
@@ -304,7 +304,7 @@ public class AtlasRelationshipDefStoreV1Test {
public
void
testupdateVertexPreUpdateEnd1
(
AtlasRelationshipDef
existingRelationshipDef
,
AtlasRelationshipDef
newRelationshipDef
)
{
try
{
AtlasRelationshipDefStoreV
1
.
preUpdateCheck
(
existingRelationshipDef
,
newRelationshipDef
);
AtlasRelationshipDefStoreV
2
.
preUpdateCheck
(
existingRelationshipDef
,
newRelationshipDef
);
fail
(
"expected error"
);
}
catch
(
AtlasBaseException
e
)
{
if
(!
e
.
getAtlasErrorCode
().
equals
(
AtlasErrorCode
.
RELATIONSHIPDEF_INVALID_END1_UPDATE
)){
...
...
@@ -317,7 +317,7 @@ public class AtlasRelationshipDefStoreV1Test {
public
void
testupdateVertexPreUpdateEnd2
(
AtlasRelationshipDef
existingRelationshipDef
,
AtlasRelationshipDef
newRelationshipDef
)
{
try
{
AtlasRelationshipDefStoreV
1
.
preUpdateCheck
(
existingRelationshipDef
,
newRelationshipDef
);
AtlasRelationshipDefStoreV
2
.
preUpdateCheck
(
existingRelationshipDef
,
newRelationshipDef
);
fail
(
"expected error"
);
}
catch
(
AtlasBaseException
e
)
{
if
(!
e
.
getAtlasErrorCode
().
equals
(
AtlasErrorCode
.
RELATIONSHIPDEF_INVALID_END2_UPDATE
)){
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1/AtlasRelationshipStoreHardDeleteV1
Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2/AtlasRelationshipStoreHardDeleteV2
Test.java
View file @
3d5b4880
...
...
@@ -15,12 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.repository.store.graph.v1.HardDeleteHandlerV1
;
import
org.testng.annotations.Guice
;
import
java.util.List
;
...
...
@@ -34,7 +35,7 @@ import static org.testng.Assert.assertNull;
* Inverse reference update test with {@link HardDeleteHandlerV1}
*/
@Guice
(
modules
=
TestModules
.
HardDeleteModule
.
class
)
public
class
AtlasRelationshipStoreHardDeleteV
1Test
extends
AtlasRelationshipStoreV1
Test
{
public
class
AtlasRelationshipStoreHardDeleteV
2Test
extends
AtlasRelationshipStoreV2
Test
{
@Override
protected
void
verifyRelationshipAttributeUpdate_NonComposite_OneToMany
(
AtlasEntity
jane
)
throws
Exception
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1/AtlasRelationshipStoreSoftDeleteV1
Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2/AtlasRelationshipStoreSoftDeleteV2
Test.java
View file @
3d5b4880
...
...
@@ -15,12 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1
;
import
org.testng.annotations.Guice
;
import
java.util.List
;
...
...
@@ -34,7 +35,7 @@ import static org.testng.Assert.assertNotNull;
* Inverse reference update test with {@link SoftDeleteHandlerV1}
*/
@Guice
(
modules
=
TestModules
.
SoftDeleteModule
.
class
)
public
class
AtlasRelationshipStoreSoftDeleteV
1Test
extends
AtlasRelationshipStoreV1
Test
{
public
class
AtlasRelationshipStoreSoftDeleteV
2Test
extends
AtlasRelationshipStoreV2
Test
{
@Override
protected
void
verifyRelationshipAttributeUpdate_NonComposite_OneToMany
(
AtlasEntity
jane
)
throws
Exception
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1/AtlasRelationshipStoreV1
Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2/AtlasRelationshipStoreV2
Test.java
View file @
3d5b4880
...
...
@@ -15,11 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
org.apache.commons.configuration.Configuration
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -36,6 +35,7 @@ import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
import
org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.AtlasRelationshipStore
;
import
org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1
;
import
org.apache.atlas.runner.LocalSolrRunner
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasEntityType
;
...
...
@@ -68,7 +68,7 @@ import static org.testng.Assert.assertNull;
import
static
org
.
testng
.
Assert
.
assertTrue
;
@Guice
(
modules
=
TestModules
.
TestOnlyModule
.
class
)
public
abstract
class
AtlasRelationshipStoreV
1
Test
{
public
abstract
class
AtlasRelationshipStoreV
2
Test
{
@Inject
AtlasTypeRegistry
typeRegistry
;
...
...
@@ -77,7 +77,7 @@ public abstract class AtlasRelationshipStoreV1Test {
AtlasTypeDefStore
typeDefStore
;
@Inject
DeleteHandlerV1
deleteHandler
;
DeleteHandlerV1
deleteHandler
;
@Inject
EntityGraphMapper
graphMapper
;
...
...
@@ -118,11 +118,11 @@ public abstract class AtlasRelationshipStoreV1Test {
@BeforeTest
public
void
init
()
throws
Exception
{
entityStore
=
new
AtlasEntityStoreV
1
(
deleteHandler
,
typeRegistry
,
mockChangeNotifier
,
graphMapper
);
relationshipStore
=
new
AtlasRelationshipStoreV
1
(
typeRegistry
,
deleteHandler
,
entityNotifier
);
entityStore
=
new
AtlasEntityStoreV
2
(
deleteHandler
,
typeRegistry
,
mockChangeNotifier
,
graphMapper
);
relationshipStore
=
new
AtlasRelationshipStoreV
2
(
typeRegistry
,
deleteHandler
,
entityNotifier
);
RequestContext
V1
.
clear
();
RequestContext
V1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
RequestContext
.
clear
();
RequestContext
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
}
@AfterClass
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1/InverseReferenceUpdateHardDeleteV1
Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2/InverseReferenceUpdateHardDeleteV2
Test.java
View file @
3d5b4880
...
...
@@ -15,12 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.repository.store.graph.v1.HardDeleteHandlerV1
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.testng.annotations.Guice
;
...
...
@@ -33,7 +34,7 @@ import static org.testng.Assert.assertTrue;
* Inverse reference update test with {@link HardDeleteHandlerV1}
*/
@Guice
(
modules
=
TestModules
.
HardDeleteModule
.
class
)
public
class
InverseReferenceUpdateHardDeleteV
1Test
extends
InverseReferenceUpdateV1
Test
{
public
class
InverseReferenceUpdateHardDeleteV
2Test
extends
InverseReferenceUpdateV2
Test
{
@Override
protected
void
verify_testInverseReferenceAutoUpdate_NonComposite_OneToMany
(
AtlasEntity
jane
)
throws
Exception
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1/InverseReferenceUpdateSoftDeleteV1
Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2/InverseReferenceUpdateSoftDeleteV2
Test.java
View file @
3d5b4880
...
...
@@ -15,12 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.testng.annotations.Guice
;
...
...
@@ -34,7 +35,7 @@ import static org.testng.Assert.assertTrue;
* Inverse reference update test with {@link SoftDeleteHandlerV1}
*/
@Guice
(
modules
=
TestModules
.
SoftDeleteModule
.
class
)
public
class
InverseReferenceUpdateSoftDeleteV
1Test
extends
InverseReferenceUpdateV1
Test
{
public
class
InverseReferenceUpdateSoftDeleteV
2Test
extends
InverseReferenceUpdateV2
Test
{
@Override
protected
void
verify_testInverseReferenceAutoUpdate_NonComposite_OneToMany
(
AtlasEntity
jane
)
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v
1/InverseReferenceUpdateV1
Test.java
→
repository/src/test/java/org/apache/atlas/repository/store/graph/v
2/InverseReferenceUpdateV2
Test.java
View file @
3d5b4880
...
...
@@ -15,11 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
;
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableMap
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo
;
...
...
@@ -58,7 +58,7 @@ import static org.apache.atlas.TestUtilsV2.NAME;
* Test automatic inverse reference updating in V1 (V2?) code path.
*
*/
public
abstract
class
InverseReferenceUpdateV
1
Test
{
public
abstract
class
InverseReferenceUpdateV
2
Test
{
@Inject
AtlasTypeRegistry
typeRegistry
;
...
...
@@ -74,8 +74,8 @@ public abstract class InverseReferenceUpdateV1Test {
@BeforeClass
public
void
setUp
()
throws
Exception
{
RequestContext
V1
.
clear
();
RequestContext
V1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
RequestContext
.
clear
();
RequestContext
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
AtlasTypesDef
[]
testTypesDefs
=
new
AtlasTypesDef
[]
{
TestUtilsV2
.
defineDeptEmployeeTypes
(),
TestUtilsV2
.
defineInverseReferenceTestTypes
()
...
...
@@ -108,8 +108,8 @@ public abstract class InverseReferenceUpdateV1Test {
@BeforeMethod
public
void
init
()
throws
Exception
{
RequestContext
V1
.
clear
();
RequestContext
V1
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
RequestContext
.
clear
();
RequestContext
.
get
().
setUser
(
TestUtilsV2
.
TEST_USER
,
null
);
}
@Test
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/tagpropagation/ClassificationPropagationTest.java
View file @
3d5b4880
...
...
@@ -17,7 +17,7 @@
*/
package
org
.
apache
.
atlas
.
repository
.
tagpropagation
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.discovery.AtlasLineageService
;
import
org.apache.atlas.exception.AtlasBaseException
;
...
...
@@ -104,7 +104,7 @@ public class ClassificationPropagationTest {
@BeforeClass
public
void
setup
()
{
RequestContext
V1
.
clear
();
RequestContext
.
clear
();
loadModelFilesAndImportTestData
();
}
...
...
This diff is collapsed.
Click to expand it.
server-api/src/main/java/org/apache/atlas/RequestContext
V1
.java
→
server-api/src/main/java/org/apache/atlas/RequestContext.java
View file @
3d5b4880
...
...
@@ -27,10 +27,10 @@ import org.slf4j.LoggerFactory;
import
java.util.*
;
public
class
RequestContext
V1
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
RequestContext
V1
.
class
);
public
class
RequestContext
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
RequestContext
.
class
);
private
static
final
ThreadLocal
<
RequestContext
V1
>
CURRENT_CONTEXT
=
new
ThreadLocal
<>();
private
static
final
ThreadLocal
<
RequestContext
>
CURRENT_CONTEXT
=
new
ThreadLocal
<>();
private
final
Map
<
String
,
AtlasObjectId
>
updatedEntities
=
new
HashMap
<>();
private
final
Map
<
String
,
AtlasObjectId
>
deletedEntities
=
new
HashMap
<>();
...
...
@@ -44,16 +44,16 @@ public class RequestContextV1 {
private
String
clientIPAddress
;
private
RequestContext
V1
()
{
private
RequestContext
()
{
}
//To handle gets from background threads where createContext() is not called
//createContext called for every request in the filter
public
static
RequestContext
V1
get
()
{
RequestContext
V1
ret
=
CURRENT_CONTEXT
.
get
();
public
static
RequestContext
get
()
{
RequestContext
ret
=
CURRENT_CONTEXT
.
get
();
if
(
ret
==
null
)
{
ret
=
new
RequestContext
V1
();
ret
=
new
RequestContext
();
CURRENT_CONTEXT
.
set
(
ret
);
}
...
...
@@ -61,7 +61,7 @@ public class RequestContextV1 {
}
public
static
void
clear
()
{
RequestContext
V1
instance
=
CURRENT_CONTEXT
.
get
();
RequestContext
instance
=
CURRENT_CONTEXT
.
get
();
if
(
instance
!=
null
)
{
instance
.
updatedEntities
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java
View file @
3d5b4880
...
...
@@ -18,7 +18,7 @@
package
org
.
apache
.
atlas
.
notification
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.listener.EntityChangeListenerV2
;
import
org.apache.atlas.model.glossary.AtlasGlossaryTerm
;
...
...
@@ -48,11 +48,11 @@ import java.util.Set;
import
static
org
.
apache
.
atlas
.
notification
.
NotificationInterface
.
NotificationType
.
ENTITIES
;
import
static
org
.
apache
.
atlas
.
repository
.
graph
.
GraphHelper
.
isInternalType
;
import
static
org
.
apache
.
atlas
.
model
.
notification
.
EntityNotification
.
EntityNotificationV2
.
OperationType
.*;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
EntityGraphRetriever
.
CREATE_TIME
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
EntityGraphRetriever
.
DESCRIPTION
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
EntityGraphRetriever
.
NAME
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
EntityGraphRetriever
.
OWNER
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
1
.
EntityGraphRetriever
.
QUALIFIED_NAME
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
EntityGraphRetriever
.
CREATE_TIME
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
EntityGraphRetriever
.
DESCRIPTION
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
EntityGraphRetriever
.
NAME
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
EntityGraphRetriever
.
OWNER
;
import
static
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v
2
.
EntityGraphRetriever
.
QUALIFIED_NAME
;
@Component
public
class
EntityNotificationListenerV2
implements
EntityChangeListenerV2
{
...
...
@@ -89,8 +89,8 @@ public class EntityNotificationListenerV2 implements EntityChangeListenerV2 {
@Override
public
void
onClassificationsUpdated
(
AtlasEntity
entity
,
List
<
AtlasClassification
>
classifications
)
throws
AtlasBaseException
{
Map
<
String
,
List
<
AtlasClassification
>>
addedPropagations
=
RequestContext
V1
.
get
().
getAddedPropagations
();
Map
<
String
,
List
<
AtlasClassification
>>
removedPropagations
=
RequestContext
V1
.
get
().
getRemovedPropagations
();
Map
<
String
,
List
<
AtlasClassification
>>
addedPropagations
=
RequestContext
.
get
().
getAddedPropagations
();
Map
<
String
,
List
<
AtlasClassification
>>
removedPropagations
=
RequestContext
.
get
().
getRemovedPropagations
();
if
(
addedPropagations
.
containsKey
(
entity
.
getGuid
()))
{
notifyEntityEvents
(
Collections
.
singletonList
(
entity
),
CLASSIFICATION_ADD
);
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
View file @
3d5b4880
...
...
@@ -25,7 +25,7 @@ import org.apache.atlas.AtlasClient;
import
org.apache.atlas.AtlasClientV2
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.AtlasServiceException
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.ha.HAConfiguration
;
import
org.apache.atlas.kafka.AtlasKafkaMessage
;
import
org.apache.atlas.listener.ActiveStateChangeHandler
;
...
...
@@ -45,8 +45,8 @@ import org.apache.atlas.v1.model.notification.HookNotificationV1.EntityPartialUp
import
org.apache.atlas.v1.model.notification.HookNotificationV1.EntityUpdateRequest
;
import
org.apache.atlas.repository.converters.AtlasInstanceConverter
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.v
1
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
2
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.atlas.service.Service
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
...
...
@@ -55,7 +55,6 @@ import org.apache.atlas.web.filters.AuditFilter;
import
org.apache.atlas.web.filters.AuditFilter.AuditLog
;
import
org.apache.atlas.web.service.ServiceState
;
import
org.apache.commons.configuration.Configuration
;
import
org.apache.kafka.common.KafkaException
;
import
org.apache.kafka.common.TopicPartition
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -75,7 +74,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
*/
@Component
@Order
(
4
)
@DependsOn
(
value
=
{
"atlasTypeDefStoreInitializer"
,
"atlasTypeDefGraphStoreV
1
"
})
@DependsOn
(
value
=
{
"atlasTypeDefStoreInitializer"
,
"atlasTypeDefGraphStoreV
2
"
})
public
class
NotificationHookConsumer
implements
Service
,
ActiveStateChangeHandler
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
NotificationHookConsumer
.
class
);
private
static
final
Logger
PERF_LOG
=
AtlasPerfTracer
.
getPerfLogger
(
NotificationHookConsumer
.
class
);
...
...
@@ -375,7 +374,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
}
try
{
RequestContext
V1
requestContext
=
RequestContextV1
.
get
();
RequestContext
requestContext
=
RequestContext
.
get
();
requestContext
.
setUser
(
messageUser
,
null
);
...
...
@@ -406,7 +405,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
}
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
partialUpdateRequest
.
getTypeName
());
String
guid
=
AtlasGraphUtilsV
1
.
getGuidByUniqueAttributes
(
entityType
,
Collections
.
singletonMap
(
partialUpdateRequest
.
getAttribute
(),
(
Object
)
partialUpdateRequest
.
getAttributeValue
()));
String
guid
=
AtlasGraphUtilsV
2
.
getGuidByUniqueAttributes
(
entityType
,
Collections
.
singletonMap
(
partialUpdateRequest
.
getAttribute
(),
(
Object
)
partialUpdateRequest
.
getAttributeValue
()));
// There should only be one root entity
entities
.
getEntities
().
get
(
0
).
setGuid
(
guid
);
...
...
@@ -541,7 +540,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
return
;
}
}
finally
{
RequestContext
V1
.
clear
();
RequestContext
.
clear
();
}
}
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java
View file @
3d5b4880
...
...
@@ -19,7 +19,6 @@
package
org
.
apache
.
atlas
.
web
.
filters
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.security.SecurityProperties
;
import
org.apache.atlas.utils.AuthenticationUtil
;
import
org.apache.atlas.web.security.AtlasAuthenticationProvider
;
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java
View file @
3d5b4880
...
...
@@ -20,7 +20,7 @@ package org.apache.atlas.web.filters;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.authorize.AtlasAuthorizationUtils
;
import
org.apache.atlas.util.AtlasRepositoryConfiguration
;
import
org.apache.atlas.web.util.DateTimeHelper
;
...
...
@@ -73,8 +73,8 @@ public class AuditFilter implements Filter {
try
{
currentThread
.
setName
(
formatName
(
oldName
,
requestId
));
RequestContext
V1
.
clear
();
RequestContext
V1
requestContext
=
RequestContextV1
.
get
();
RequestContext
.
clear
();
RequestContext
requestContext
=
RequestContext
.
get
();
requestContext
.
setUser
(
user
,
userGroups
);
requestContext
.
setClientIPAddress
(
AtlasAuthorizationUtils
.
getRequestIpAddress
(
httpRequest
));
filterChain
.
doFilter
(
request
,
response
);
...
...
@@ -86,7 +86,7 @@ public class AuditFilter implements Filter {
// put the request id into the response so users can trace logs for this request
httpResponse
.
setHeader
(
AtlasClient
.
REQUEST_ID
,
requestId
);
currentThread
.
setName
(
oldName
);
RequestContext
V1
.
clear
();
RequestContext
.
clear
();
}
}
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
View file @
3d5b4880
...
...
@@ -38,8 +38,8 @@ import org.apache.atlas.model.legacy.EntityResult;
import
org.apache.atlas.repository.audit.EntityAuditRepository
;
import
org.apache.atlas.repository.converters.AtlasInstanceConverter
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.v
1
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
2
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
...
...
@@ -382,7 +382,7 @@ public class EntityResource {
Id
updateId
=
updatedEntity
.
getId
();
if
(
updateId
!=
null
&&
!
AtlasTypeUtil
.
isAssignedGuid
(
updateId
.
getId
()))
{
String
guid
=
AtlasGraphUtilsV
1
.
getGuidByUniqueAttributes
(
getEntityType
(
entityType
),
attributes
);
String
guid
=
AtlasGraphUtilsV
2
.
getGuidByUniqueAttributes
(
getEntityType
(
entityType
),
attributes
);
updatedEntity
.
setId
(
new
Id
(
guid
,
0
,
updatedEntity
.
getTypeName
()));
}
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
View file @
3d5b4880
...
...
@@ -23,7 +23,6 @@ import org.apache.atlas.model.audit.EntityAuditEventV2;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo
;
import
org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo
;
import
org.apache.atlas.model.instance.ClassificationAssociateRequest
;
...
...
@@ -32,8 +31,8 @@ import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import
org.apache.atlas.repository.audit.EntityAuditRepository
;
import
org.apache.atlas.repository.converters.AtlasInstanceConverter
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.v
1
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityStream
;
import
org.apache.atlas.repository.store.graph.v
2
.AtlasEntityStream
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityStream
;
import
org.apache.atlas.type.AtlasClassificationType
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
View file @
3d5b4880
...
...
@@ -29,7 +29,7 @@ import org.apache.atlas.v1.model.instance.Referenceable;
import
org.apache.atlas.v1.model.notification.HookNotificationV1
;
import
org.apache.atlas.repository.converters.AtlasInstanceConverter
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityStream
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityStream
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.web.service.ServiceState
;
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerTest.java
View file @
3d5b4880
...
...
@@ -30,7 +30,7 @@ import org.apache.atlas.v1.model.instance.Referenceable;
import
org.apache.atlas.v1.model.notification.HookNotificationV1.EntityCreateRequest
;
import
org.apache.atlas.repository.converters.AtlasInstanceConverter
;
import
org.apache.atlas.repository.store.graph.AtlasEntityStore
;
import
org.apache.atlas.repository.store.graph.v
1
.EntityStream
;
import
org.apache.atlas.repository.store.graph.v
2
.EntityStream
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.web.service.ServiceState
;
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/util/RestUtilsTest.java
View file @
3d5b4880
...
...
@@ -33,9 +33,9 @@ import org.apache.atlas.model.typedef.AtlasTypesDef;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.converters.TypeConverterUtil
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasGraphUtilsV1
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasStructDefStoreV1
;
import
org.apache.atlas.repository.store.graph.v
1.AtlasTypeDefGraphStoreV1
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasGraphUtilsV2
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasStructDefStoreV2
;
import
org.apache.atlas.repository.store.graph.v
2.AtlasTypeDefGraphStoreV2
;
import
org.apache.atlas.type.AtlasEntityType
;
import
org.apache.atlas.type.AtlasStructType
;
import
org.apache.atlas.type.AtlasStructType.AtlasAttribute
;
...
...
@@ -87,8 +87,8 @@ public class RestUtilsTest {
testV1toV2toV1Conversion
(
Arrays
.
asList
(
dbV1Type
,
tableV1Type
),
new
boolean
[]
{
false
,
false
});
}
private
AtlasTypeDefGraphStoreV
1
makeTypeStore
(
AtlasTypeRegistry
reg
)
{
AtlasTypeDefGraphStoreV
1
result
=
mock
(
AtlasTypeDefGraphStoreV1
.
class
);
private
AtlasTypeDefGraphStoreV
2
makeTypeStore
(
AtlasTypeRegistry
reg
)
{
AtlasTypeDefGraphStoreV
2
result
=
mock
(
AtlasTypeDefGraphStoreV2
.
class
);
for
(
AtlasEntityType
type
:
reg
.
getAllEntityTypes
())
{
String
typeName
=
type
.
getTypeName
();
...
...
@@ -97,13 +97,13 @@ public class RestUtilsTest {
when
(
result
.
isTypeVertex
(
eq
(
typeVertex
),
any
(
TypeCategory
.
class
))).
thenReturn
(
true
);
when
(
typeVertex
.
getProperty
(
eq
(
Constants
.
TYPE_CATEGORY_PROPERTY_KEY
),
eq
(
TypeCategory
.
class
))).
thenReturn
(
TypeCategory
.
CLASS
);
String
attributeListPropertyKey
=
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
typeName
);
String
attributeListPropertyKey
=
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
typeName
);
when
(
typeVertex
.
getProperty
(
eq
(
attributeListPropertyKey
),
eq
(
List
.
class
))).
thenReturn
(
new
ArrayList
<>(
type
.
getAllAttributes
().
keySet
()));
for
(
AtlasAttribute
attribute
:
type
.
getAllAttributes
().
values
())
{
String
attributeDefPropertyKey
=
AtlasGraphUtilsV
1
.
getTypeDefPropertyKey
(
typeName
,
attribute
.
getName
());
String
attributeJson
=
AtlasStructDefStoreV
1
.
toJsonFromAttribute
(
attribute
);
String
attributeDefPropertyKey
=
AtlasGraphUtilsV
2
.
getTypeDefPropertyKey
(
typeName
,
attribute
.
getName
());
String
attributeJson
=
AtlasStructDefStoreV
2
.
toJsonFromAttribute
(
attribute
);
when
(
typeVertex
.
getProperty
(
eq
(
attributeDefPropertyKey
),
eq
(
String
.
class
))).
thenReturn
(
attributeJson
);
}
...
...
@@ -115,15 +115,15 @@ public class RestUtilsTest {
}
private
AtlasAttributeDef
convertToJsonAndBack
(
AtlasTypeRegistry
registry
,
AtlasStructDef
structDef
,
AtlasAttributeDef
attributeDef
,
boolean
compositeExpected
)
throws
AtlasBaseException
{
AtlasTypeDefGraphStoreV
1
typeDefStore
=
makeTypeStore
(
registry
);
AtlasTypeDefGraphStoreV
2
typeDefStore
=
makeTypeStore
(
registry
);
AtlasStructType
structType
=
(
AtlasStructType
)
registry
.
getType
(
structDef
.
getName
());
AtlasAttribute
attribute
=
structType
.
getAttribute
(
attributeDef
.
getName
());
String
attribJson
=
AtlasStructDefStoreV
1
.
toJsonFromAttribute
(
attribute
);
String
attribJson
=
AtlasStructDefStoreV
2
.
toJsonFromAttribute
(
attribute
);
Map
attrInfo
=
AtlasType
.
fromJson
(
attribJson
,
Map
.
class
);
Assert
.
assertEquals
(
attrInfo
.
get
(
"isComposite"
),
compositeExpected
);
return
AtlasStructDefStoreV
1
.
toAttributeDefFromJson
(
structDef
,
attrInfo
,
typeDefStore
);
return
AtlasStructDefStoreV
2
.
toAttributeDefFromJson
(
structDef
,
attrInfo
,
typeDefStore
);
}
private
void
testV1toV2toV1Conversion
(
List
<
ClassTypeDefinition
>
typesToTest
,
boolean
[]
compositeExpected
)
throws
AtlasBaseException
{
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java
View file @
3d5b4880
...
...
@@ -18,7 +18,7 @@
package
org
.
apache
.
atlas
.
web
.
adapters
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.model.instance.AtlasClassification
;
...
...
@@ -98,7 +98,7 @@ public class TestEntitiesREST {
@AfterMethod
public
void
cleanup
()
throws
Exception
{
RequestContext
V1
.
clear
();
RequestContext
.
clear
();
}
@Test
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java
View file @
3d5b4880
...
...
@@ -17,8 +17,8 @@
*/
package
org
.
apache
.
atlas
.
web
.
adapters
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.RequestContextV1
;
import
org.apache.atlas.TestUtilsV2
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.instance.AtlasClassification.AtlasClassifications
;
...
...
@@ -77,7 +77,7 @@ public class TestEntityREST {
@AfterMethod
public
void
cleanup
()
throws
Exception
{
RequestContext
V1
.
clear
();
RequestContext
.
clear
();
}
private
void
createTestEntity
()
throws
Exception
{
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java
View file @
3d5b4880
...
...
@@ -16,7 +16,7 @@
*/
package
org
.
apache
.
atlas
.
web
.
filters
;
import
org.apache.atlas.RequestContext
V1
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.web.security.BaseSecurityTest
;
import
org.apache.atlas.web.service.EmbeddedServer
;
import
org.apache.commons.configuration.PropertiesConfiguration
;
...
...
@@ -111,7 +111,7 @@ public class AtlasAuthenticationKerberosFilterTest extends BaseSecurityTest {
connection
.
connect
();
assertEquals
(
connection
.
getResponseCode
(),
200
);
assertEquals
(
RequestContext
V1
.
get
().
getUser
(),
TESTUSER
);
assertEquals
(
RequestContext
.
get
().
getUser
(),
TESTUSER
);
return
null
;
}
});
...
...
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