diff options
Diffstat (limited to 'base/common/src/com/netscape/certsrv/logging/SignedAuditEvent.java')
-rw-r--r-- | base/common/src/com/netscape/certsrv/logging/SignedAuditEvent.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/certsrv/logging/SignedAuditEvent.java b/base/common/src/com/netscape/certsrv/logging/SignedAuditEvent.java index 08f9e7f64..b60306752 100644 --- a/base/common/src/com/netscape/certsrv/logging/SignedAuditEvent.java +++ b/base/common/src/com/netscape/certsrv/logging/SignedAuditEvent.java @@ -17,6 +17,9 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.logging; +import java.util.LinkedHashMap; +import java.util.Map; + /** * The log event object that carries message detail of a log event * that goes into the Signed Audit Event log. This log has the @@ -31,6 +34,8 @@ public class SignedAuditEvent extends LogEvent { private static final long serialVersionUID = 4287822756516673931L; + protected Map<String, Object> attributes = new LinkedHashMap<>(); + /** * Constructs a SignedAuditEvent message event. * <P> @@ -107,4 +112,33 @@ public class SignedAuditEvent extends LogEvent { public SignedAuditEvent(String msgFormat, Object params[]) { super(msgFormat, params); } + + public void setAttribute(String name, Object value) { + attributes.put(name, value); + } + + public Object getAttribute(String name) { + return attributes.get(name); + } + + public Map<String, Object> getAttributes() { + return attributes; + } + + public String getAttributeList() { + + StringBuilder sb = new StringBuilder(); + + for (String name : attributes.keySet()) { + Object value = attributes.get(name); + + sb.append("["); + sb.append(name); + sb.append("="); + sb.append(value == null ? ILogger.SIGNED_AUDIT_EMPTY_VALUE : value); + sb.append("]"); + } + + return sb.toString(); + } } |