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> <groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId> <artifactId>commons-java</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.0.6-SNAPSHOT</version> <version>1.0.7-SNAPSHOT</version>
<name>com.loafle.overflow.commons-java</name> <name>com.loafle.overflow.commons-java</name>
<properties> <properties>

View File

@ -15,109 +15,109 @@ 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 Date createDate;
private String displayName; private String displayName;
private String description; private String description;
private Integer sensorCount; private Integer sensorCount;
private Infra infra; private Infra infra;
// 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) @Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
public Date getCreateDate() { public Date getCreateDate() {
return createDate; return createDate;
} }
public void setCreateDate(Date createDate) { public void setCreateDate(Date createDate) {
this.createDate = createDate; this.createDate = createDate;
} }
@Column(name = "DISPLAY_NAME") @Column(name = "DISPLAY_NAME")
public String getDisplayName() { public String getDisplayName() {
return displayName; return displayName;
} }
public void setDisplayName(String displayName) { public void setDisplayName(String displayName) {
this.displayName = displayName; this.displayName = displayName;
} }
@Column(name = "DESCRIPTION") @Column(name = "DESCRIPTION")
public String getDescription() { public String getDescription() {
return description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
@Column(name = "SENSOR_COUNT", nullable = false) @Column(name = "SENSOR_COUNT", nullable = false)
public Integer getSensorCount() { public Integer getSensorCount() {
return sensorCount; return sensorCount;
} }
public void setSensorCount(Integer sensorCount) { public void setSensorCount(Integer sensorCount) {
this.sensorCount = sensorCount; this.sensorCount = sensorCount;
} }
@Transient @Transient
public List<Sensor> getSensors() { public List<Sensor> getSensors() {
return sensors; return sensors;
} }
public void setSensors(List<Sensor> sensors) { public void setSensors(List<Sensor> sensors) {
this.sensors = sensors; this.sensors = sensors;
} }
@PrePersist @PrePersist
void preInsert() { void preInsert() {
this.sensorCount = 0; this.sensorCount = 0;
} }
@OneToOne @OneToOne
@JoinColumn(name = "INFRA_ID", nullable = false) @JoinColumn(name = "INFRA_ID", nullable = false)
public Infra getInfra() { public Infra getInfra() {
return infra; return infra;
} }
/** /**
* @param infra the infra to set * @param infra the infra to set
*/ */
public void setInfra(Infra infra) { public void setInfra(Infra infra) {
this.infra = infra; this.infra = infra;
} }
// @ManyToOne // @ManyToOne
// @JoinColumn(name = "PROBE_ID", nullable = false) // @JoinColumn(name = "PROBE_ID", nullable = false)
// @OnDelete(action = OnDeleteAction.CASCADE) // @OnDelete(action = OnDeleteAction.CASCADE)
// public Probe getProbe() { // public Probe getProbe() {
// return probe; // return probe;
// } // }
// //
// public void setProbe(Probe probe) { // public void setProbe(Probe probe) {
// this.probe = probe; // this.probe = probe;
// } // }
// //
// @ManyToOne // @ManyToOne
// @JoinColumn(name = "INFRA_ID", nullable = false) // @JoinColumn(name = "INFRA_ID", nullable = false)
// public Infra getInfra() { // public Infra getInfra() {
// return infra; // return infra;
// } // }
// //
// public void setInfra(Infra infra) { // public void setInfra(Infra infra) {
// this.infra = infra; // this.infra = infra;
// } // }
} }

View File

@ -12,5 +12,5 @@ public interface InfraHostService {
InfraHost read(Long id) throws OverflowException; 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 @WebappAPI
public List<Target> registDiscoveredTargets(Long probeId, List<Host> hosts, List<Service> services) 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;
} }