mapping method
This commit is contained in:
parent
e985f0921e
commit
cd5464a5cf
|
@ -20,7 +20,7 @@ public class DiscoveriyHistoryController {
|
||||||
|
|
||||||
DiscoveryZone zone = history.getZone();
|
DiscoveryZone zone = history.getZone();
|
||||||
if (zone != null) {
|
if (zone != null) {
|
||||||
zone.mappingChildren();
|
zone.mappingChildren(history);
|
||||||
}
|
}
|
||||||
discoveryHistoryRepository.save(history);
|
discoveryHistoryRepository.save(history);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class DiscoveryHost {
|
||||||
this.zone = zone;
|
this.zone = zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OneToMany(mappedBy = "host")
|
@OneToMany(mappedBy = "host", cascade = CascadeType.ALL)
|
||||||
private List<PortScanHistory> histories;
|
private List<PortScanHistory> histories;
|
||||||
|
|
||||||
public List<PortScanHistory> getHistories() {
|
public List<PortScanHistory> getHistories() {
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class DiscoveryPortController {
|
||||||
hostScanHistories.add(hostScanHistory);
|
hostScanHistories.add(hostScanHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
z.setHostScanHistories(hostScanHistories);
|
z.setHistories(hostScanHistories);
|
||||||
|
|
||||||
List<DiscoveryHost> hl = new ArrayList<>();
|
List<DiscoveryHost> hl = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class ServiceScanHistory {
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
@Column(nullable = false, insertable = false, updatable = false)
|
@Column(nullable = false, updatable = false)
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date createDate;
|
private Date createDate;
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ public class ServiceScanHistory {
|
||||||
this.serviceName = serviceName;
|
this.serviceName = serviceName;
|
||||||
this.direction = direction;
|
this.direction = direction;
|
||||||
this.packet = packet;
|
this.packet = packet;
|
||||||
|
this.createDate = createAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
|
|
|
@ -47,6 +47,22 @@ public class DiscoveryService {
|
||||||
this.serviceName = serviceName;
|
this.serviceName = serviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PortType getPortType() {
|
||||||
|
return portType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPortType(PortType portType) {
|
||||||
|
this.portType = portType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServiceName() {
|
||||||
|
return serviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServiceName(String serviceName) {
|
||||||
|
this.serviceName = serviceName;
|
||||||
|
}
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,8 @@ public class DiscoveryZone {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void mappingChildren() {
|
public void mappingChildren(DiscoveryHistory history) {
|
||||||
|
this.setDiscovery(history);
|
||||||
List<HostScanHistory> hostScanHistories = this.getHistories();
|
List<HostScanHistory> hostScanHistories = this.getHistories();
|
||||||
if (hostScanHistories != null) {
|
if (hostScanHistories != null) {
|
||||||
for (int i =0 ; i < hostScanHistories.size() ; ++i) {
|
for (int i =0 ; i < hostScanHistories.size() ; ++i) {
|
||||||
|
|
|
@ -16,7 +16,6 @@ import com.loafle.bridge.discoveryzone.ResultType;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -100,7 +99,7 @@ public class DiscoveryHistoryRepositoryTest {
|
||||||
hostScanHistories.add(hostScanHistory);
|
hostScanHistories.add(hostScanHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
zone.setHostScanHistories(hostScanHistories);
|
zone.setHistories(hostScanHistories);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user