This commit is contained in:
Lucas Pleß 2012-03-30 17:00:30 +02:00
parent a5329a0bcc
commit 2c7694036d
3 changed files with 13 additions and 8 deletions

View File

@ -11,7 +11,7 @@ import java.util.Map;
public class EthersexMixerImpl implements EthersexMixer, ApplicationListener<DeviceChangedEvent> { public class EthersexMixerImpl implements EthersexMixer, ApplicationListener<DeviceChangedEvent> {
private static final Logger LOGGER = LoggerFactory.getLogger(EthersexMixerImpl.class); private static final Logger LOGGER = LoggerFactory.getLogger(EthersexMixerImpl.class);
private boolean hasDataChanged = true; // private boolean hasDataChanged = true;
@Override @Override
public final boolean updateDevice(BuntiDevice device, Map<String, Object> options) { public final boolean updateDevice(BuntiDevice device, Map<String, Object> options) {

View File

@ -19,17 +19,20 @@ public class DevicesController {
} }
@RequestMapping(value = "", method = RequestMethod.GET) @RequestMapping(value = "", method = RequestMethod.GET)
public @ResponseBody Collection<BuntiDevice> getAll() { @ResponseBody
public Collection<BuntiDevice> getAll() {
return devicesDAO.getAllDevices(); return devicesDAO.getAllDevices();
} }
@RequestMapping(value = "/{id}", method = RequestMethod.GET) @RequestMapping(value = "/{id}", method = RequestMethod.GET)
public @ResponseBody BuntiDevice getDeviceById(@PathVariable("id") int id) { @ResponseBody
public BuntiDevice getDeviceById(@PathVariable("id") int id) {
return devicesDAO.getDeviceById(id); return devicesDAO.getDeviceById(id);
} }
@RequestMapping(value = "", method = RequestMethod.POST) @RequestMapping(value = "", method = RequestMethod.POST)
public @ResponseBody BuntiDevice setDevices(@RequestBody BuntiDevice device) { @ResponseBody
public BuntiDevice setDevices(@RequestBody BuntiDevice device) {
devicesDAO.addDevice(device); devicesDAO.addDevice(device);
return device; return device;
} }

View File

@ -21,18 +21,20 @@ public class RoomsController {
} }
@RequestMapping(value = "", method = RequestMethod.GET) @RequestMapping(value = "", method = RequestMethod.GET)
public @ResponseBody Collection<Room> getAll() { @ResponseBody
public Collection<Room> getAll() {
return roomsDAO.getRooms(); return roomsDAO.getRooms();
} }
@RequestMapping(value = "/{id}", method = RequestMethod.GET) @RequestMapping(value = "/{id}", method = RequestMethod.GET)
public @ResponseBody Room getRoomById(@PathVariable("id") int id) { @ResponseBody
public Room getRoomById(@PathVariable("id") int id) {
return roomsDAO.getRoom(id); return roomsDAO.getRoom(id);
} }
@RequestMapping(value = "/{id}/devices", method = RequestMethod.GET) @RequestMapping(value = "/{id}/devices", method = RequestMethod.GET)
public @ResponseBody @ResponseBody
List<BuntiDevice> getDevicesFromRoom(@PathVariable("id") int id) { public List<BuntiDevice> getDevicesFromRoom(@PathVariable("id") int id) {
Room room = roomsDAO.getRoom(id); Room room = roomsDAO.getRoom(id);
if(room != null) { if(room != null) {