.test insert controller method

This commit is contained in:
jackdaw 2016-11-17 17:03:53 +09:00
parent 20aecd061d
commit 3cdc4b2ccf
3 changed files with 15 additions and 1 deletions

View File

@ -25,7 +25,7 @@ public class DiscoveryHistory
private Boolean result; private Boolean result;
@JoinColumn @JoinColumn
@OneToOne(cascade = CascadeType.ALL) @OneToOne(mappedBy = "discovery",cascade = CascadeType.ALL)
private DiscoveryZone zone; private DiscoveryZone zone;
public DiscoveryZone getZone() { public DiscoveryZone getZone() {

View File

@ -64,6 +64,7 @@ public class DiscoveryPortController {
String ip = "3232235983"; String ip = "3232235983";
z.setCidr(Long.parseLong(cidr)); z.setCidr(Long.parseLong(cidr));
z.setIp(Long.parseLong(ip)); z.setIp(Long.parseLong(ip));
z.setDiscovery(d);
d.setZone(z); d.setZone(z);
// host scan histories // host scan histories

View File

@ -1,5 +1,6 @@
package com.loafle.bridge.discoveryzone; package com.loafle.bridge.discoveryzone;
import com.loafle.bridge.discoveryhistory.DiscoveryHistory;
import com.loafle.bridge.discoveryhost.DiscoveryHost; import com.loafle.bridge.discoveryhost.DiscoveryHost;
import javax.persistence.*; import javax.persistence.*;
@ -22,6 +23,10 @@ public class DiscoveryZone {
@Column(nullable=false) @Column(nullable=false)
private long cidr; private long cidr;
@JoinColumn
@OneToOne
private DiscoveryHistory discovery;
@OneToMany(mappedBy = "zone", cascade = CascadeType.ALL) @OneToMany(mappedBy = "zone", cascade = CascadeType.ALL)
private List<HostScanHistory> hostScanHistories; private List<HostScanHistory> hostScanHistories;
@ -67,4 +72,12 @@ public class DiscoveryZone {
public void setCidr(long cidr) { public void setCidr(long cidr) {
this.cidr = cidr; this.cidr = cidr;
} }
public DiscoveryHistory getDiscovery() {
return discovery;
}
public void setDiscovery(DiscoveryHistory discovery) {
this.discovery = discovery;
}
} }