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 374aacd..471e6bd 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 @@ -58,4 +58,8 @@ public class CentralSensorItemService implements SensorItemService { this.sensorItemDAO.deleteById(sensorItemID); } + public void removeAllBySensorID(Long sensorID) throws OverflowException { + this.sensorItemDAO.deleteAll(this.readAllBySensorID(sensorID)); + } + } 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 d213b59..1624ae9 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 @@ -57,8 +57,15 @@ public class CentralSensorService implements SensorService { @Transactional @Override public Sensor modify(Long sensorID, List metaDisplayItemMappings) throws OverflowException { - // FIXME : not impl - return null; + Sensor sensor = this.read(sensorID); + if (null == sensor) { + throw new OverflowException(String.format("ID[%d] of Sensor is not valid", sensorID)); + } + this.sensorItemService.readAllBySensorID(sensorID); + for (MetaDisplayItemMapping metaDisplayItemMapping : metaDisplayItemMappings) { + this.sensorItemService.regist(sensor, metaDisplayItemMapping); + } + return sensor; } @Override