This commit is contained in:
crusader 2018-06-10 19:24:51 +09:00
parent c95612377e
commit e451a5027e
3 changed files with 102 additions and 102 deletions

View File

@ -23,7 +23,7 @@ public class InfraHost extends Infra {
private List<InfraHostDaemon> infraHostDaemons; private List<InfraHostDaemon> infraHostDaemons;
@ManyToOne @ManyToOne
@JoinColumn(name = "META_TARGET_HOST_TYPE_ID", nullable = true) @JoinColumn(name = "META_TARGET_HOST_TYPE_ID", nullable = false)
public MetaTargetHostType getMetaTargetHostType() { public MetaTargetHostType getMetaTargetHostType() {
return metaTargetHostType; return metaTargetHostType;
} }

View File

@ -18,14 +18,14 @@ import java.util.List;
@Table(name = "SENSOR", schema = "public") @Table(name = "SENSOR", schema = "public")
public class Sensor { public class Sensor {
private Long id; private Long id;
private Date createDate; private Target target;
private String displayName;
private String description; private String description;
private MetaSensorStatus metaSensorStatus; private MetaSensorStatus metaSensorStatus;
private Target target;
private MetaCrawler metaCrawler; private MetaCrawler metaCrawler;
private String crawlerInputItems; private String crawlerInputItems;
private Integer itemCount = 0; private Integer itemCount = 0;
private String displayName; private Date createDate;
// Transient property // Transient property
private List<MetaSensorDisplayItem> sensorItems; private List<MetaSensorDisplayItem> sensorItems;
@ -40,16 +40,6 @@ public class Sensor {
this.id = 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;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
@Column(name = "DESCRIPTION", nullable = true, length = 50) @Column(name = "DESCRIPTION", nullable = true, length = 50)
public String getDescription() { public String getDescription() {
return description; return description;
@ -117,6 +107,17 @@ public class Sensor {
this.displayName = displayName; 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 @PrePersist
void preInsert() { void preInsert() {
this.itemCount = 0; this.itemCount = 0;

View File

@ -15,109 +15,108 @@ import java.util.List;
@Table(name = "TARGET", schema = "public") @Table(name = "TARGET", schema = "public")
public class Target { public class Target {
private Long id; private Long id;
private Date createDate; private Infra infra;
private String displayName; private String displayName;
private String description; private String description;
private Integer sensorCount; private Integer sensorCount;
private Infra infra; private Date createDate;
// Transient property // Transient property
private List<Sensor> sensors; private List<Sensor> sensors;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() { public Long getId() {
return id; return id;
} }
public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
@Temporal(TemporalType.TIMESTAMP) @Column(name = "DISPLAY_NAME")
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) public String getDisplayName() {
public Date getCreateDate() { return displayName;
return createDate; }
}
public void setCreateDate(Date createDate) { public void setDisplayName(String displayName) {
this.createDate = createDate; this.displayName = displayName;
} }
@Column(name = "DISPLAY_NAME") @Column(name = "DESCRIPTION")
public String getDisplayName() { public String getDescription() {
return displayName; return description;
} }
public void setDisplayName(String displayName) { public void setDescription(String description) {
this.displayName = displayName; this.description = description;
} }
@Column(name = "DESCRIPTION") @Column(name = "SENSOR_COUNT", nullable = false)
public String getDescription() { public Integer getSensorCount() {
return description; return sensorCount;
} }
public void setDescription(String description) { public void setSensorCount(Integer sensorCount) {
this.description = description; this.sensorCount = sensorCount;
} }
@Column(name = "SENSOR_COUNT", nullable = false) @Transient
public Integer getSensorCount() { public List<Sensor> getSensors() {
return sensorCount; return sensors;
} }
public void setSensorCount(Integer sensorCount) { public void setSensors(List<Sensor> sensors) {
this.sensorCount = sensorCount; this.sensors = sensors;
} }
@Transient @PrePersist
public List<Sensor> getSensors() { void preInsert() {
return sensors; this.sensorCount = 0;
} }
public void setSensors(List<Sensor> sensors) { @OneToOne
this.sensors = sensors; @JoinColumn(name = "INFRA_ID", nullable = false)
} public Infra getInfra() {
return infra;
}
@PrePersist /**
void preInsert() { * @param infra the infra to set
this.sensorCount = 0; */
} public void setInfra(Infra infra) {
this.infra = infra;
}
@OneToOne // @ManyToOne
@JoinColumn(name = "INFRA_ID", nullable = false) // @JoinColumn(name = "PROBE_ID", nullable = false)
public Infra getInfra() { // @OnDelete(action = OnDeleteAction.CASCADE)
return infra; // 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)
* @param infra the infra to set @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
*/ public Date getCreateDate() {
public void setInfra(Infra infra) { return createDate;
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;
// }
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
} }