Skip to content

Commit

Permalink
Merge pull request datakaveri#147 from ananjaykumar2/update/audit-mes…
Browse files Browse the repository at this point in the history
…sage

updated auditing message
  • Loading branch information
Kailash Adhikari authored Sep 6, 2023
2 parents 692c912 + bc21f02 commit 5d98a33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/java/iudx/file/server/apiserver/FileServerVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -968,17 +968,23 @@ private void updateAuditTable(JsonObject auditInfo) {
.onComplete(
catHandler -> {
if (catHandler.succeeded()) {
JsonObject json = catHandler.result();
String providerId = json.getString("provider");
auditInfo.put(PROVIDER_ID, providerId);

JsonObject catResult = catHandler.result();
String providerId = catResult.getString("provider");
String type =
catResult.containsKey(RESOURCE_GROUP) ? "RESOURCE" : "RESOURCE_GROUP";
String resourceGroup =
catResult.containsKey(RESOURCE_GROUP)
? catResult.getString(RESOURCE_GROUP)
: catResult.getString(ID);
ZonedDateTime zst = ZonedDateTime.now(ZoneId.of("Asia/Kolkata"));
long epochTime = zst.toInstant().toEpochMilli();
String isoTime = zst.truncatedTo(ChronoUnit.SECONDS).toString();

auditInfo.put(RESOURCE_GROUP, resourceGroup);
auditInfo.put(TYPE_KEY, type);
auditInfo.put(PROVIDER_ID, providerId);
auditInfo.put(EPOCH_TIME, epochTime);
auditInfo.put(ISO_TIME, isoTime);

LOGGER.info("Updating audit table on successful transaction " + auditInfo);
auditingService.executeWriteQuery(
auditInfo,
auditHandler -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ public class Constants {
public static final String ISO_TIME = "isoTime";
public static final String EXCHANGE_NAME = "auditing";
public static final String ROUTING_KEY = "#";
public static final String RESOURCE_GROUP = "resourceGroup";
}

0 comments on commit 5d98a33

Please sign in to comment.