From e451a5027ed352aa00af403922743609c55be785 Mon Sep 17 00:00:00 2001 From: crusader Date: Sun, 10 Jun 2018 19:24:51 +0900 Subject: [PATCH] ing --- .../overflow/model/infra/InfraHost.java | 2 +- .../loafle/overflow/model/sensor/Sensor.java | 27 +-- .../loafle/overflow/model/target/Target.java | 175 +++++++++--------- 3 files changed, 102 insertions(+), 102 deletions(-) diff --git a/src/main/java/com/loafle/overflow/model/infra/InfraHost.java b/src/main/java/com/loafle/overflow/model/infra/InfraHost.java index 28f1a5e..17c016f 100644 --- a/src/main/java/com/loafle/overflow/model/infra/InfraHost.java +++ b/src/main/java/com/loafle/overflow/model/infra/InfraHost.java @@ -23,7 +23,7 @@ public class InfraHost extends Infra { private List infraHostDaemons; @ManyToOne - @JoinColumn(name = "META_TARGET_HOST_TYPE_ID", nullable = true) + @JoinColumn(name = "META_TARGET_HOST_TYPE_ID", nullable = false) public MetaTargetHostType getMetaTargetHostType() { return metaTargetHostType; } diff --git a/src/main/java/com/loafle/overflow/model/sensor/Sensor.java b/src/main/java/com/loafle/overflow/model/sensor/Sensor.java index 9612836..9732a22 100644 --- a/src/main/java/com/loafle/overflow/model/sensor/Sensor.java +++ b/src/main/java/com/loafle/overflow/model/sensor/Sensor.java @@ -18,14 +18,14 @@ import java.util.List; @Table(name = "SENSOR", schema = "public") public class Sensor { private Long id; - private Date createDate; + private Target target; + private String displayName; private String description; private MetaSensorStatus metaSensorStatus; - private Target target; private MetaCrawler metaCrawler; private String crawlerInputItems; private Integer itemCount = 0; - private String displayName; + private Date createDate; // Transient property private List sensorItems; @@ -40,16 +40,6 @@ public class Sensor { this.id = id; } - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) - public Date getCreateDate() { - return createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - @Column(name = "DESCRIPTION", nullable = true, length = 50) public String getDescription() { return description; @@ -117,6 +107,17 @@ public class Sensor { this.displayName = displayName; } + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @PrePersist void preInsert() { this.itemCount = 0; diff --git a/src/main/java/com/loafle/overflow/model/target/Target.java b/src/main/java/com/loafle/overflow/model/target/Target.java index f2b4516..462a443 100644 --- a/src/main/java/com/loafle/overflow/model/target/Target.java +++ b/src/main/java/com/loafle/overflow/model/target/Target.java @@ -15,109 +15,108 @@ import java.util.List; @Table(name = "TARGET", schema = "public") public class Target { - private Long id; - private Date createDate; - private String displayName; - private String description; - private Integer sensorCount; - private Infra infra; + private Long id; + private Infra infra; + private String displayName; + private String description; + private Integer sensorCount; + private Date createDate; - // Transient property - private List sensors; + // Transient property + private List sensors; - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - public Long getId() { - return id; - } + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + public Long getId() { + return id; + } - public void setId(Long id) { - this.id = id; - } + public void setId(Long id) { + this.id = id; + } - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) - public Date getCreateDate() { - return createDate; - } + @Column(name = "DISPLAY_NAME") + public String getDisplayName() { + return displayName; + } - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } + public void setDisplayName(String displayName) { + this.displayName = displayName; + } - @Column(name = "DISPLAY_NAME") - public String getDisplayName() { - return displayName; - } + @Column(name = "DESCRIPTION") + public String getDescription() { + return description; + } - public void setDisplayName(String displayName) { - this.displayName = displayName; - } + public void setDescription(String description) { + this.description = description; + } - @Column(name = "DESCRIPTION") - public String getDescription() { - return description; - } + @Column(name = "SENSOR_COUNT", nullable = false) + public Integer getSensorCount() { + return sensorCount; + } - public void setDescription(String description) { - this.description = description; - } + public void setSensorCount(Integer sensorCount) { + this.sensorCount = sensorCount; + } - @Column(name = "SENSOR_COUNT", nullable = false) - public Integer getSensorCount() { - return sensorCount; - } + @Transient + public List getSensors() { + return sensors; + } - public void setSensorCount(Integer sensorCount) { - this.sensorCount = sensorCount; - } + public void setSensors(List sensors) { + this.sensors = sensors; + } - @Transient - public List getSensors() { - return sensors; - } + @PrePersist + void preInsert() { + this.sensorCount = 0; + } - public void setSensors(List sensors) { - this.sensors = sensors; - } + @OneToOne + @JoinColumn(name = "INFRA_ID", nullable = false) + public Infra getInfra() { + return infra; + } - @PrePersist - void preInsert() { - this.sensorCount = 0; - } + /** + * @param infra the infra to set + */ + public void setInfra(Infra infra) { + this.infra = infra; + } - @OneToOne - @JoinColumn(name = "INFRA_ID", nullable = false) - public Infra getInfra() { - return infra; - } + // @ManyToOne + // @JoinColumn(name = "PROBE_ID", nullable = false) + // @OnDelete(action = OnDeleteAction.CASCADE) + // public Probe getProbe() { + // return probe; + // } + // + // public void setProbe(Probe probe) { + // this.probe = probe; + // } + // + // @ManyToOne + // @JoinColumn(name = "INFRA_ID", nullable = false) + // public Infra getInfra() { + // return infra; + // } + // + // public void setInfra(Infra infra) { + // this.infra = infra; + // } - /** - * @param infra the infra to set - */ - public void setInfra(Infra infra) { - this.infra = infra; - } - - // @ManyToOne - // @JoinColumn(name = "PROBE_ID", nullable = false) - // @OnDelete(action = OnDeleteAction.CASCADE) - // public Probe getProbe() { - // return probe; - // } - // - // public void setProbe(Probe probe) { - // this.probe = probe; - // } - // - // @ManyToOne - // @JoinColumn(name = "INFRA_ID", nullable = false) - // public Infra getInfra() { - // return infra; - // } - // - // public void setInfra(Infra infra) { - // this.infra = infra; - // } + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } }