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