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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.List;
|
|||
public class CentralTargetDiscoveryService implements TargetDiscoveryService{
|
||||
|
||||
@Autowired
|
||||
private CentralTargetService targetService;
|
||||
private TargetService targetService;
|
||||
|
||||
@Autowired
|
||||
private CentralInfraMachineService infraMachineService;
|
||||
|
|
|
@ -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,12 +34,16 @@ 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));
|
||||
}
|
||||
|
||||
public Target modify(Target target) throws OverflowException {
|
||||
return this.targetDAO.save(target);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Target regist(Target target) throws OverflowException {
|
||||
public Target regist(Target target) throws OverflowException {
|
||||
return this.targetDAO.save(target);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user