Page remove

This commit is contained in:
geek 2018-06-21 19:41:55 +09:00
parent 9b27386cc3
commit 6dd4df7ac7
6 changed files with 18 additions and 25 deletions

View File

@ -50,7 +50,7 @@
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId>
<version>1.0.90-SNAPSHOT</version>
<version>1.0.92-SNAPSHOT</version>
</dependency>
<dependency>
@ -385,4 +385,4 @@
</properties>
</profile>
</profiles>
</project>
</project>

View File

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

View File

@ -3,14 +3,12 @@ package com.loafle.overflow.central.module.infra.service;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.loafle.overflow.central.commons.utils.PageUtil;
import com.loafle.overflow.central.module.infra.dao.InfraDAO;
import com.loafle.overflow.central.module.infra.dao.InfraHostDAO;
import com.loafle.overflow.central.module.infra.dao.InfraServiceDAO;
import com.loafle.overflow.central.module.infra.dao.InfraZoneDAO;
import com.loafle.overflow.central.module.meta.service.CentralMetaCryptoTypeService;
import com.loafle.overflow.central.module.meta.service.CentralMetaTargetServiceTypeService;
import com.loafle.overflow.core.model.PageParams;
import com.loafle.overflow.model.probe.Probe;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.discovery.Host;
@ -31,7 +29,6 @@ import com.loafle.overflow.service.central.infra.InfraService;
import com.loafle.overflow.service.central.probe.ProbeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -204,13 +201,13 @@ public class CentralInfraService implements InfraService {
String.format("MetaCryptoTypeKey[%s] is not valid", service.getMetaCryptoType().getKey()));
}
if (null == service.getName()) {
if (null == service.getKey()) {
throw new OverflowException("Name of service is not valid");
}
MetaTargetServiceType metaTargetServiceType = this.metaTargetServiceTypeService.readByKey(service.getName());
MetaTargetServiceType metaTargetServiceType = this.metaTargetServiceTypeService.readByKey(service.getKey());
if (null == metaTargetServiceType) {
throw new OverflowException(String.format("MetaTargetServiceType[%s] is not valid", service.getName()));
throw new OverflowException(String.format("MetaTargetServiceType[%s] is not valid", service.getKey()));
}
Probe probe = this.probeService.read(probeID);
@ -382,13 +379,13 @@ public class CentralInfraService implements InfraService {
}
@Override
public Page<Infra> readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException {
return this.infraDAO.findAllByProbeId(probeID, PageUtil.getPageRequest(pageParams));
public List<Infra> readAllByProbeID(Long probeID) throws OverflowException {
return this.infraDAO.findAllByProbeId(probeID);
}
@Override
public Page<Infra> readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException {
return this.infraDAO.findAllByProbeDomainId(domainID, PageUtil.getPageRequest(pageParams));
public List<Infra> readAllByDomainID(Long domainID) throws OverflowException {
return this.infraDAO.findAllByProbeDomainId(domainID);
}
@Override
@ -420,4 +417,4 @@ public class CentralInfraService implements InfraService {
return this.infraServiceDAO.findAllByInfraHostPortId(infraHostPortID);
}
}
}

View File

@ -1,16 +1,16 @@
package com.loafle.overflow.central.module.target.dao;
import com.loafle.overflow.model.target.Target;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by root on 17. 6. 5.
*/
@Repository
public interface TargetDAO extends JpaRepository<Target, Long> {
Target findByInfraId(Long infraId);
Page<Target> findAllByInfraProbeId(Long probeId, Pageable pageRequest);
List<Target> findAllByInfraProbeId(Long probeId);
}

View File

@ -63,8 +63,8 @@ public class CentralTargetService implements TargetService {
return this.targetDAO.save(t);
}
public Page<Target> readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException {
return this.targetDAO.findAllByInfraProbeId(probeID, PageUtil.getPageRequest(pageParams));
public List<Target> readAllByProbeID(Long probeID) throws OverflowException {
return this.targetDAO.findAllByInfraProbeId(probeID);
}
@Transactional

View File

@ -81,7 +81,7 @@ public class CentralInfraServiceTest {
service.setMetaCryptoType(cryptoType);
service.setPort(port);
service.setDiscoveredDate(new Date());
service.setName("Unknown");
service.setKey("Unknown");
services.add(service);
}
port.setServiceList(services);