test
This commit is contained in:
parent
cece514174
commit
d4940105ff
|
@ -82,20 +82,21 @@ public class CentralTargetService implements TargetService {
|
||||||
return this.targetDAO.save(t);
|
return this.targetDAO.save(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Target readExistHostTarget(Long probeId, String ip) throws OverflowException {
|
||||||
public Target readExistHostTarget(Long probeId, String ip) throws OverflowException {
|
|
||||||
InfraHost infraHost = this.infraHostService.readByProbeIdAndIpv4(probeId, ip);
|
InfraHost infraHost = this.infraHostService.readByProbeIdAndIpv4(probeId, ip);
|
||||||
if (null == infraHost) return null;
|
if (null == infraHost)
|
||||||
|
return null;
|
||||||
return this.targetDAO.findByInfraId(infraHost.getId());
|
return this.targetDAO.findByInfraId(infraHost.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Target readExistServiceTarget(Long hostId, int portNumber, String portType) throws OverflowException {
|
public Target readExistServiceTarget(Long hostId, int portNumber, String portType) throws OverflowException {
|
||||||
InfraService infraService = this.infraServiceService.readByInfraHostIDAndPortAndPortType(hostId, portNumber, portType);
|
InfraService infraService = this.infraServiceService.readByInfraHostIDAndPortAndPortType(hostId, portNumber,
|
||||||
if (null == infraService) return null;
|
portType);
|
||||||
|
if (null == infraService)
|
||||||
|
return null;
|
||||||
return this.targetDAO.findByInfraId(infraService.getId());
|
return this.targetDAO.findByInfraId(infraService.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
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 {
|
||||||
|
@ -113,7 +114,7 @@ public class CentralTargetService implements TargetService {
|
||||||
InfraHost infraHost = this.registInfraHostByDiscoveredHost(host, probeId);
|
InfraHost infraHost = this.registInfraHostByDiscoveredHost(host, probeId);
|
||||||
Target target = new Target();
|
Target target = new Target();
|
||||||
target.setInfra(infraHost);
|
target.setInfra(infraHost);
|
||||||
String displayName = (host.getIpv6() == null || host.getIpv6().trim().isEmpty() ? host.getIpv6() : host.getIpv4();
|
String displayName = (host.getIpv6() == null || host.getIpv6().trim().isEmpty()) ? host.getIpv6() : host.getIpv4();
|
||||||
target.setDisplayName(displayName);
|
target.setDisplayName(displayName);
|
||||||
targets.add(this.targetDAO.save(target));
|
targets.add(this.targetDAO.save(target));
|
||||||
}
|
}
|
||||||
|
@ -135,7 +136,7 @@ public class CentralTargetService implements TargetService {
|
||||||
infraHost = this.registInfraHostByDiscoveredHost(host, probeId);
|
infraHost = this.registInfraHostByDiscoveredHost(host, probeId);
|
||||||
infraService = this.registInfraServiceByDiscoveredService(infraHost, service, probeId);
|
infraService = this.registInfraServiceByDiscoveredService(infraHost, service, probeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Target target = new Target();
|
Target target = new Target();
|
||||||
target.setInfra(infraService);
|
target.setInfra(infraService);
|
||||||
String displayName = service.getServiceName();
|
String displayName = service.getServiceName();
|
||||||
|
@ -155,7 +156,8 @@ public class CentralTargetService implements TargetService {
|
||||||
return this.infraHostService.regist(infraHost);
|
return this.infraHostService.regist(infraHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
private InfraService registInfraServiceByDiscoveredService(InfraHost infraHost, Service service, Long probeId) throws OverflowException {
|
private InfraService registInfraServiceByDiscoveredService(InfraHost infraHost, Service service, Long probeId)
|
||||||
|
throws OverflowException {
|
||||||
InfraService infraService = new InfraService();
|
InfraService infraService = new InfraService();
|
||||||
infraHost.setMetaInfraType(new MetaInfraType(7));
|
infraHost.setMetaInfraType(new MetaInfraType(7));
|
||||||
infraService.setInfraHost(infraHost);
|
infraService.setInfraHost(infraHost);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user