Browse Source

[Improvement][style]add comment and clear warn (#9247)

3.0.0/version-upgrade
worry 3 years ago committed by GitHub
parent
commit
ecf13a8c90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannel.java
  2. 12
      dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannelFactory.java
  3. 50
      dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertData.java
  4. 33
      dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInfo.java
  5. 36
      dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertResult.java

8
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannel.java

@ -19,6 +19,14 @@
package org.apache.dolphinscheduler.alert.api;
/**
* alert channel for sending alerts
*/
public interface AlertChannel {
/**
* process and send alert
* @param info alert info
* @return process alarm result
*/
AlertResult process(AlertInfo info);
}

12
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertChannelFactory.java

@ -23,9 +23,21 @@ import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import java.util.List;
/**
* alert channel factory
*/
public interface AlertChannelFactory {
/**
* Returns the name of the alert channel
* @return the name of the alert channel
*/
String name();
/**
* Create an alert channel
*
* @return alert channel
*/
AlertChannel create();
/**

50
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertData.java

@ -19,6 +19,11 @@
package org.apache.dolphinscheduler.alert.api;
import java.util.Objects;
/**
* alert data
*/
public class AlertData {
private int id;
private String title;
@ -85,6 +90,7 @@ public class AlertData {
this.warnType = warnType;
}
@Override
public boolean equals(final Object o) {
if (o == this) {
return true;
@ -93,7 +99,7 @@ public class AlertData {
return false;
}
final AlertData other = (AlertData) o;
if (!other.canEqual((Object) this)) {
if (!other.canEqual(this)) {
return false;
}
if (this.getId() != other.getId()) {
@ -102,42 +108,41 @@ public class AlertData {
if (this.getWarnType() != other.getWarnType()) {
return false;
}
final Object this$title = this.getTitle();
final Object other$title = other.getTitle();
if (this$title == null ? other$title != null : !this$title.equals(other$title)) {
final Object thisTitle = this.getTitle();
final Object otherTitle = other.getTitle();
if (!Objects.equals(thisTitle, otherTitle)) {
return false;
}
final Object this$content = this.getContent();
final Object other$content = other.getContent();
if (this$content == null ? other$content != null : !this$content.equals(other$content)) {
final Object thisContent = this.getContent();
final Object otherContent = other.getContent();
if (!Objects.equals(thisContent, otherContent)) {
return false;
}
final Object this$log = this.getLog();
final Object other$log = other.getLog();
if (this$log == null ? other$log != null : !this$log.equals(other$log)) {
return false;
}
return true;
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;
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());
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() + ")";
}
@ -181,6 +186,7 @@ public class AlertData {
return new AlertData(id, title, content, log, warnType);
}
@Override
public String toString() {
return "AlertData.AlertDataBuilder(id=" + this.id + ", title=" + this.title + ", content=" + this.content + ", log=" + this.log + ", warnType=" + this.warnType + ")";
}

33
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertInfo.java

@ -20,7 +20,11 @@
package org.apache.dolphinscheduler.alert.api;
import java.util.Map;
import java.util.Objects;
/**
* The alarm information includes the parameters of the alert channel and the alarm data
*/
public class AlertInfo {
private Map<String, String> alertParams;
private AlertData alertData;
@ -55,6 +59,7 @@ public class AlertInfo {
return this;
}
@Override
public boolean equals(final Object o) {
if (o == this) {
return true;
@ -66,33 +71,32 @@ public class AlertInfo {
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$alertParams = this.getAlertParams();
final Object other$alertParams = other.getAlertParams();
if (this$alertParams == null ? other$alertParams != null : !this$alertParams.equals(other$alertParams)) {
return false;
}
final Object this$alertData = this.getAlertData();
final Object other$alertData = other.getAlertData();
if (this$alertData == null ? other$alertData != null : !this$alertData.equals(other$alertData)) {
final Object thisAlertParams = this.getAlertParams();
final Object otherAlertParams = other.getAlertParams();
if (!Objects.equals(thisAlertParams, otherAlertParams)) {
return false;
}
return true;
final Object thisAlertData = this.getAlertData();
final Object otherAlertData = other.getAlertData();
return Objects.equals(thisAlertData, otherAlertData);
}
protected boolean canEqual(final Object other) {
return other instanceof AlertInfo;
}
@Override
public int hashCode() {
final int PRIME = 59;
final int prime = 59;
int result = 1;
final Object $alertParams = this.getAlertParams();
result = result * PRIME + ($alertParams == null ? 43 : $alertParams.hashCode());
final Object $alertData = this.getAlertData();
result = result * PRIME + ($alertData == null ? 43 : $alertData.hashCode());
final Object alertParams = this.getAlertParams();
result = result * prime + (alertParams == null ? 43 : alertParams.hashCode());
final Object alertData = this.getAlertData();
result = result * prime + (alertData == null ? 43 : alertData.hashCode());
return result;
}
@Override
public String toString() {
return "AlertInfo(alertParams=" + this.getAlertParams() + ", alertData=" + this.getAlertData() + ")";
}
@ -118,6 +122,7 @@ public class AlertInfo {
return new AlertInfo(alertParams, alertData);
}
@Override
public String toString() {
return "AlertInfo.AlertInfoBuilder(alertParams=" + this.alertParams + ", alertData=" + this.alertData + ")";
}

36
dolphinscheduler-alert/dolphinscheduler-alert-api/src/main/java/org/apache/dolphinscheduler/alert/api/AlertResult.java

@ -19,6 +19,11 @@
package org.apache.dolphinscheduler.alert.api;
import java.util.Objects;
/**
* alert result
*/
public class AlertResult {
private String status;
private String message;
@ -53,6 +58,7 @@ public class AlertResult {
return this;
}
@Override
public boolean equals(final Object o) {
if (o == this) {
return true;
@ -61,36 +67,35 @@ public class AlertResult {
return false;
}
final AlertResult other = (AlertResult) o;
if (!other.canEqual((Object) this)) {
if (!other.canEqual(this)) {
return false;
}
final Object this$status = this.getStatus();
final Object other$status = other.getStatus();
if (this$status == null ? other$status != null : !this$status.equals(other$status)) {
final Object thisStatus = this.getStatus();
final Object otherStatus = other.getStatus();
if (!Objects.equals(thisStatus, otherStatus)) {
return false;
}
final Object this$message = this.getMessage();
final Object other$message = other.getMessage();
if (this$message == null ? other$message != null : !this$message.equals(other$message)) {
return false;
}
return true;
final Object thisMessage = this.getMessage();
final Object otherMessage = other.getMessage();
return Objects.equals(thisMessage, otherMessage);
}
protected boolean canEqual(final Object other) {
return other instanceof AlertResult;
}
@Override
public int hashCode() {
final int PRIME = 59;
final int prime = 59;
int result = 1;
final Object $status = this.getStatus();
result = result * PRIME + ($status == null ? 43 : $status.hashCode());
final Object $message = this.getMessage();
result = result * PRIME + ($message == null ? 43 : $message.hashCode());
final Object s = this.getStatus();
result = result * prime + (s == null ? 43 : s.hashCode());
final Object message = this.getMessage();
result = result * prime + (message == null ? 43 : message.hashCode());
return result;
}
@Override
public String toString() {
return "AlertResult(status=" + this.getStatus() + ", message=" + this.getMessage() + ")";
}
@ -116,6 +121,7 @@ public class AlertResult {
return new AlertResult(status, message);
}
@Override
public String toString() {
return "AlertResult.AlertResultBuilder(status=" + this.status + ", message=" + this.message + ")";
}

Loading…
Cancel
Save