From 7e7a3969322610d681012fcc10ba0c1c08d78e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Zl=C3=A1mal?= Date: Thu, 26 Nov 2020 13:56:12 +0100 Subject: [PATCH] Merge pull request #3006 from zlamalp/auditfix Fixed usage of LocalDate in audit messages --- .../SponsorshipEstablished.java | 8 ++++---- .../SponsorshipValidityUpdated.java | 14 ++++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/perun-base/src/main/java/cz/metacentrum/perun/audit/events/MembersManagerEvents/SponsorshipEstablished.java b/perun-base/src/main/java/cz/metacentrum/perun/audit/events/MembersManagerEvents/SponsorshipEstablished.java index 1dfcff5fe3..7df0f29e92 100644 --- a/perun-base/src/main/java/cz/metacentrum/perun/audit/events/MembersManagerEvents/SponsorshipEstablished.java +++ b/perun-base/src/main/java/cz/metacentrum/perun/audit/events/MembersManagerEvents/SponsorshipEstablished.java @@ -11,7 +11,7 @@ public class SponsorshipEstablished extends AuditEvent { private Member sponsoredMember; private User sponsor; private String message; - private LocalDate validity; + private String validity; @SuppressWarnings("unused") // used by jackson mapper public SponsorshipEstablished() { @@ -20,9 +20,9 @@ public SponsorshipEstablished() { public SponsorshipEstablished(Member sponsoredMember, User sponsor, LocalDate validityTo) { this.sponsoredMember = sponsoredMember; this.sponsor = sponsor; - this.validity = validityTo; + this.validity = (validityTo == null) ? "FOREVER" : validityTo.toString(); this.message = formatMessage("Sponsorship of %s by %s established with validity to %s.", - sponsoredMember, sponsor, validityTo == null ? "FOREVER" : validityTo.toString()); + sponsoredMember, sponsor, validity); } @Override @@ -38,7 +38,7 @@ public User getSponsor() { return sponsor; } - public LocalDate getValidity() { + public String getValidity() { return validity; } diff --git a/perun-base/src/main/java/cz/metacentrum/perun/audit/events/MembersManagerEvents/SponsorshipValidityUpdated.java b/perun-base/src/main/java/cz/metacentrum/perun/audit/events/MembersManagerEvents/SponsorshipValidityUpdated.java index 4c50696585..edff255de8 100644 --- a/perun-base/src/main/java/cz/metacentrum/perun/audit/events/MembersManagerEvents/SponsorshipValidityUpdated.java +++ b/perun-base/src/main/java/cz/metacentrum/perun/audit/events/MembersManagerEvents/SponsorshipValidityUpdated.java @@ -14,7 +14,7 @@ public class SponsorshipValidityUpdated extends AuditEvent { private Member sponsoredMember; private User sponsor; private String message; - private LocalDate validity; + private String validity; @SuppressWarnings("unused") // used by jackson mapper public SponsorshipValidityUpdated() { @@ -23,9 +23,9 @@ public SponsorshipValidityUpdated() { public SponsorshipValidityUpdated(Member sponsoredMember, User sponsor, LocalDate validityTo) { this.sponsoredMember = sponsoredMember; this.sponsor = sponsor; - this.validity = validityTo; + this.validity = (validityTo == null) ? "FOREVER" : validityTo.toString(); this.message = formatMessage("Validity of sponsorship of %s by %s changed to %s.", - sponsoredMember, sponsor, validityTo == null ? "FOREVER" : validityTo.toString()); + sponsoredMember, sponsor, validity); } @Override @@ -41,7 +41,13 @@ public User getSponsor() { return sponsor; } - public LocalDate getValidity() { + public String getValidity() { return validity; } + + @Override + public String toString() { + return message; + } + }