targetservice fix

This commit is contained in:
insanity 2018-04-30 19:44:15 +09:00
parent dea99696c4
commit 1870cb5d47
4 changed files with 20 additions and 11 deletions

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -25,7 +25,7 @@ import java.util.List;
public class CentralTargetDiscoveryService implements TargetDiscoveryService{
@Autowired
private CentralTargetService targetService;
private TargetService targetService;
@Autowired
private CentralInfraMachineService infraMachineService;

View File

@ -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,7 +22,6 @@ public class CentralTargetService implements TargetService {
@Autowired
private CentralProbeService probeService;
@Transactional
public Target regist(Target target, Probe probe) throws OverflowException {
this.probeService.increaseTargetCount(probe);
@ -40,6 +38,10 @@ public class CentralTargetService implements TargetService {
return this.targetDAO.findOne(Long.valueOf(id));
}
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);