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 e65d118..e5d4c6f 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 @@ -45,6 +45,11 @@ public class CentralProbeService implements ProbeService { return this.probeDAO.save(probe); } + public boolean remove(long id) throws OverflowException { + this.probeDAO.delete(id); + return true; + } + public Probe increaseTargetCount(Probe probe) { Probe p = this.probeDAO.findOne(probe.getId()); p.setTargetCount(p.getTargetCount() + 1); @@ -59,4 +64,5 @@ public class CentralProbeService implements ProbeService { } return this.probeDAO.save(p); } + } 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 b3a746a..577b4b6 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 @@ -17,6 +17,7 @@ import com.loafle.overflow.service.central.infra.InfraService; import com.loafle.overflow.service.central.probe.ProbeService; import com.loafle.overflow.service.central.sensor.SensorItemService; import com.loafle.overflow.service.central.sensor.SensorService; +import com.loafle.overflow.service.central.target.TargetService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -47,7 +48,7 @@ public class CentralSensorService implements SensorService { private SensorConfigGenerator sensorConfigGenerator; @Autowired - private CentralTargetService targetService; + private TargetService targetService; @Transactional public Sensor regist(Sensor sensor) throws OverflowException { diff --git a/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetDiscoveryService.java b/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetDiscoveryService.java index ff36241..20f12fd 100644 --- a/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetDiscoveryService.java +++ b/src/main/java/com/loafle/overflow/central/module/target/service/CentralTargetDiscoveryService.java @@ -25,7 +25,7 @@ import java.util.List; public class CentralTargetDiscoveryService implements TargetDiscoveryService{ @Autowired - private CentralTargetService targetService; + private TargetService targetService; @Autowired private CentralInfraMachineService infraMachineService; 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 8dc4520..954a875 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 @@ -1,7 +1,5 @@ package com.loafle.overflow.central.module.target.service; -import javax.transaction.Transactional; - 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; @@ -11,6 +9,7 @@ import com.loafle.overflow.service.central.target.TargetService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** * Created by insanity on 17. 6. 28. @@ -23,9 +22,8 @@ public class CentralTargetService implements TargetService { @Autowired private CentralProbeService probeService; - @Transactional - public Target regist(Target target, Probe probe) throws OverflowException { + public Target regist(Target target, Probe probe) throws OverflowException { this.probeService.increaseTargetCount(probe); return this.targetDAO.save(target); } @@ -36,15 +34,19 @@ public class CentralTargetService implements TargetService { this.targetDAO.delete(target); } - public Target read(String id) throws OverflowException { + public Target read(String id) throws OverflowException { return this.targetDAO.findOne(Long.valueOf(id)); } - - @Deprecated - public Target regist(Target target) throws OverflowException { + + public Target modify(Target target) throws OverflowException { return this.targetDAO.save(target); } - + + @Deprecated + public Target regist(Target target) throws OverflowException { + return this.targetDAO.save(target); + } + @Deprecated public void remove(Target target) throws OverflowException { this.targetDAO.delete(target);