Sensor modify

This commit is contained in:
insanity 2018-06-28 20:05:40 +09:00
parent 6a3cb4af63
commit ed72bf084b
2 changed files with 13 additions and 2 deletions

View File

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

View File

@ -57,8 +57,15 @@ public class CentralSensorService implements SensorService {
@Transactional
@Override
public Sensor modify(Long sensorID, List<MetaDisplayItemMapping> 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