This commit is contained in:
insanity 2018-06-20 19:34:26 +09:00
parent d1d9f96a48
commit 343b2f1f58
5 changed files with 17 additions and 8 deletions

View File

@ -50,7 +50,7 @@
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId>
<version>1.0.87-SNAPSHOT</version>
<version>1.0.88-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -22,4 +22,6 @@ public interface InfraDAO extends JpaRepository<Infra, Long> {
Page<Infra> findAllByProbeIdIn(List<Long> probeIds, Pageable pageable);
Page<Infra> findAllByProbeDomainId(Long probeDomainId, Pageable pageable);
List<Infra> findAllByMetaInfraTypeKeyAndProbeId(String metaInfraTypeKey, Long probeId);
}

View File

@ -153,12 +153,13 @@ public class CentralInfraService implements InfraService {
InfraHostIP eInfraHostIP = this.infraHostIPService.readByInfraHostInfraZoneIDAndMetaIPTypeKeyAndAddress(
infraZone.getId(), infraHostIP.getMetaIPType().getKey(), host.getAddress());
if (null != eInfraHostIP) {
return eInfraHostIP.getInfraHost();
throw new OverflowException(String.format("IP[%s(%s)] of Zone[%s] is exist already", host.getAddress(),
infraHostIP.getMetaIPType().getName(), infraZone.getNetwork()));
}
InfraHost infraHost = new InfraHost();
infraHost.setMetaInfraType(MetaInfraType.Enum.HOST.to());
infraHost.setProbe(probe);
infraZone.setMetaInfraType(MetaInfraType.Enum.HOST.to());
infraZone.setProbe(probe);
infraHost.setInfraZone(infraZone);
infraHost.setMetaTargetHostType(MetaTargetHostType.Enum.UNKNOWN.to());
@ -247,8 +248,6 @@ public class CentralInfraService implements InfraService {
com.loafle.overflow.model.infra.InfraService infraService = new com.loafle.overflow.model.infra.InfraService();
infraService.setInfraHostPort(infraHostPort);
infraService.setMetaCryptoType(metaCryptoType);
infraService.setMetaInfraType(MetaInfraType.Enum.SERVICE.to());
infraService.setProbe(probe);
return this.infraServiceDAO.save(infraService);
}
@ -355,6 +354,12 @@ public class CentralInfraService implements InfraService {
return this.infraDAO.findAllByProbeDomainId(domainID);
}
@Override
public List<Infra> readAllByMetaInfraTypeKeyAndProbeID(String metaInfraTypeKey, Long probeID)
throws OverflowException {
return this.infraDAO.findAllByMetaInfraTypeKeyAndProbeId(metaInfraTypeKey, probeID);
}
public List<InfraZone> readAllInfraZoneByProbeDomainID(Long probeDomainID) throws OverflowException {
return null;
}
@ -367,4 +372,5 @@ public class CentralInfraService implements InfraService {
throws OverflowException {
return this.infraServiceDAO.findAllByInfraHostPortId(infraHostPortID);
}
}

View File

@ -2,7 +2,6 @@ package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.dao.MetaTargetTypeDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.meta.MetaInfraType;
import com.loafle.overflow.model.meta.MetaTargetType;
import com.loafle.overflow.service.central.meta.MetaTargetTypeService;

View File

@ -7,6 +7,8 @@ import com.loafle.overflow.central.module.probe.service.CentralProbeService;
import com.loafle.overflow.central.module.target.dao.TargetDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.core.model.PageParams;
import com.loafle.overflow.model.infra.Infra;
import com.loafle.overflow.model.meta.MetaInfraType;
import com.loafle.overflow.model.probe.Probe;
import com.loafle.overflow.model.target.Target;
import com.loafle.overflow.service.central.target.TargetService;