com.github.lontime.extcopper.common.AuditTrailEventBuilder Maven / Gradle / Ivy
package com.github.lontime.extcopper.common;
import java.util.Date;
import org.copperengine.core.audit.AuditTrailEvent;
/**
* AuditTrailEventBuilder.
* @author lontime
* @since 1.0
*/
public class AuditTrailEventBuilder {
private int logLevel;
private Date occurrence;
private String conversationId;
private String context;
private String instanceId;
private String correlationId;
private String message;
private String transactionId;
private String messageType;
private Long sequenceId;
public AuditTrailEventBuilder logLevel(int logLevel) {
this.logLevel = logLevel;
return this;
}
public AuditTrailEventBuilder occurrence(Date occurrence) {
this.occurrence = occurrence;
return this;
}
public AuditTrailEventBuilder conversationId(String conversationId) {
this.conversationId = conversationId;
return this;
}
public AuditTrailEventBuilder context(String context) {
this.context = context;
return this;
}
public AuditTrailEventBuilder instanceId(String instanceId) {
this.instanceId = instanceId;
return this;
}
public AuditTrailEventBuilder correlationId(String correlationId) {
this.correlationId = correlationId;
return this;
}
public AuditTrailEventBuilder message(String message) {
this.message = message;
return this;
}
public AuditTrailEventBuilder transactionId(String transactionId) {
this.transactionId = transactionId;
return this;
}
public AuditTrailEventBuilder messageType(String messageType) {
this.messageType = messageType;
return this;
}
public AuditTrailEventBuilder sequenceId(Long sequenceId) {
this.sequenceId = sequenceId;
return this;
}
public AuditTrailEvent build() {
return new AuditTrailEvent(logLevel, (occurrence == null ? new Date() : occurrence),
conversationId, context, instanceId, correlationId, transactionId, message, messageType, sequenceId);
}
public static AuditTrailEventBuilder create() {
return new AuditTrailEventBuilder();
}
}