This is an automated email from the ASF dual-hosted git repository.

nixon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/master by this push:
     new 7779388  ATLAS-4034: Export operation audit with result count 0 for 
empty exports is inconsistent. ATLAS-4041: Operation status info of 
IMPORT/EXPORT operation in the Admin import/export audits
7779388 is described below

commit 7779388fb000122fc1ddd29c9f6c36f57b41f5b1
Author: Mandar Ambawane <[email protected]>
AuthorDate: Fri Nov 20 19:33:41 2020 +0530

    ATLAS-4034: Export operation audit with result count 0 for empty exports is 
inconsistent.
    ATLAS-4041: Operation status info of IMPORT/EXPORT operation in the Admin 
import/export audits
    
    Signed-off-by: nixonrodrigues <[email protected]>
---
 .../org/apache/atlas/web/resources/AdminResource.java   | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git 
a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java 
b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
index 6f8c9e4..f8c953b 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
@@ -136,6 +136,7 @@ public class AdminResource {
     private static final String UI_DATE_TIMEZONE_FORMAT_ENABLED = 
"atlas.ui.date.timezone.format.enabled";
     private static final String UI_DATE_FORMAT                 = 
"atlas.ui.date.format";
     private static final String UI_DATE_DEFAULT_FORMAT         = "MM/DD/YYYY 
hh:mm:ss A";
+    private static final String OPERATION_STATUS               = 
"operationStatus";
     private static final List TIMEZONE_LIST  = 
Arrays.asList(TimeZone.getAvailableIDs());
 
     @Context
@@ -424,9 +425,14 @@ public class AdminResource {
                 exportSink.close();
             }
 
-            if (isSuccessful) {
-                String params = 
AtlasJson.toJson(result.getRequest().getOptions());
+            if (isSuccessful && 
CollectionUtils.isNotEmpty(result.getRequest().getItemsToExport())) {
+
+                Map<String, Object> optionMap = 
result.getRequest().getOptions();
+                optionMap.put(OPERATION_STATUS, 
result.getOperationStatus().name());
+                String params = AtlasJson.toJson(optionMap);
+
                 List<AtlasObjectId> objectIds = 
result.getRequest().getItemsToExport();
+
                 auditImportExportOperations(objectIds, AuditOperation.EXPORT, 
params);
             }
 
@@ -479,7 +485,12 @@ public class AdminResource {
         }
 
         List<AtlasObjectId> objectIds = 
result.getExportResult().getRequest().getItemsToExport();
-        auditImportExportOperations(objectIds, AuditOperation.IMPORT, null);
+
+        Map<String, Object> optionMap = new HashMap<>();
+        optionMap.put(OPERATION_STATUS, result.getOperationStatus().name());
+        String params = AtlasJson.toJson(optionMap);
+
+        auditImportExportOperations(objectIds, AuditOperation.IMPORT, params);
 
         return result;
     }

Reply via email to