From 6dd4df7ac747df92854fa83416eb4e091d8493dc Mon Sep 17 00:00:00 2001 From: geek Date: Thu, 21 Jun 2018 19:41:55 +0900 Subject: [PATCH] Page remove --- pom.xml | 4 ++-- .../central/module/infra/dao/InfraDAO.java | 8 ++------ .../infra/service/CentralInfraService.java | 19 ++++++++----------- .../central/module/target/dao/TargetDAO.java | 6 +++--- .../target/service/CentralTargetService.java | 4 ++-- .../service/CentralInfraServiceTest.java | 2 +- 6 files changed, 18 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index 4ecc6c4..408a08a 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ com.loafle.overflow commons-java - 1.0.90-SNAPSHOT + 1.0.92-SNAPSHOT @@ -385,4 +385,4 @@ - \ No newline at end of file + diff --git a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraDAO.java b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraDAO.java index 28fe119..8e38b95 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraDAO.java @@ -17,11 +17,7 @@ public interface InfraDAO extends JpaRepository { List findAllByProbeDomainId(Long probeDomainId); - Page findAllByProbeId(Long probeId, Pageable pageable); - - Page findAllByProbeIdIn(List probeIds, Pageable pageable); - - Page findAllByProbeDomainId(Long probeDomainId, Pageable pageable); + List findAllByProbeIdIn(List probeIds); List findAllByMetaInfraTypeKeyAndProbeId(String metaInfraTypeKey, Long probeId); -} \ No newline at end of file +} diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java index a647f72..0752433 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java @@ -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 readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException { - return this.infraDAO.findAllByProbeId(probeID, PageUtil.getPageRequest(pageParams)); + public List readAllByProbeID(Long probeID) throws OverflowException { + return this.infraDAO.findAllByProbeId(probeID); } @Override - public Page readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException { - return this.infraDAO.findAllByProbeDomainId(domainID, PageUtil.getPageRequest(pageParams)); + public List 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); } -} \ No newline at end of file +} diff --git a/src/main/java/com/loafle/overflow/central/module/target/dao/TargetDAO.java b/src/main/java/com/loafle/overflow/central/module/target/dao/TargetDAO.java index c59dacc..27420cf 100644 --- a/src/main/java/com/loafle/overflow/central/module/target/dao/TargetDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/target/dao/TargetDAO.java @@ -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 findByInfraId(Long infraId); - Page findAllByInfraProbeId(Long probeId, Pageable pageRequest); + List findAllByInfraProbeId(Long probeId); } diff --git a/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetService.java b/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetService.java index 084b238..9072b4f 100644 --- a/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetService.java +++ b/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetService.java @@ -63,8 +63,8 @@ public class CentralTargetService implements TargetService { return this.targetDAO.save(t); } - public Page readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException { - return this.targetDAO.findAllByInfraProbeId(probeID, PageUtil.getPageRequest(pageParams)); + public List readAllByProbeID(Long probeID) throws OverflowException { + return this.targetDAO.findAllByInfraProbeId(probeID); } @Transactional diff --git a/src/test/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceTest.java b/src/test/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceTest.java index 899412d..5e8770c 100644 --- a/src/test/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceTest.java @@ -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);