diff --git a/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java b/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java index bbb5a93..8bf2bde 100644 --- a/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java +++ b/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java @@ -66,7 +66,7 @@ public class NoAuthProbe { this.ipAddress = ipAddress; } - @Column(name = "STATUS", nullable = false) + @Column(name = "STATUS", nullable = false, length = 1) @Enumerated(EnumType.STRING) public AuthType getStatus() { return status; @@ -76,7 +76,7 @@ public class NoAuthProbe { this.status = status; } - @Column(name = "TEMP_PROBE_KEY", nullable = false, length = 50) + @Column(name = "TEMP_PROBE_KEY", nullable = false, length = 50, unique = true) public String getTempProbeKey() { return tempProbeKey; } diff --git a/src/main/java/com/loafle/overflow/module/noauthprobe/type/AuthType.java b/src/main/java/com/loafle/overflow/module/noauthprobe/type/AuthType.java index ef17939..1d58a0f 100644 --- a/src/main/java/com/loafle/overflow/module/noauthprobe/type/AuthType.java +++ b/src/main/java/com/loafle/overflow/module/noauthprobe/type/AuthType.java @@ -4,9 +4,9 @@ package com.loafle.overflow.module.noauthprobe.type; * Created by root on 17. 5. 31. */ public enum AuthType { - ACCEPT("A"), - DENY("D"), - PROCESS("P"); + A("ACCEPT"), + D("DENY"), + P("PROCESS"); private String stringValue; AuthType(String string) {stringValue = string;} diff --git a/src/main/java/com/loafle/overflow/module/probe/model/Probe.java b/src/main/java/com/loafle/overflow/module/probe/model/Probe.java index bdd4bc4..4539598 100644 --- a/src/main/java/com/loafle/overflow/module/probe/model/Probe.java +++ b/src/main/java/com/loafle/overflow/module/probe/model/Probe.java @@ -1,6 +1,7 @@ package com.loafle.overflow.module.probe.model; import com.loafle.overflow.module.domain.Domain; +import com.loafle.overflow.module.probe.type.ProbeStatusType; import javax.persistence.*; import java.sql.Timestamp; @@ -13,7 +14,7 @@ import java.util.Date; @Table(name = "PROBE", schema = "public", catalog = "postgres") public class Probe { private long id; - private String status; + private ProbeStatusType status; private String description; private Date createDate; private Date lastPollingDate; @@ -33,12 +34,13 @@ public class Probe { } - @Column(name = "STATUS", nullable = true) - public String getStatus() { + @Column(name = "STATUS", nullable = false, length = 1) + @Enumerated(EnumType.STRING) + public ProbeStatusType getStatus() { return status; } - public void setStatus(String status) { + public void setStatus(ProbeStatusType status) { this.status = status; } @@ -53,7 +55,7 @@ public class Probe { } @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) public Date getCreateDate() { return createDate; } @@ -93,7 +95,7 @@ public class Probe { } - @Column(name = "PROBE_KEY", nullable = false) + @Column(name = "PROBE_KEY", nullable = false, unique = true) public String getProbeKey() { return probeKey; } @@ -103,7 +105,7 @@ public class Probe { } - @Column(name = "ENCRYPTION_KEY", nullable = false, length = 50) + @Column(name = "ENCRYPTION_KEY", nullable = false, length = 50, unique = true) public String getEncryptionKey() { return encryptionKey; } diff --git a/src/main/java/com/loafle/overflow/module/probe/type/ProbeStatusType.java b/src/main/java/com/loafle/overflow/module/probe/type/ProbeStatusType.java new file mode 100644 index 0000000..1e4c602 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/probe/type/ProbeStatusType.java @@ -0,0 +1,18 @@ +package com.loafle.overflow.module.probe.type; + +/** + * Created by root on 17. 6. 23. + */ +public enum ProbeStatusType { + I("INITIAL"), + N("NORMAL"); + + + private String stringValue; + ProbeStatusType(String string) {stringValue = string;} + + @Override + public String toString() { + return stringValue; + } +}