Skip to content

Commit 6b26047

Browse files
committed
feat(alert): refactor AlertType and related classes for improved structure and clarity
1 parent 69419f7 commit 6b26047

23 files changed

Lines changed: 413 additions & 564 deletions

backend/src/main/java/com/park/utmstack/aop/logging/AlertLoggingAspect.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.park.utmstack.domain.chart_builder.types.query.FilterType;
66
import com.park.utmstack.domain.chart_builder.types.query.OperatorType;
77
import com.park.utmstack.domain.index_pattern.enums.SystemIndexPattern;
8-
import com.park.utmstack.domain.shared_types.AlertType;
8+
import com.park.utmstack.domain.shared_types.alert.AlertType;
99
import com.park.utmstack.security.SecurityUtils;
1010
import com.park.utmstack.service.UtmAlertLogService;
1111
import com.park.utmstack.service.elasticsearch.ElasticsearchService;

backend/src/main/java/com/park/utmstack/domain/alert_response_rule/UtmAlertResponseRule.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public class UtmAlertResponseRule implements Serializable {
6262
@Column(name = "last_modified_date")
6363
private Instant lastModifiedDate;
6464

65+
@OneToMany(mappedBy = "rule", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
66+
List<UtmAlertResponseRuleExecution> utmAlertResponseRuleExecutions;
67+
68+
6569
@ManyToMany
6670
@JoinTable(
6771
name = "utm_alert_response_rule_template",

backend/src/main/java/com/park/utmstack/domain/alert_response_rule/UtmAlertResponseRuleExecution.java

Lines changed: 5 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import com.park.utmstack.domain.alert_response_rule.enums.RuleExecutionStatus;
55
import com.park.utmstack.domain.alert_response_rule.enums.RuleNonExecutionCause;
6+
import lombok.Data;
67
import org.springframework.data.annotation.CreatedDate;
78
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
89

@@ -14,6 +15,7 @@
1415

1516
@Entity
1617
@Table(name = "utm_alert_response_rule_execution")
18+
@Data
1719
@EntityListeners(AuditingEntityListener.class)
1820
public class UtmAlertResponseRuleExecution implements Serializable {
1921

@@ -61,84 +63,8 @@ public class UtmAlertResponseRuleExecution implements Serializable {
6163
@Column(name = "execution_retries")
6264
private Integer executionRetries = 0;
6365

66+
@ManyToOne
67+
@JoinColumn(name = "rule_id", referencedColumnName = "id", insertable = false, updatable = false)
68+
UtmAlertResponseRule rule;
6469

65-
public Long getId() {
66-
return id;
67-
}
68-
69-
public void setId(Long id) {
70-
this.id = id;
71-
}
72-
73-
public Long getRuleId() {
74-
return ruleId;
75-
}
76-
77-
public void setRuleId(Long ruleId) {
78-
this.ruleId = ruleId;
79-
}
80-
81-
public String getAlertId() {
82-
return alertId;
83-
}
84-
85-
public void setAlertId(String alertId) {
86-
this.alertId = alertId;
87-
}
88-
89-
public String getCommand() {
90-
return command;
91-
}
92-
93-
public void setCommand(String command) {
94-
this.command = command;
95-
}
96-
97-
public String getCommandResult() {
98-
return commandResult;
99-
}
100-
101-
public void setCommandResult(String commandResult) {
102-
this.commandResult = commandResult;
103-
}
104-
105-
public String getAgent() {
106-
return agent;
107-
}
108-
109-
public void setAgent(String agent) {
110-
this.agent = agent;
111-
}
112-
113-
public Instant getExecutionDate() {
114-
return executionDate;
115-
}
116-
117-
public void setExecutionDate(Instant executionDate) {
118-
this.executionDate = executionDate;
119-
}
120-
121-
public RuleExecutionStatus getExecutionStatus() {
122-
return executionStatus;
123-
}
124-
125-
public void setExecutionStatus(RuleExecutionStatus executionStatus) {
126-
this.executionStatus = executionStatus;
127-
}
128-
129-
public RuleNonExecutionCause getNonExecutionCause() {
130-
return nonExecutionCause;
131-
}
132-
133-
public void setNonExecutionCause(RuleNonExecutionCause nonExecutionCause) {
134-
this.nonExecutionCause = nonExecutionCause;
135-
}
136-
137-
public Integer getExecutionRetries() {
138-
return executionRetries;
139-
}
140-
141-
public void setExecutionRetries(Integer executionRetries) {
142-
this.executionRetries = executionRetries;
143-
}
14470
}

backend/src/main/java/com/park/utmstack/domain/reports/types/IncidentType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.park.utmstack.domain.reports.types;
22

33
import com.park.utmstack.domain.incident_response.UtmIncidentJob;
4-
import com.park.utmstack.domain.shared_types.AlertType;
4+
import com.park.utmstack.domain.shared_types.alert.AlertType;
55

66
import java.util.List;
77

0 commit comments

Comments
 (0)