This commit is contained in:
insanity 2018-06-05 22:02:11 +09:00
parent c0618808bf
commit 45c39b6b4c
4 changed files with 97 additions and 90 deletions

View File

@ -13,7 +13,7 @@
<groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId>
<packaging>jar</packaging>
<version>1.0.6-SNAPSHOT</version>
<version>1.0.7-SNAPSHOT</version>
<name>com.loafle.overflow.commons-java</name>
<properties>

View File

@ -15,109 +15,109 @@ 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 Date createDate;
private String displayName;
private String description;
private Integer sensorCount;
private Infra infra;
// Transient property
private List<Sensor> sensors;
// Transient property
private List<Sensor> 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;
}
@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;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
@Column(name = "DISPLAY_NAME")
public String getDisplayName() {
return displayName;
}
@Column(name = "DISPLAY_NAME")
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
@Column(name = "DESCRIPTION")
public String getDescription() {
return description;
}
@Column(name = "DESCRIPTION")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public void setDescription(String description) {
this.description = description;
}
@Column(name = "SENSOR_COUNT", nullable = false)
public Integer getSensorCount() {
return sensorCount;
}
@Column(name = "SENSOR_COUNT", nullable = false)
public Integer getSensorCount() {
return sensorCount;
}
public void setSensorCount(Integer sensorCount) {
this.sensorCount = sensorCount;
}
public void setSensorCount(Integer sensorCount) {
this.sensorCount = sensorCount;
}
@Transient
public List<Sensor> getSensors() {
return sensors;
}
@Transient
public List<Sensor> getSensors() {
return sensors;
}
public void setSensors(List<Sensor> sensors) {
this.sensors = sensors;
}
public void setSensors(List<Sensor> sensors) {
this.sensors = sensors;
}
@PrePersist
void preInsert() {
this.sensorCount = 0;
}
@PrePersist
void preInsert() {
this.sensorCount = 0;
}
@OneToOne
@JoinColumn(name = "INFRA_ID", nullable = false)
public Infra getInfra() {
return infra;
}
@OneToOne
@JoinColumn(name = "INFRA_ID", nullable = false)
public Infra getInfra() {
return infra;
}
/**
* @param infra the infra to set
*/
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;
// }
// @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;
// }
}

View File

@ -12,5 +12,5 @@ public interface InfraHostService {
InfraHost read(Long id) throws OverflowException;
InfraHost readByIp(String ip) throws OverflowException;
InfraHost findByProbeIdAndIpv4(String probeId, String ip) throws OverflowException;
}

View File

@ -32,5 +32,12 @@ public interface TargetService {
@WebappAPI
public List<Target> registDiscoveredTargets(Long probeId, List<Host> hosts, List<Service> services)
throws OverflowException;
throws OverflowException;
@WebappAPI
public Target readExistHostTarget(Long probeId, String ip) throws OverflowException;
@WebappAPI
public Target readExistServiceTarget(Long hostId, int portNumber, String portType) throws OverflowException;
}