1 Commits

Author SHA1 Message Date
Rinjae 7f73e6fcd0 djb_apistatus_incident 엔티티/리포지토리 신설
- DjbApistatusIncident / Api / Timeline 3개 엔티티
- IncidentKind / IncidentState enum
- EMSADM 스키마 1:1 매핑, Spring Data JPA 리포지토리

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-16 09:11:14 +09:00
9 changed files with 247 additions and 0 deletions
@@ -0,0 +1,71 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
import com.eactive.apim.portal.common.entity.Auditable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.time.LocalDateTime;
@Entity
@Table(name = "DJB_APISTATUS_INCIDENT")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class DjbApistatusIncident extends Auditable {
@Id
@SequenceGenerator(name = "seqDjbApistatusIncident",
sequenceName = "SEQ_DJB_APISTATUS_INCIDENT", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqDjbApistatusIncident")
@Column(name = "INCIDENT_ID", nullable = false)
private Long incidentId;
@Enumerated(EnumType.STRING)
@Column(name = "KIND", length = 20, nullable = false)
private IncidentKind kind;
@Enumerated(EnumType.STRING)
@Column(name = "STATE", length = 30)
private IncidentState state;
@Enumerated(EnumType.STRING)
@Column(name = "PREVIOUS_STATE", length = 30)
private IncidentState previousState;
@Column(name = "TITLE", length = 500, nullable = false)
private String title;
@Column(name = "SUMMARY", length = 2000)
private String summary;
@Column(name = "STARTED_AT")
private LocalDateTime startedAt;
@Column(name = "END_AT")
private LocalDateTime endAt;
@Column(name = "DETECTED_BY", length = 30, nullable = false)
private String detectedBy = "MANUAL";
@Column(name = "INTERFACE_ID", length = 200)
private String interfaceId;
@Column(name = "NOTICE_ID", length = 36)
private String noticeId;
@Column(name = "DRAFT_YN", length = 1, nullable = false)
private String draftYn = "N";
@Column(name = "FIX_YN", length = 1, nullable = false)
private String fixYn = "N";
}
@@ -0,0 +1,38 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
import com.eactive.apim.portal.common.entity.Auditable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import java.time.LocalDateTime;
@Entity
@Table(name = "DJB_APISTATUS_INCIDENT_API")
@IdClass(DjbApistatusIncidentApiId.class)
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true)
public class DjbApistatusIncidentApi extends Auditable {
@Id
@EqualsAndHashCode.Include
@Column(name = "INCIDENT_ID", nullable = false)
private Long incidentId;
@Id
@EqualsAndHashCode.Include
@Column(name = "API_ID", length = 30, nullable = false)
private String apiId;
@Column(name = "API_NAME", length = 200)
private String apiName;
@Column(name = "RECOVERED_AT")
private LocalDateTime recoveredAt;
}
@@ -0,0 +1,18 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DjbApistatusIncidentApiId implements Serializable {
private static final long serialVersionUID = 1L;
private Long incidentId;
private String apiId;
}
@@ -0,0 +1,51 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
import com.eactive.apim.portal.common.entity.Auditable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.time.LocalDateTime;
@Entity
@Table(name = "DJB_APISTATUS_INCIDENT_TIMELINE")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class DjbApistatusIncidentTimeline extends Auditable {
@Id
@SequenceGenerator(name = "seqDjbApistatusIncidentTimeline",
sequenceName = "SEQ_DJB_APISTATUS_INCIDENT_TIMELINE", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqDjbApistatusIncidentTimeline")
@Column(name = "TIMELINE_ID", nullable = false)
private Long timelineId;
@Column(name = "INCIDENT_ID", nullable = false)
private Long incidentId;
@Column(name = "EVENT_AT", nullable = false)
private LocalDateTime eventAt;
@Enumerated(EnumType.STRING)
@Column(name = "STATE_AFTER", length = 30)
private IncidentState stateAfter;
@Column(name = "BODY", length = 4000, nullable = false)
private String body;
@Column(name = "AUTHOR_TYPE", length = 20, nullable = false)
private String authorType = "OPERATOR";
@Column(name = "VISIBLE_YN", length = 1, nullable = false)
private String visibleYn = "Y";
}
@@ -0,0 +1,6 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
public enum IncidentKind {
INCIDENT,
MAINTENANCE
}
@@ -0,0 +1,9 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
public enum IncidentState {
INVESTIGATING,
IDENTIFIED,
MONITORING,
RESOLVED,
CANCELED
}
@@ -0,0 +1,19 @@
package com.eactive.apim.portal.djb.apistatus.incident.repository;
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncidentApi;
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncidentApiId;
import com.eactive.eai.rms.data.EMSDataSource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@EMSDataSource
public interface DjbApistatusIncidentApiRepository
extends JpaRepository<DjbApistatusIncidentApi, DjbApistatusIncidentApiId> {
List<DjbApistatusIncidentApi> findByIncidentIdOrderByApiId(Long incidentId);
void deleteByIncidentId(Long incidentId);
}
@@ -0,0 +1,17 @@
package com.eactive.apim.portal.djb.apistatus.incident.repository;
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncident;
import com.eactive.eai.rms.data.EMSDataSource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
@EMSDataSource
public interface DjbApistatusIncidentRepository
extends JpaRepository<DjbApistatusIncident, Long>, JpaSpecificationExecutor<DjbApistatusIncident> {
Optional<DjbApistatusIncident> findByNoticeId(String noticeId);
}
@@ -0,0 +1,18 @@
package com.eactive.apim.portal.djb.apistatus.incident.repository;
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncidentTimeline;
import com.eactive.eai.rms.data.EMSDataSource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@EMSDataSource
public interface DjbApistatusIncidentTimelineRepository
extends JpaRepository<DjbApistatusIncidentTimeline, Long> {
List<DjbApistatusIncidentTimeline> findByIncidentIdOrderByEventAtAsc(Long incidentId);
void deleteByIncidentId(Long incidentId);
}