All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dnastack.audit.model.AuditEventBody Maven / Gradle / Ivy

package com.dnastack.audit.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.Instant;
import java.util.HashMap;
import java.util.Map;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class AuditEventBody {

    private AuditedPrincipal principal;
    private AuditedResource resource;
    private AuditedAction action;
    private AuditedOutcome outcome;
    private Instant timestamp;
    private AuditedContext context;
    @JsonProperty("extra_arguments")
    private Map extraArguments;


    /*
        Helper methods that allow single/multiple insertions to the extra arguments without overwriting the whole map
     */

    public void putExtraArgument(String key, Object value) {
        if (this.extraArguments == null) {
            this.extraArguments = new HashMap<>();
        }

        this.extraArguments.put(key, value);
    }

    public void putExtraArguments(Map arguments) {
        if (this.extraArguments == null) {
            this.extraArguments = new HashMap<>();
        }

        this.extraArguments.putAll(arguments);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy