|
|
@ -19,177 +19,46 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.apache.dolphinscheduler.alert.api; |
|
|
|
package org.apache.dolphinscheduler.alert.api; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
|
|
|
import lombok.Builder; |
|
|
|
|
|
|
|
import lombok.Data; |
|
|
|
|
|
|
|
import lombok.NoArgsConstructor; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* alert data |
|
|
|
* alert data |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@AllArgsConstructor |
|
|
|
|
|
|
|
@Builder |
|
|
|
|
|
|
|
@Data |
|
|
|
|
|
|
|
@NoArgsConstructor |
|
|
|
public class AlertData { |
|
|
|
public class AlertData { |
|
|
|
private int id; |
|
|
|
|
|
|
|
private String title; |
|
|
|
|
|
|
|
private String content; |
|
|
|
|
|
|
|
private String log; |
|
|
|
|
|
|
|
private int warnType; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlertData(int id, String title, String content, String log, int warnType) { |
|
|
|
|
|
|
|
this.id = id; |
|
|
|
|
|
|
|
this.title = title; |
|
|
|
|
|
|
|
this.content = content; |
|
|
|
|
|
|
|
this.log = log; |
|
|
|
|
|
|
|
this.warnType = warnType; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlertData() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static AlertDataBuilder builder() { |
|
|
|
|
|
|
|
return new AlertDataBuilder(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getId() { |
|
|
|
|
|
|
|
return this.id; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlertData setId(int id) { |
|
|
|
|
|
|
|
this.id = id; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getTitle() { |
|
|
|
|
|
|
|
return this.title; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlertData setTitle(String title) { |
|
|
|
|
|
|
|
this.title = title; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getContent() { |
|
|
|
|
|
|
|
return this.content; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlertData setContent(String content) { |
|
|
|
|
|
|
|
this.content = content; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getLog() { |
|
|
|
|
|
|
|
return this.log; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlertData setLog(String log) { |
|
|
|
|
|
|
|
this.log = log; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getWarnType() { |
|
|
|
/** |
|
|
|
return warnType; |
|
|
|
* alert id |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
private int id; |
|
|
|
public void setWarnType(int warnType) { |
|
|
|
|
|
|
|
this.warnType = warnType; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean equals(final Object o) { |
|
|
|
|
|
|
|
if (o == this) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!(o instanceof AlertData)) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
final AlertData other = (AlertData) o; |
|
|
|
|
|
|
|
if (!other.canEqual(this)) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (this.getId() != other.getId()) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (this.getWarnType() != other.getWarnType()) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
final Object thisTitle = this.getTitle(); |
|
|
|
|
|
|
|
final Object otherTitle = other.getTitle(); |
|
|
|
|
|
|
|
if (!Objects.equals(thisTitle, otherTitle)) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
final Object thisContent = this.getContent(); |
|
|
|
|
|
|
|
final Object otherContent = other.getContent(); |
|
|
|
|
|
|
|
if (!Objects.equals(thisContent, otherContent)) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
final Object thisLog = this.getLog(); |
|
|
|
|
|
|
|
final Object otherLog = other.getLog(); |
|
|
|
|
|
|
|
return Objects.equals(thisLog, otherLog); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected boolean canEqual(final Object other) { |
|
|
|
|
|
|
|
return other instanceof AlertData; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int hashCode() { |
|
|
|
|
|
|
|
final int prime = 59; |
|
|
|
|
|
|
|
int result = 1; |
|
|
|
|
|
|
|
result = result * prime + this.getId(); |
|
|
|
|
|
|
|
result = result * prime + this.getWarnType(); |
|
|
|
|
|
|
|
final Object title = this.getTitle(); |
|
|
|
|
|
|
|
result = result * prime + (title == null ? 43 : title.hashCode()); |
|
|
|
|
|
|
|
final Object content = this.getContent(); |
|
|
|
|
|
|
|
result = result * prime + (content == null ? 43 : content.hashCode()); |
|
|
|
|
|
|
|
final Object log = this.getLog(); |
|
|
|
|
|
|
|
result = result * prime + (log == null ? 43 : log.hashCode()); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String toString() { |
|
|
|
|
|
|
|
return "AlertData(id=" + this.getId() + ", title=" + this.getTitle() + ", content=" + this.getContent() + ", log=" + this.getLog() + ", warnType=" + this.getWarnType() + ")"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static class AlertDataBuilder { |
|
|
|
|
|
|
|
private int id; |
|
|
|
|
|
|
|
private String title; |
|
|
|
|
|
|
|
private String content; |
|
|
|
|
|
|
|
private String log; |
|
|
|
|
|
|
|
private int warnType; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AlertDataBuilder() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlertDataBuilder id(int id) { |
|
|
|
|
|
|
|
this.id = id; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlertDataBuilder title(String title) { |
|
|
|
|
|
|
|
this.title = title; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlertDataBuilder content(String content) { |
|
|
|
|
|
|
|
this.content = content; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AlertDataBuilder log(String log) { |
|
|
|
/** |
|
|
|
this.log = log; |
|
|
|
* alert tile |
|
|
|
return this; |
|
|
|
*/ |
|
|
|
} |
|
|
|
private String title; |
|
|
|
|
|
|
|
|
|
|
|
public AlertDataBuilder warnType(int warnType) { |
|
|
|
/** |
|
|
|
this.warnType = warnType; |
|
|
|
* alert content |
|
|
|
return this; |
|
|
|
*/ |
|
|
|
} |
|
|
|
private String content; |
|
|
|
|
|
|
|
|
|
|
|
public AlertData build() { |
|
|
|
/** |
|
|
|
return new AlertData(id, title, content, log, warnType); |
|
|
|
* alert log |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
private String log; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
/** |
|
|
|
public String toString() { |
|
|
|
* 0 do not send warning; |
|
|
|
return "AlertData.AlertDataBuilder(id=" + this.id + ", title=" + this.title + ", content=" + this.content + ", log=" + this.log + ", warnType=" + this.warnType + ")"; |
|
|
|
* 1 send if process success; |
|
|
|
} |
|
|
|
* 2 send if process failed; |
|
|
|
|
|
|
|
* 3 send if process ends, whatever the result; |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private int warnType; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|