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; package org.apache.dolphinscheduler.alert.api;
/**
* alert channel for sending alerts
*/
public interface AlertChannel { public interface AlertChannel {
/**
* process and send alert
* @param info alert info
* @return process alarm result
*/
AlertResult process(AlertInfo info); 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; import java.util.List;
/**
* alert channel factory
*/
public interface AlertChannelFactory { public interface AlertChannelFactory {
/**
* Returns the name of the alert channel
* @return the name of the alert channel
*/
String name(); String name();
/**
* Create an alert channel
*
* @return alert channel
*/
AlertChannel create(); 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; package org.apache.dolphinscheduler.alert.api;
import java.util.Objects;
/**
* alert data
*/
public class AlertData { public class AlertData {
private int id; private int id;
private String title; private String title;
@ -85,6 +90,7 @@ public class AlertData {
this.warnType = warnType; this.warnType = warnType;
} }
@Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (o == this) {
return true; return true;
@ -93,7 +99,7 @@ public class AlertData {
return false; return false;
} }
final AlertData other = (AlertData) o; final AlertData other = (AlertData) o;
if (!other.canEqual((Object) this)) { if (!other.canEqual(this)) {
return false; return false;
} }
if (this.getId() != other.getId()) { if (this.getId() != other.getId()) {
@ -102,42 +108,41 @@ public class AlertData {
if (this.getWarnType() != other.getWarnType()) { if (this.getWarnType() != other.getWarnType()) {
return false; return false;
} }
final Object this$title = this.getTitle(); final Object thisTitle = this.getTitle();
final Object other$title = other.getTitle(); final Object otherTitle = other.getTitle();
if (this$title == null ? other$title != null : !this$title.equals(other$title)) { 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)) {
return false; return false;
} }
final Object this$log = this.getLog(); final Object thisContent = this.getContent();
final Object other$log = other.getLog(); final Object otherContent = other.getContent();
if (this$log == null ? other$log != null : !this$log.equals(other$log)) { if (!Objects.equals(thisContent, otherContent)) {
return false; 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) { protected boolean canEqual(final Object other) {
return other instanceof AlertData; return other instanceof AlertData;
} }
@Override
public int hashCode() { public int hashCode() {
final int PRIME = 59; final int prime = 59;
int result = 1; int result = 1;
result = result * PRIME + this.getId(); result = result * prime + this.getId();
result = result * PRIME + this.getWarnType(); result = result * prime + this.getWarnType();
final Object $title = this.getTitle(); final Object title = this.getTitle();
result = result * PRIME + ($title == null ? 43 : $title.hashCode()); result = result * prime + (title == null ? 43 : title.hashCode());
final Object $content = this.getContent(); final Object content = this.getContent();
result = result * PRIME + ($content == null ? 43 : $content.hashCode()); result = result * prime + (content == null ? 43 : content.hashCode());
final Object $log = this.getLog(); final Object log = this.getLog();
result = result * PRIME + ($log == null ? 43 : $log.hashCode()); result = result * prime + (log == null ? 43 : log.hashCode());
return result; return result;
} }
@Override
public String toString() { public String toString() {
return "AlertData(id=" + this.getId() + ", title=" + this.getTitle() + ", content=" + this.getContent() + ", log=" + this.getLog() + ", warnType=" + this.getWarnType() + ")"; 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); return new AlertData(id, title, content, log, warnType);
} }
@Override
public String toString() { public String toString() {
return "AlertData.AlertDataBuilder(id=" + this.id + ", title=" + this.title + ", content=" + this.content + ", log=" + this.log + ", warnType=" + this.warnType + ")"; 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; package org.apache.dolphinscheduler.alert.api;
import java.util.Map; 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 { public class AlertInfo {
private Map<String, String> alertParams; private Map<String, String> alertParams;
private AlertData alertData; private AlertData alertData;
@ -55,6 +59,7 @@ public class AlertInfo {
return this; return this;
} }
@Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (o == this) {
return true; return true;
@ -66,33 +71,32 @@ public class AlertInfo {
if (!other.canEqual((Object) this)) { if (!other.canEqual((Object) this)) {
return false; return false;
} }
final Object this$alertParams = this.getAlertParams(); final Object thisAlertParams = this.getAlertParams();
final Object other$alertParams = other.getAlertParams(); final Object otherAlertParams = other.getAlertParams();
if (this$alertParams == null ? other$alertParams != null : !this$alertParams.equals(other$alertParams)) { if (!Objects.equals(thisAlertParams, otherAlertParams)) {
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)) {
return false; 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) { protected boolean canEqual(final Object other) {
return other instanceof AlertInfo; return other instanceof AlertInfo;
} }
@Override
public int hashCode() { public int hashCode() {
final int PRIME = 59; final int prime = 59;
int result = 1; int result = 1;
final Object $alertParams = this.getAlertParams(); final Object alertParams = this.getAlertParams();
result = result * PRIME + ($alertParams == null ? 43 : $alertParams.hashCode()); result = result * prime + (alertParams == null ? 43 : alertParams.hashCode());
final Object $alertData = this.getAlertData(); final Object alertData = this.getAlertData();
result = result * PRIME + ($alertData == null ? 43 : $alertData.hashCode()); result = result * prime + (alertData == null ? 43 : alertData.hashCode());
return result; return result;
} }
@Override
public String toString() { public String toString() {
return "AlertInfo(alertParams=" + this.getAlertParams() + ", alertData=" + this.getAlertData() + ")"; return "AlertInfo(alertParams=" + this.getAlertParams() + ", alertData=" + this.getAlertData() + ")";
} }
@ -118,6 +122,7 @@ public class AlertInfo {
return new AlertInfo(alertParams, alertData); return new AlertInfo(alertParams, alertData);
} }
@Override
public String toString() { public String toString() {
return "AlertInfo.AlertInfoBuilder(alertParams=" + this.alertParams + ", alertData=" + this.alertData + ")"; 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; package org.apache.dolphinscheduler.alert.api;
import java.util.Objects;
/**
* alert result
*/
public class AlertResult { public class AlertResult {
private String status; private String status;
private String message; private String message;
@ -53,6 +58,7 @@ public class AlertResult {
return this; return this;
} }
@Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (o == this) {
return true; return true;
@ -61,36 +67,35 @@ public class AlertResult {
return false; return false;
} }
final AlertResult other = (AlertResult) o; 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)) {
return false; return false;
} }
final Object this$message = this.getMessage(); final Object thisStatus = this.getStatus();
final Object other$message = other.getMessage(); final Object otherStatus = other.getStatus();
if (this$message == null ? other$message != null : !this$message.equals(other$message)) { if (!Objects.equals(thisStatus, otherStatus)) {
return false; 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) { protected boolean canEqual(final Object other) {
return other instanceof AlertResult; return other instanceof AlertResult;
} }
@Override
public int hashCode() { public int hashCode() {
final int PRIME = 59; final int prime = 59;
int result = 1; int result = 1;
final Object $status = this.getStatus(); final Object s = this.getStatus();
result = result * PRIME + ($status == null ? 43 : $status.hashCode()); result = result * prime + (s == null ? 43 : s.hashCode());
final Object $message = this.getMessage(); final Object message = this.getMessage();
result = result * PRIME + ($message == null ? 43 : $message.hashCode()); result = result * prime + (message == null ? 43 : message.hashCode());
return result; return result;
} }
@Override
public String toString() { public String toString() {
return "AlertResult(status=" + this.getStatus() + ", message=" + this.getMessage() + ")"; return "AlertResult(status=" + this.getStatus() + ", message=" + this.getMessage() + ")";
} }
@ -116,6 +121,7 @@ public class AlertResult {
return new AlertResult(status, message); return new AlertResult(status, message);
} }
@Override
public String toString() { public String toString() {
return "AlertResult.AlertResultBuilder(status=" + this.status + ", message=" + this.message + ")"; return "AlertResult.AlertResultBuilder(status=" + this.status + ", message=" + this.message + ")";
} }

Loading…
Cancel
Save