Commit 7779388f by Mandar Ambawane Committed by nixonrodrigues

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: 's avatarnixonrodrigues <nixon@apache.org>
parent 97b5565d
...@@ -136,6 +136,7 @@ public class AdminResource { ...@@ -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_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_FORMAT = "atlas.ui.date.format";
private static final String UI_DATE_DEFAULT_FORMAT = "MM/DD/YYYY hh:mm:ss A"; 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()); private static final List TIMEZONE_LIST = Arrays.asList(TimeZone.getAvailableIDs());
@Context @Context
...@@ -424,9 +425,14 @@ public class AdminResource { ...@@ -424,9 +425,14 @@ public class AdminResource {
exportSink.close(); exportSink.close();
} }
if (isSuccessful) { if (isSuccessful && CollectionUtils.isNotEmpty(result.getRequest().getItemsToExport())) {
String params = AtlasJson.toJson(result.getRequest().getOptions());
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(); List<AtlasObjectId> objectIds = result.getRequest().getItemsToExport();
auditImportExportOperations(objectIds, AuditOperation.EXPORT, params); auditImportExportOperations(objectIds, AuditOperation.EXPORT, params);
} }
...@@ -479,7 +485,12 @@ public class AdminResource { ...@@ -479,7 +485,12 @@ public class AdminResource {
} }
List<AtlasObjectId> objectIds = result.getExportResult().getRequest().getItemsToExport(); 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; return result;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment