diff --git a/pom.xml b/pom.xml index b5e092a..6da4c4b 100644 --- a/pom.xml +++ b/pom.xml @@ -24,12 +24,13 @@ 2.5.6 3.5.1 5.0.6.RELEASE + 2.0.7.RELEASE 2.0.7.RELEASE 2.0.7.RELEASE 5.0.5.RELEASE 1.9.13 - 5.2.10.Final + 5.3.1.Final 1.4.7 1.6.0 1.7 @@ -49,7 +50,7 @@ com.loafle.overflow commons-java - 1.0.9-SNAPSHOT + 1.0.10-SNAPSHOT @@ -81,6 +82,13 @@ + + + org.springframework.data + spring-data-commons + ${spring.data.jpa.version} + + org.springframework.data spring-data-jpa diff --git a/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java b/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java index dd78dde..caf5567 100644 --- a/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java +++ b/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java @@ -48,7 +48,7 @@ public class EmailAuthService { // "http://127.0.0.1:4200/auth/"; public EmailAuth read(Long id) { - return this.emailAuthDAO.findOne(id); + return this.emailAuthDAO.findById(id).get(); } public EmailAuth readBySignupAuthKey(String token) throws OverflowException { diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraHostService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraHostService.java index 818c2bd..ee38c48 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraHostService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraHostService.java @@ -22,7 +22,7 @@ public class CentralInfraHostService implements InfraHostService { } public InfraHost read(Long id) throws OverflowException { - return this.infraHostDAO.findOne(id); + return this.infraHostDAO.findById(id).get(); } public InfraHost readByProbeIdAndIpv4(Long probeId, String ip) throws OverflowException { diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraMachineService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraMachineService.java index 009d851..e230a1f 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraMachineService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraMachineService.java @@ -20,6 +20,6 @@ public class CentralInfraMachineService implements InfraMachineService { } public InfraMachine read(Long id) { - return this.infraMachineDAO.findOne(id); + return this.infraMachineDAO.findById(id).get(); } } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSApplicationService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSApplicationService.java index b36e248..0d2f3ad 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSApplicationService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSApplicationService.java @@ -21,6 +21,6 @@ public class CentralInfraOSApplicationService implements InfraOSApplicationServi } public InfraOSApplication read(Long id) throws OverflowException { - return this.infraOSApplicationDAO.findOne(id); + return this.infraOSApplicationDAO.findById(id).get(); } } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSDaemonService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSDaemonService.java index 04f924f..018b533 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSDaemonService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSDaemonService.java @@ -21,6 +21,6 @@ public class CentralInfraOSDaemonService implements InfraOSDaemonService { } public InfraOSDaemon read(Long id) throws OverflowException { - return this.infraOSDaemonDAO.findOne(id); + return this.infraOSDaemonDAO.findById(id).get(); } } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSPortService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSPortService.java index bd74bbf..ddd0243 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSPortService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSPortService.java @@ -21,7 +21,7 @@ public class CentralInfraOSPortService implements InfraOSPortService { } public InfraOSPort read(Long id) throws OverflowException { - return this.infraOSPortDAO.findOne(id); + return this.infraOSPortDAO.findById(id).get(); } public InfraOSPort readByInfraOSIDAndPortAndPortType(Long infraOSID, Integer port, String portType) diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSService.java index 613f95c..d19a078 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraOSService.java @@ -21,6 +21,6 @@ public class CentralInfraOSService implements InfraOSService { } public InfraOS read(Long id) throws OverflowException { - return this.infraOSDAO.findOne(id); + return this.infraOSDAO.findById(id).get(); } } 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 80a555e..0f7b98b 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 @@ -38,7 +38,7 @@ public class CentralInfraService implements InfraService { } public Infra read(Long id) throws OverflowException { - Infra infra = this.infraDAO.findOne(id); + Infra infra = this.infraDAO.findById(id).get(); return infra; } diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceService.java index 895758c..6abc79b 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraServiceService.java @@ -21,7 +21,7 @@ public class CentralInfraServiceService implements InfraServiceService { } public InfraService read(Long id) throws OverflowException { - return this.infraServiceDAO.findOne(id); + return this.infraServiceDAO.findById(id).get(); } public InfraService readByInfraHostIDAndPortAndPortType(Long infraHostID, int port, String portType) diff --git a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java index 4230a23..87f9639 100644 --- a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java +++ b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java @@ -245,7 +245,7 @@ public class CentralMemberService implements MemberService { throw new OverflowException("SignInIdNotExistException()", new Throwable()); } - Member resMember = this.memberDAO.findOne(memberId); + Member resMember = this.memberDAO.findById(memberId).get(); return resMember; } diff --git a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberTotpService.java b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberTotpService.java index 342edf7..179e96b 100644 --- a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberTotpService.java +++ b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberTotpService.java @@ -51,11 +51,11 @@ public class CentralMemberTotpService implements MemberTotpService { } public void remove(Long id) throws OverflowException { - this.totpDAO.delete(id); + this.totpDAO.deleteById(id); } public MemberTotp read(Long id) throws OverflowException { - return this.totpDAO.findOne(id); + return this.totpDAO.findById(id).get(); } public boolean checkCodeForMember(String memberEmail, String code) throws OverflowException { diff --git a/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaHistoryTypeService.java b/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaHistoryTypeService.java index 799eb5a..bde2393 100644 --- a/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaHistoryTypeService.java +++ b/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaHistoryTypeService.java @@ -28,6 +28,6 @@ public class CentralMetaHistoryTypeService implements MetaHistoryTypeService { } public List registAll(List metaHistoryTypes) throws OverflowException { - return (List)this.hisotyTypeDAO.save(metaHistoryTypes); + return (List)this.hisotyTypeDAO.saveAll(metaHistoryTypes); } } diff --git a/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorDisplayItemService.java b/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorDisplayItemService.java index 507c55f..eaa754d 100644 --- a/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorDisplayItemService.java +++ b/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorDisplayItemService.java @@ -23,7 +23,7 @@ public class CentralMetaSensorDisplayItemService implements MetaSensorDisplayIte } public MetaSensorDisplayItem read(Long id) throws OverflowException { - return this.displayItemDAO.findOne(id); + return this.displayItemDAO.findById(id).get(); } public List readAllByCrawlerID(Short metaCrawlerID) throws OverflowException { diff --git a/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorItemTypeService.java b/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorItemTypeService.java index 73b2725..069f0e0 100644 --- a/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorItemTypeService.java +++ b/src/main/java/com/loafle/overflow/central/module/meta/service/CentralMetaSensorItemTypeService.java @@ -28,6 +28,6 @@ public class CentralMetaSensorItemTypeService implements MetaSensorItemTypeServi } public List registAll(List list) throws OverflowException { - return (List)this.sensorItemTypeDAO.save(list); + return (List)this.sensorItemTypeDAO.saveAll(list); } } diff --git a/src/main/java/com/loafle/overflow/central/module/noauthprobe/service/CentralNoAuthProbeService.java b/src/main/java/com/loafle/overflow/central/module/noauthprobe/service/CentralNoAuthProbeService.java index 42d45c9..013b83c 100644 --- a/src/main/java/com/loafle/overflow/central/module/noauthprobe/service/CentralNoAuthProbeService.java +++ b/src/main/java/com/loafle/overflow/central/module/noauthprobe/service/CentralNoAuthProbeService.java @@ -98,13 +98,13 @@ public class CentralNoAuthProbeService implements NoAuthProbeService { } public NoAuthProbe read(Long id) { - return this.noAuthProbeDAO.findOne(id); + return this.noAuthProbeDAO.findById(id).get(); } @WebappAPI @Transactional public List acceptNoAuthProbe(Long noAuthProbeID) throws OverflowException { - NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findOne(noAuthProbeID); + NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findById(noAuthProbeID).get(); NoAuthProbeDescription noAuthProbeDescription = null; try { @@ -205,7 +205,7 @@ public class CentralNoAuthProbeService implements NoAuthProbeService { @WebappAPI public List denyNoauthProbe(Long noAuthProbeID) throws OverflowException { - NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findOne(noAuthProbeID); + NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findById(noAuthProbeID).get(); noAuthProbe.setMetaNoAuthProbeStatus(new MetaNoAuthProbeStatus((short) 2)); this.noAuthProbeDAO.save(noAuthProbe); diff --git a/src/main/java/com/loafle/overflow/central/module/notification/service/CentralNotificationService.java b/src/main/java/com/loafle/overflow/central/module/notification/service/CentralNotificationService.java index 8e2d346..0830ea0 100644 --- a/src/main/java/com/loafle/overflow/central/module/notification/service/CentralNotificationService.java +++ b/src/main/java/com/loafle/overflow/central/module/notification/service/CentralNotificationService.java @@ -48,7 +48,7 @@ public class CentralNotificationService implements NotificationService { for (Notification n : list) { n.setConfirmDate(new Date()); } - this.notificationDAO.save(list); + this.notificationDAO.saveAll(list); return this.readAllByMemberEmail(memberEmail, pageParams); } @@ -58,12 +58,12 @@ public class CentralNotificationService implements NotificationService { for (Notification n : list) { n.setConfirmDate(null); } - this.notificationDAO.save(list); + this.notificationDAO.saveAll(list); return this.readAllByMemberEmail(memberEmail, pageParams); } public Notification markAsRead(Long notificationID) throws OverflowException { - Notification notification = this.notificationDAO.findOne(notificationID); + Notification notification = this.notificationDAO.findById(notificationID).get(); notification.setConfirmDate(new Date()); return this.notificationDAO.save(notification); } diff --git a/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeHostService.java b/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeHostService.java index d1dec5b..c00681c 100644 --- a/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeHostService.java +++ b/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeHostService.java @@ -20,7 +20,7 @@ public class CentralProbeHostService implements ProbeHostService { private ProbeHostDAO probeHostDAO; public ProbeHost read(Long id) throws OverflowException { - return this.probeHostDAO.findOne(id); + return this.probeHostDAO.findById(id).get(); } public ProbeHost readByProbeID(Long probeID) throws OverflowException { diff --git a/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeService.java b/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeService.java index 295453c..8c8b3bb 100644 --- a/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeService.java +++ b/src/main/java/com/loafle/overflow/central/module/probe/service/CentralProbeService.java @@ -28,7 +28,7 @@ public class CentralProbeService implements ProbeService { } public List regist(List probes) throws OverflowException { - return (List)this.probeDAO.save(probes); + return (List)this.probeDAO.saveAll(probes); } public List readAllByDomainID(Long domainID) throws OverflowException { @@ -37,7 +37,7 @@ public class CentralProbeService implements ProbeService { } public Probe read(Long id) throws OverflowException { - return this.probeDAO.findOne(id); + return this.probeDAO.findById(id).get(); } public Probe readByProbeKey(String probeKey) throws OverflowException { @@ -49,18 +49,18 @@ public class CentralProbeService implements ProbeService { } public boolean remove(Long id) throws OverflowException { - this.probeDAO.delete(id); + this.probeDAO.deleteById(id); return true; } public Probe increaseTargetCount(Probe probe) { - Probe p = this.probeDAO.findOne(probe.getId()); + Probe p = this.probeDAO.findById(probe.getId()).get(); p.setTargetCount(p.getTargetCount() + 1); return this.probeDAO.save(p); } public Probe decreaseTargetCount(Probe probe) { - Probe p = this.probeDAO.findOne(probe.getId()); + Probe p = this.probeDAO.findById(probe.getId()).get(); int count = p.getTargetCount(); if (count > 0) { p.setTargetCount(count - 1); @@ -69,7 +69,7 @@ public class CentralProbeService implements ProbeService { } public Probe modifyDisplayName(Long probeId, String displayName) { - Probe probe = this.probeDAO.findOne(probeId); + Probe probe = this.probeDAO.findById(probeId).get(); probe.setDisplayName(displayName); return this.probeDAO.save(probe); } diff --git a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorItemService.java b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorItemService.java index 2de6d2c..0dca043 100644 --- a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorItemService.java +++ b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorItemService.java @@ -29,7 +29,7 @@ public class CentralSensorItemService implements SensorItemService { @Transactional public SensorItem regist(SensorItem sensorItem) throws OverflowException { - Sensor s = sensorDAO.findOne(sensorItem.getSensor().getId()); + Sensor s = sensorDAO.findById(sensorItem.getSensor().getId()).get(); s.setItemCount((short) (s.getItemCount() + 1)); this.sensorDAO.save(s); return this.sensorItemDAO.save(sensorItem); @@ -37,15 +37,15 @@ public class CentralSensorItemService implements SensorItemService { @Transactional public boolean registAll(List sensorItemList) throws OverflowException { - Sensor s = sensorDAO.findOne(sensorItemList.get(0).getSensor().getId()); + Sensor s = sensorDAO.findById(sensorItemList.get(0).getSensor().getId()).get(); s.setItemCount((short) sensorItemList.size()); this.sensorDAO.save(s); - this.sensorItemDAO.save(sensorItemList); + this.sensorItemDAO.saveAll(sensorItemList); return true; } public SensorItem read(String id) throws OverflowException { - return this.sensorItemDAO.findOne(Long.valueOf(id)); + return this.sensorItemDAO.findById(Long.valueOf(id)).get(); } public Page readAllBySensorID(Long sensorID, PageParams pageParams) throws OverflowException { diff --git a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java index 55c57d1..85bd2d8 100644 --- a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java +++ b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java @@ -86,25 +86,25 @@ public class CentralSensorService implements SensorService { } public Sensor read(Long id) throws OverflowException { - return this.sensorDAO.findOne(Long.valueOf(id)); + return this.sensorDAO.findById(Long.valueOf(id)).get(); } @Transactional public void remove(Long sensorID) throws OverflowException { - Sensor sensor = this.sensorDAO.findOne(sensorID); + Sensor sensor = this.sensorDAO.findById(sensorID).get(); this.targetService.decreaseSensorCount(sensor.getTarget()); this.sensorDAO.delete(sensor); } public Sensor start(Long sensorID) throws OverflowException { - Sensor sensor = this.sensorDAO.findOne(sensorID); + Sensor sensor = this.sensorDAO.findById(sensorID).get(); MetaSensorStatus status = new MetaSensorStatus((short) 1); sensor.setMetaSensorStatus(status); return this.sensorDAO.save(sensor); } public Sensor stop(Long sensorID) throws OverflowException { - Sensor sensor = this.sensorDAO.findOne(sensorID); + Sensor sensor = this.sensorDAO.findById(sensorID).get(); MetaSensorStatus status = new MetaSensorStatus((short) 2); sensor.setMetaSensorStatus(status); return this.sensorDAO.save(sensor); 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 fd62cb3..b7ff1c1 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 @@ -50,7 +50,7 @@ public class CentralTargetService implements TargetService { } public Target read(String id) throws OverflowException { - return this.targetDAO.findOne(Long.valueOf(id)); + return this.targetDAO.findById(Long.valueOf(id)).get(); } public Target modify(Target target) throws OverflowException { @@ -68,13 +68,13 @@ public class CentralTargetService implements TargetService { } public Target increaseSensorCount(Target target) throws OverflowException { - Target t = this.targetDAO.findOne(target.getId()); + Target t = this.targetDAO.findById(target.getId()).get(); t.setSensorCount(t.getSensorCount() + 1); return this.targetDAO.save(t); } public Target decreaseSensorCount(Target target) throws OverflowException { - Target t = this.targetDAO.findOne(target.getId()); + Target t = this.targetDAO.findById(target.getId()).get(); int count = t.getSensorCount(); if (t.getSensorCount() > 0) { t.setSensorCount(count - 1); diff --git a/src/main/java/com/loafle/overflow/central/spring/RedisConfiguration.java b/src/main/java/com/loafle/overflow/central/spring/RedisConfiguration.java index b08a996..dea86bf 100644 --- a/src/main/java/com/loafle/overflow/central/spring/RedisConfiguration.java +++ b/src/main/java/com/loafle/overflow/central/spring/RedisConfiguration.java @@ -5,11 +5,15 @@ import com.loafle.overflow.central.redis.service.RedisMessagePublisher; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisStandaloneConfiguration; +import org.springframework.data.redis.connection.jedis.JedisClientConfiguration; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; +import org.springframework.data.redis.connection.jedis.JedisClientConfiguration.JedisClientConfigurationBuilder; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.listener.ChannelTopic; import org.springframework.data.redis.serializer.GenericToStringSerializer; +import java.time.Duration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,9 +29,22 @@ public class RedisConfiguration { @Bean JedisConnectionFactory jedisConnectionFactory() { - JedisConnectionFactory jedisConFactory = new JedisConnectionFactory(); - jedisConFactory.setHostName(host); - jedisConFactory.setPort(port); + RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(); + redisStandaloneConfiguration.setHostName(host); + redisStandaloneConfiguration.setPort(port); + // redisStandaloneConfiguration.setDatabase(0); + // redisStandaloneConfiguration.setPassword(RedisPassword.of("password")); + + JedisClientConfigurationBuilder jedisClientConfiguration = JedisClientConfiguration.builder(); + jedisClientConfiguration.connectTimeout(Duration.ofSeconds(60));// 60s connection timeout + + JedisConnectionFactory jedisConFactory = new JedisConnectionFactory(redisStandaloneConfiguration, + jedisClientConfiguration.build()); + + + // JedisConnectionFactory jedisConFactory = new JedisConnectionFactory(); + // jedisConFactory.setHostName(host); + // jedisConFactory.setPort(port); return jedisConFactory; }