bugfix for registring new and deregistring events and sensors. issue 20

Former-commit-id: 449c61f21e10c502a76828749bb48a2ef7b9afe3
This commit is contained in:
Ziver Koc 2016-02-03 17:32:02 +01:00
parent 946511aaab
commit 68707cbb35
2 changed files with 10 additions and 2 deletions

View file

@ -65,6 +65,8 @@ public class EventConfigHttpPage extends HalHttpPage {
configurator.setValues(request);
configurator.applyConfiguration();
event.save(db);
ControllerManager.getInstance().register(event);
break;
case "modify_local_event":
event = Event.getEvent(db, id);
if(event != null){
@ -77,8 +79,10 @@ public class EventConfigHttpPage extends HalHttpPage {
break;
case "remove_local_event":
event = Event.getEvent(db, id);
if(event != null)
if(event != null) {
ControllerManager.getInstance().deregister(event);
event.delete(db);
}
break;
}
}

View file

@ -67,6 +67,8 @@ public class SensorConfigHttpPage extends HalHttpPage {
configurator.setValues(request);
configurator.applyConfiguration();
sensor.save(db);
ControllerManager.getInstance().register(sensor);
break;
case "modify_local_sensor":
sensor = Sensor.getSensor(db, id);
if(sensor != null){
@ -79,8 +81,10 @@ public class SensorConfigHttpPage extends HalHttpPage {
break;
case "remove_local_sensor":
sensor = Sensor.getSensor(db, id);
if(sensor != null)
if(sensor != null) {
ControllerManager.getInstance().deregister(sensor);
sensor.delete(db);
}
break;
// External Users