package com.qianwen.core.notify.event;
|
|
import java.util.Map;
|
import javax.annotation.Nullable;
|
import com.qianwen.core.notify.NotifyType;
|
import com.qianwen.core.notify.Provider;
|
import com.qianwen.core.notify.template.Template;
|
import com.qianwen.core.tool.utils.StringUtil;
|
|
/* loaded from: blade-starter-notify-9.3.0.0-SNAPSHOT.jar:org/springblade/core/notify/event/NotifierEvent.class */
|
public class NotifierEvent {
|
private boolean success;
|
@Nullable
|
private Throwable cause;
|
private String traceId;
|
private String notifierId;
|
private NotifyType notifyType;
|
private Provider provider;
|
private String templateId;
|
private Template template;
|
private Map<String, Object> context;
|
|
/* loaded from: blade-starter-notify-9.3.0.0-SNAPSHOT.jar:org/springblade/core/notify/event/NotifierEvent$NotifierEventBuilder.class */
|
public static class NotifierEventBuilder {
|
private boolean success;
|
private Throwable cause;
|
private String traceId;
|
private String notifierId;
|
private NotifyType notifyType;
|
private Provider provider;
|
private String templateId;
|
private Template template;
|
private Map<String, Object> context;
|
|
NotifierEventBuilder() {
|
}
|
|
public NotifierEventBuilder success(final boolean success) {
|
this.success = success;
|
return this;
|
}
|
|
public NotifierEventBuilder cause(@Nullable final Throwable cause) {
|
this.cause = cause;
|
return this;
|
}
|
|
public NotifierEventBuilder traceId(final String traceId) {
|
this.traceId = traceId;
|
return this;
|
}
|
|
public NotifierEventBuilder notifierId(final String notifierId) {
|
this.notifierId = notifierId;
|
return this;
|
}
|
|
public NotifierEventBuilder notifyType(final NotifyType notifyType) {
|
this.notifyType = notifyType;
|
return this;
|
}
|
|
public NotifierEventBuilder provider(final Provider provider) {
|
this.provider = provider;
|
return this;
|
}
|
|
public NotifierEventBuilder templateId(final String templateId) {
|
this.templateId = templateId;
|
return this;
|
}
|
|
public NotifierEventBuilder template(final Template template) {
|
this.template = template;
|
return this;
|
}
|
|
public NotifierEventBuilder context(final Map<String, Object> context) {
|
this.context = context;
|
return this;
|
}
|
|
public NotifierEvent build() {
|
return new NotifierEvent(this.success, this.cause, this.traceId, this.notifierId, this.notifyType, this.provider, this.templateId, this.template, this.context);
|
}
|
|
public String toString() {
|
return "NotifierEvent.NotifierEventBuilder(success=" + this.success + ", cause=" + this.cause + ", traceId=" + this.traceId + ", notifierId=" + this.notifierId + ", notifyType=" + this.notifyType + ", provider=" + this.provider + ", templateId=" + this.templateId + ", template=" + this.template + ", context=" + this.context + ")";
|
}
|
}
|
|
public void setSuccess(final boolean success) {
|
this.success = success;
|
}
|
|
public void setCause(@Nullable final Throwable cause) {
|
this.cause = cause;
|
}
|
|
public void setTraceId(final String traceId) {
|
this.traceId = traceId;
|
}
|
|
public void setNotifierId(final String notifierId) {
|
this.notifierId = notifierId;
|
}
|
|
public void setNotifyType(final NotifyType notifyType) {
|
this.notifyType = notifyType;
|
}
|
|
public void setProvider(final Provider provider) {
|
this.provider = provider;
|
}
|
|
public void setTemplateId(final String templateId) {
|
this.templateId = templateId;
|
}
|
|
public void setTemplate(final Template template) {
|
this.template = template;
|
}
|
|
public void setContext(final Map<String, Object> context) {
|
this.context = context;
|
}
|
|
NotifierEvent(final boolean success, @Nullable final Throwable cause, final String traceId, final String notifierId, final NotifyType notifyType, final Provider provider, final String templateId, final Template template, final Map<String, Object> context) {
|
this.success = success;
|
this.cause = cause;
|
this.traceId = traceId;
|
this.notifierId = notifierId;
|
this.notifyType = notifyType;
|
this.provider = provider;
|
this.templateId = templateId;
|
this.template = template;
|
this.context = context;
|
}
|
|
public static NotifierEventBuilder builder() {
|
return new NotifierEventBuilder();
|
}
|
|
public boolean isSuccess() {
|
return this.success;
|
}
|
|
@Nullable
|
public Throwable getCause() {
|
return this.cause;
|
}
|
|
public String getTraceId() {
|
return this.traceId;
|
}
|
|
public String getNotifierId() {
|
return this.notifierId;
|
}
|
|
public NotifyType getNotifyType() {
|
return this.notifyType;
|
}
|
|
public Provider getProvider() {
|
return this.provider;
|
}
|
|
public String getTemplateId() {
|
return this.templateId;
|
}
|
|
public Template getTemplate() {
|
return this.template;
|
}
|
|
public Map<String, Object> getContext() {
|
return this.context;
|
}
|
|
public SerializableNotifierEvent toSerializable() {
|
return SerializableNotifierEvent.builder().success(this.success).traceId(this.traceId).notifierId(this.notifierId).notifyType(this.notifyType.getId()).provider(this.provider.getId()).templateId(this.templateId).template(this.template != null ? this.template.toString() : "").context(this.context).cause(this.cause != null ? StringUtil.throwable2String(this.cause) : "").errorType(this.cause != null ? this.cause.getClass().getName() : null).build();
|
}
|
|
public String toString() {
|
return "NotifierEvent.NotifierEventBuilder(success=" + this.success + ", cause=" + (this.cause != null ? StringUtil.throwable2String(this.cause) : "") + ", traceId=" + this.traceId + ", notifierId=" + this.notifierId + ", notifyType=" + this.notifyType + ", provider=" + this.provider + ", templateId=" + this.templateId + ", template=" + (this.template != null ? this.template.toString() : "") + ", context=" + this.context + ")";
|
}
|
}
|