targetservice fix
This commit is contained in:
parent
dea99696c4
commit
1870cb5d47
|
@ -45,6 +45,11 @@ public class CentralProbeService implements ProbeService {
|
||||||
return this.probeDAO.save(probe);
|
return this.probeDAO.save(probe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean remove(long id) throws OverflowException {
|
||||||
|
this.probeDAO.delete(id);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public Probe increaseTargetCount(Probe probe) {
|
public Probe increaseTargetCount(Probe probe) {
|
||||||
Probe p = this.probeDAO.findOne(probe.getId());
|
Probe p = this.probeDAO.findOne(probe.getId());
|
||||||
p.setTargetCount(p.getTargetCount() + 1);
|
p.setTargetCount(p.getTargetCount() + 1);
|
||||||
|
@ -59,4 +64,5 @@ public class CentralProbeService implements ProbeService {
|
||||||
}
|
}
|
||||||
return this.probeDAO.save(p);
|
return this.probeDAO.save(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.probe.ProbeService;
|
||||||
import com.loafle.overflow.service.central.sensor.SensorItemService;
|
import com.loafle.overflow.service.central.sensor.SensorItemService;
|
||||||
import com.loafle.overflow.service.central.sensor.SensorService;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
@ -47,7 +48,7 @@ public class CentralSensorService implements SensorService {
|
||||||
private SensorConfigGenerator sensorConfigGenerator;
|
private SensorConfigGenerator sensorConfigGenerator;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CentralTargetService targetService;
|
private TargetService targetService;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Sensor regist(Sensor sensor) throws OverflowException {
|
public Sensor regist(Sensor sensor) throws OverflowException {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.List;
|
||||||
public class CentralTargetDiscoveryService implements TargetDiscoveryService{
|
public class CentralTargetDiscoveryService implements TargetDiscoveryService{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CentralTargetService targetService;
|
private TargetService targetService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CentralInfraMachineService infraMachineService;
|
private CentralInfraMachineService infraMachineService;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.loafle.overflow.central.module.target.service;
|
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.probe.service.CentralProbeService;
|
||||||
import com.loafle.overflow.central.module.target.dao.TargetDAO;
|
import com.loafle.overflow.central.module.target.dao.TargetDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by insanity on 17. 6. 28.
|
* Created by insanity on 17. 6. 28.
|
||||||
|
@ -23,7 +22,6 @@ public class CentralTargetService implements TargetService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CentralProbeService probeService;
|
private CentralProbeService probeService;
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Target regist(Target target, Probe probe) throws OverflowException {
|
public Target regist(Target target, Probe probe) throws OverflowException {
|
||||||
this.probeService.increaseTargetCount(probe);
|
this.probeService.increaseTargetCount(probe);
|
||||||
|
@ -40,6 +38,10 @@ public class CentralTargetService implements TargetService {
|
||||||
return this.targetDAO.findOne(Long.valueOf(id));
|
return this.targetDAO.findOne(Long.valueOf(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Target modify(Target target) throws OverflowException {
|
||||||
|
return this.targetDAO.save(target);
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Target regist(Target target) throws OverflowException {
|
public Target regist(Target target) throws OverflowException {
|
||||||
return this.targetDAO.save(target);
|
return this.targetDAO.save(target);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user