This is an automated email from the ASF dual-hosted git repository. madhan pushed a commit to branch ranger-2.5 in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/ranger-2.5 by this push: new 56f3b9337 RANGER-4832: updated v2 to v1 admin audit log conversion to set unique ID 56f3b9337 is described below commit 56f3b93379f712cb11dc21eeec110a300bf00660 Author: Madhan Neethiraj <mad...@apache.org> AuthorDate: Tue Jun 25 00:27:29 2024 -0700 RANGER-4832: updated v2 to v1 admin audit log conversion to set unique ID (cherry picked from commit 6bfca1ae81756a695b19c30199568985b318a15b) --- .../src/main/java/org/apache/ranger/biz/AssetMgr.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/security-admin/src/main/java/org/apache/ranger/biz/AssetMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/AssetMgr.java index 0beb9a7e5..101e2fa96 100644 --- a/security-admin/src/main/java/org/apache/ranger/biz/AssetMgr.java +++ b/security-admin/src/main/java/org/apache/ranger/biz/AssetMgr.java @@ -1202,16 +1202,22 @@ public class AssetMgr extends AssetMgrBase { public VXTrxLogList getTransactionReport(String transactionId) { List<VXTrxLogV2> trxLogsV2 = xTrxLogService.findByTransactionId(transactionId); List<VXTrxLog> trxLogs = new ArrayList<>(); + long nextLogId = 1; for (VXTrxLogV2 trxLogV2 : trxLogsV2) { ObjectChangeInfo objChangeInfo = trxLogV2.getChangeInfo(); if (objChangeInfo == null || CollectionUtils.isEmpty(objChangeInfo.getAttributes())) { - trxLogs.add(VXTrxLogV2.toVXTrxLog(trxLogV2)); + VXTrxLog trxLog = VXTrxLogV2.toVXTrxLog(trxLogV2); + + trxLog.setId(nextLogId++); + + trxLogs.add(trxLog); } else { for (AttributeChangeInfo attrChangeInfo : objChangeInfo.getAttributes()) { VXTrxLog trxLog = VXTrxLogV2.toVXTrxLog(trxLogV2); + trxLog.setId(nextLogId++); trxLog.setAttributeName(attrChangeInfo.getAttributeName()); trxLog.setPreviousValue(attrChangeInfo.getOldValue()); trxLog.setNewValue(attrChangeInfo.getNewValue()); @@ -1225,8 +1231,8 @@ public class AssetMgr extends AssetMgrBase { } public List<VXTrxLog> validateXXTrxLogList(List<VXTrxLog> xTrxLogList) { - List<VXTrxLog> vXTrxLogs = new ArrayList<VXTrxLog>(); + for (VXTrxLog vXTrxLog : xTrxLogList) { if(vXTrxLog.getPreviousValue() == null || "null".equalsIgnoreCase(vXTrxLog.getPreviousValue())) { vXTrxLog.setPreviousValue(""); @@ -1277,8 +1283,9 @@ public class AssetMgr extends AssetMgrBase { } } } - } - vXTrxLogs.add(vXTrxLog); + } + + vXTrxLogs.add(vXTrxLog); } return vXTrxLogs; }