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
be9b39bf
Commit
be9b39bf
authored
Feb 23, 2018
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2456: fix in conversion of auditAction string to V1/V2 version of EntityAuditAction
parent
bf4bf7fe
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
26 deletions
+81
-26
EntityAuditEvent.java
...t-v1/src/main/java/org/apache/atlas/EntityAuditEvent.java
+29
-1
EntityAuditEventV2.java
...java/org/apache/atlas/model/audit/EntityAuditEventV2.java
+29
-1
HBaseBasedAuditRepository.java
...che/atlas/repository/audit/HBaseBasedAuditRepository.java
+2
-2
AtlasInstanceConverter.java
...e/atlas/repository/converters/AtlasInstanceConverter.java
+21
-22
No files found.
client/client-v1/src/main/java/org/apache/atlas/EntityAuditEvent.java
View file @
be9b39bf
...
@@ -47,7 +47,35 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_
...
@@ -47,7 +47,35 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_
public
class
EntityAuditEvent
implements
Serializable
{
public
class
EntityAuditEvent
implements
Serializable
{
public
enum
EntityAuditAction
{
public
enum
EntityAuditAction
{
ENTITY_CREATE
,
ENTITY_UPDATE
,
ENTITY_DELETE
,
TAG_ADD
,
TAG_DELETE
,
TAG_UPDATE
,
ENTITY_CREATE
,
ENTITY_UPDATE
,
ENTITY_DELETE
,
TAG_ADD
,
TAG_DELETE
,
TAG_UPDATE
,
ENTITY_IMPORT_CREATE
,
ENTITY_IMPORT_UPDATE
,
ENTITY_IMPORT_DELETE
,
ENTITY_IMPORT_CREATE
,
ENTITY_IMPORT_UPDATE
,
ENTITY_IMPORT_DELETE
;
public
static
EntityAuditAction
fromString
(
String
strValue
)
{
switch
(
strValue
)
{
case
"ENTITY_CREATE"
:
return
ENTITY_CREATE
;
case
"ENTITY_UPDATE"
:
return
ENTITY_UPDATE
;
case
"ENTITY_DELETE"
:
return
ENTITY_DELETE
;
case
"ENTITY_IMPORT_CREATE"
:
return
ENTITY_IMPORT_CREATE
;
case
"ENTITY_IMPORT_UPDATE"
:
return
ENTITY_IMPORT_UPDATE
;
case
"ENTITY_IMPORT_DELETE"
:
return
ENTITY_IMPORT_DELETE
;
case
"CLASSIFICATION_ADD"
:
case
"TAG_ADD"
:
return
TAG_ADD
;
case
"CLASSIFICATION_DELETE"
:
case
"TAG_DELETE"
:
return
TAG_DELETE
;
case
"CLASSIFICATION_UPDATE"
:
case
"TAG_UPDATE"
:
return
TAG_UPDATE
;
}
throw
new
IllegalArgumentException
(
"No enum constant "
+
EntityAuditAction
.
class
.
getCanonicalName
()
+
"."
+
strValue
);
}
}
}
private
String
entityId
;
private
String
entityId
;
...
...
intg/src/main/java/org/apache/atlas/model/audit/EntityAuditEventV2.java
View file @
be9b39bf
...
@@ -45,7 +45,35 @@ public class EntityAuditEventV2 implements Serializable {
...
@@ -45,7 +45,35 @@ public class EntityAuditEventV2 implements Serializable {
public
enum
EntityAuditAction
{
public
enum
EntityAuditAction
{
ENTITY_CREATE
,
ENTITY_UPDATE
,
ENTITY_DELETE
,
ENTITY_CREATE
,
ENTITY_UPDATE
,
ENTITY_DELETE
,
ENTITY_IMPORT_CREATE
,
ENTITY_IMPORT_UPDATE
,
ENTITY_IMPORT_DELETE
,
ENTITY_IMPORT_CREATE
,
ENTITY_IMPORT_UPDATE
,
ENTITY_IMPORT_DELETE
,
CLASSIFICATION_ADD
,
CLASSIFICATION_DELETE
,
CLASSIFICATION_UPDATE
,
CLASSIFICATION_ADD
,
CLASSIFICATION_DELETE
,
CLASSIFICATION_UPDATE
;
public
static
EntityAuditAction
fromString
(
String
strValue
)
{
switch
(
strValue
)
{
case
"ENTITY_CREATE"
:
return
ENTITY_CREATE
;
case
"ENTITY_UPDATE"
:
return
ENTITY_UPDATE
;
case
"ENTITY_DELETE"
:
return
ENTITY_DELETE
;
case
"ENTITY_IMPORT_CREATE"
:
return
ENTITY_IMPORT_CREATE
;
case
"ENTITY_IMPORT_UPDATE"
:
return
ENTITY_IMPORT_UPDATE
;
case
"ENTITY_IMPORT_DELETE"
:
return
ENTITY_IMPORT_DELETE
;
case
"CLASSIFICATION_ADD"
:
case
"TAG_ADD"
:
return
CLASSIFICATION_ADD
;
case
"CLASSIFICATION_DELETE"
:
case
"TAG_DELETE"
:
return
CLASSIFICATION_DELETE
;
case
"CLASSIFICATION_UPDATE"
:
case
"TAG_UPDATE"
:
return
CLASSIFICATION_UPDATE
;
}
throw
new
IllegalArgumentException
(
"No enum constant "
+
EntityAuditAction
.
class
.
getCanonicalName
()
+
"."
+
strValue
);
}
}
}
private
String
entityId
;
private
String
entityId
;
...
...
repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
View file @
be9b39bf
...
@@ -252,7 +252,7 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
...
@@ -252,7 +252,7 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
continue
;
continue
;
}
}
event
.
setUser
(
getResultString
(
result
,
COLUMN_USER
));
event
.
setUser
(
getResultString
(
result
,
COLUMN_USER
));
event
.
setAction
(
EntityAuditAction
.
valueOf
(
getResultString
(
result
,
COLUMN_ACTION
)));
event
.
setAction
(
EntityAuditAction
.
fromString
(
getResultString
(
result
,
COLUMN_ACTION
)));
event
.
setDetails
(
getResultString
(
result
,
COLUMN_DETAIL
));
event
.
setDetails
(
getResultString
(
result
,
COLUMN_DETAIL
));
if
(
persistEntityDefinition
)
{
if
(
persistEntityDefinition
)
{
...
@@ -362,7 +362,7 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
...
@@ -362,7 +362,7 @@ public class HBaseBasedAuditRepository implements Service, EntityAuditRepository
continue
;
continue
;
}
}
event
.
setUser
(
getResultString
(
result
,
COLUMN_USER
));
event
.
setUser
(
getResultString
(
result
,
COLUMN_USER
));
event
.
setAction
(
EntityAuditEvent
.
EntityAuditAction
.
valueOf
(
getResultString
(
result
,
COLUMN_ACTION
)));
event
.
setAction
(
EntityAuditEvent
.
EntityAuditAction
.
fromString
(
getResultString
(
result
,
COLUMN_ACTION
)));
event
.
setDetails
(
getResultString
(
result
,
COLUMN_DETAIL
));
event
.
setDetails
(
getResultString
(
result
,
COLUMN_DETAIL
));
if
(
persistEntityDefinition
)
{
if
(
persistEntityDefinition
)
{
String
colDef
=
getResultString
(
result
,
COLUMN_DEFINITION
);
String
colDef
=
getResultString
(
result
,
COLUMN_DEFINITION
);
...
...
repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
View file @
be9b39bf
...
@@ -356,54 +356,52 @@ public class AtlasInstanceConverter {
...
@@ -356,54 +356,52 @@ public class AtlasInstanceConverter {
}
}
private
EntityAuditEvent
.
EntityAuditAction
getV1AuditAction
(
EntityAuditEventV2
.
EntityAuditAction
v2AuditAction
)
{
private
EntityAuditEvent
.
EntityAuditAction
getV1AuditAction
(
EntityAuditEventV2
.
EntityAuditAction
v2AuditAction
)
{
EntityAuditEvent
.
EntityAuditAction
ret
=
null
;
switch
(
v2AuditAction
)
{
switch
(
v2AuditAction
)
{
case
ENTITY_CREATE:
case
ENTITY_CREATE:
return
EntityAuditEvent
.
EntityAuditAction
.
ENTITY_CREATE
;
case
ENTITY_UPDATE:
case
ENTITY_UPDATE:
return
EntityAuditEvent
.
EntityAuditAction
.
ENTITY_UPDATE
;
case
ENTITY_DELETE:
case
ENTITY_DELETE:
return
EntityAuditEvent
.
EntityAuditAction
.
ENTITY_DELETE
;
case
ENTITY_IMPORT_CREATE:
case
ENTITY_IMPORT_CREATE:
return
EntityAuditEvent
.
EntityAuditAction
.
ENTITY_IMPORT_CREATE
;
case
ENTITY_IMPORT_UPDATE:
case
ENTITY_IMPORT_UPDATE:
return
EntityAuditEvent
.
EntityAuditAction
.
ENTITY_IMPORT_UPDATE
;
case
ENTITY_IMPORT_DELETE:
case
ENTITY_IMPORT_DELETE:
ret
=
EntityAuditEvent
.
EntityAuditAction
.
valueOf
(
v2AuditAction
.
name
());
return
EntityAuditEvent
.
EntityAuditAction
.
ENTITY_IMPORT_DELETE
;
break
;
case
CLASSIFICATION_ADD:
case
CLASSIFICATION_ADD:
ret
=
EntityAuditEvent
.
EntityAuditAction
.
valueOf
(
TAG_ADD
.
name
());
return
EntityAuditEvent
.
EntityAuditAction
.
TAG_ADD
;
break
;
case
CLASSIFICATION_DELETE:
case
CLASSIFICATION_DELETE:
ret
=
EntityAuditEvent
.
EntityAuditAction
.
valueOf
(
TAG_DELETE
.
name
());
return
EntityAuditEvent
.
EntityAuditAction
.
TAG_DELETE
;
break
;
case
CLASSIFICATION_UPDATE:
case
CLASSIFICATION_UPDATE:
ret
=
EntityAuditEvent
.
EntityAuditAction
.
valueOf
(
TAG_UPDATE
.
name
());
return
EntityAuditEvent
.
EntityAuditAction
.
TAG_UPDATE
;
break
;
}
}
return
ret
;
return
null
;
}
}
private
EntityAuditEventV2
.
EntityAuditAction
getV2AuditAction
(
EntityAuditEvent
.
EntityAuditAction
v1AuditAction
)
{
private
EntityAuditEventV2
.
EntityAuditAction
getV2AuditAction
(
EntityAuditEvent
.
EntityAuditAction
v1AuditAction
)
{
EntityAuditEventV2
.
EntityAuditAction
ret
=
null
;
switch
(
v1AuditAction
)
{
switch
(
v1AuditAction
)
{
case
ENTITY_CREATE:
case
ENTITY_CREATE:
return
EntityAuditEventV2
.
EntityAuditAction
.
ENTITY_CREATE
;
case
ENTITY_UPDATE:
case
ENTITY_UPDATE:
return
EntityAuditEventV2
.
EntityAuditAction
.
ENTITY_UPDATE
;
case
ENTITY_DELETE:
case
ENTITY_DELETE:
return
EntityAuditEventV2
.
EntityAuditAction
.
ENTITY_DELETE
;
case
ENTITY_IMPORT_CREATE:
case
ENTITY_IMPORT_CREATE:
return
EntityAuditEventV2
.
EntityAuditAction
.
ENTITY_IMPORT_CREATE
;
case
ENTITY_IMPORT_UPDATE:
case
ENTITY_IMPORT_UPDATE:
return
EntityAuditEventV2
.
EntityAuditAction
.
ENTITY_IMPORT_UPDATE
;
case
ENTITY_IMPORT_DELETE:
case
ENTITY_IMPORT_DELETE:
ret
=
EntityAuditEventV2
.
EntityAuditAction
.
valueOf
(
v1AuditAction
.
name
());
return
EntityAuditEventV2
.
EntityAuditAction
.
ENTITY_IMPORT_DELETE
;
break
;
case
TAG_ADD:
case
TAG_ADD:
ret
=
EntityAuditEventV2
.
EntityAuditAction
.
valueOf
(
CLASSIFICATION_ADD
.
name
());
return
EntityAuditEventV2
.
EntityAuditAction
.
CLASSIFICATION_ADD
;
break
;
case
TAG_DELETE:
case
TAG_DELETE:
ret
=
EntityAuditEventV2
.
EntityAuditAction
.
valueOf
(
CLASSIFICATION_DELETE
.
name
());
return
EntityAuditEventV2
.
EntityAuditAction
.
CLASSIFICATION_DELETE
;
break
;
case
TAG_UPDATE:
case
TAG_UPDATE:
ret
=
EntityAuditEventV2
.
EntityAuditAction
.
valueOf
(
CLASSIFICATION_UPDATE
.
name
());
return
EntityAuditEventV2
.
EntityAuditAction
.
CLASSIFICATION_UPDATE
;
break
;
}
}
return
ret
;
return
null
;
}
}
}
}
\ No newline at end of file
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