model update

This commit is contained in:
jackdaw@loafle.com 2017-01-18 17:01:59 +09:00
parent 086df80a6d
commit c1db829b2c
5 changed files with 90 additions and 13 deletions

View File

@ -1,9 +1,11 @@
package com.loafle.bridge.discoveryhistory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loafle.bridge.discoveryzone.DiscoveryZone;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.File;
import java.util.List;
/**
@ -23,6 +25,8 @@ public class DiscoveriyHistoryController {
zone.mappingChildren(history);
}
discoveryHistoryRepository.save(history);
// ObjectMapper mapper = new ObjectMapper();
// mapper.writeValue(new File("/root/jsonData"),history);
}

View File

@ -24,6 +24,39 @@ public class DiscoveryHost {
@Column(name = "MAC",nullable = false)
private long mac;
@Column(nullable = true)
private String name;
@Column(nullable = false)
private int firstScanRange;
@Column(nullable = false)
private int lastScanRange;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getFirstScanRange() {
return firstScanRange;
}
public void setFirstScanRange(int firstScanRange) {
this.firstScanRange = firstScanRange;
}
public int getLastScanRange() {
return lastScanRange;
}
public void setLastScanRange(int lastScanRange) {
this.lastScanRange = lastScanRange;
}
@ManyToOne
@JoinColumn(name = "ZONE_ID", nullable = false)
@JsonIgnore

View File

@ -62,7 +62,6 @@ public class DiscoveryPortController {
DiscoveryZone z = new DiscoveryZone();
String cidr = "827452358680";
String ip = "3232235983";
z.setCidr(Long.parseLong(cidr));
z.setIp(Long.parseLong(ip));
z.setDiscovery(d);

View File

@ -23,7 +23,59 @@ public class DiscoveryZone {
private long ip;
@Column(nullable=false)
private long cidr;
private short mask;
@Column(nullable=false)
private String iface;
@Column(nullable=false)
private long mac;
@Column(nullable=false)
private long firstScanRange;
@Column(nullable=false)
private long lastScanRange;
public short getMask() {
return mask;
}
public void setMask(short mask) {
this.mask = mask;
}
public String getIface() {
return iface;
}
public void setIface(String iface) {
this.iface = iface;
}
public long getMac() {
return mac;
}
public void setMac(long mac) {
this.mac = mac;
}
public long getFirstScanRange() {
return firstScanRange;
}
public void setFirstScanRange(long firstScanRange) {
this.firstScanRange = firstScanRange;
}
public long getLastScanRange() {
return lastScanRange;
}
public void setLastScanRange(long lastScanRange) {
this.lastScanRange = lastScanRange;
}
@JoinColumn(nullable=false)
@OneToOne
@ -84,14 +136,6 @@ public class DiscoveryZone {
this.ip = ip;
}
public long getCidr() {
return cidr;
}
public void setCidr(long cidr) {
this.cidr = cidr;
}
public DiscoveryHistory getDiscovery() {
return discovery;
}

View File

@ -33,7 +33,6 @@ public class DiscoveryZoneRepositoryTest {
String ip = "3232235983";
discoveryZone.setCidr(Long.parseLong(cidr));
discoveryZone.setIp(Long.parseLong(ip));
discoveryZoneRepository.save(discoveryZone);
@ -54,7 +53,6 @@ public class DiscoveryZoneRepositoryTest {
String ip = "3232235983";
discoveryZone.setCidr(Long.parseLong(cidr));
discoveryZone.setIp(Long.parseLong(ip));
discoveryZoneRepository.save(discoveryZone);
@ -72,7 +70,6 @@ public class DiscoveryZoneRepositoryTest {
HostScanHistory hostScanHistory = null;
System.out.println("!!!!!!!!!!!!!!!!!!!!!= " + zone.getCidr());
List<HostScanHistory> hostScanHistories = new ArrayList<HostScanHistory>();