@RequestMapping("/secure/device_override/{id}/{on}/{duration}") public @ResponseBody boolean deviceOverride( @PathVariable("id") long id, @PathVariable("on") boolean on, @PathVariable("duration") long duration) { powerControlDeviceService .getDevice(id) .setOverridingMode(new OnOffMode(on), duration * 1000 * 60); return true; }
@RequestMapping("/secure/cancel_device_override/{id}") public @ResponseBody boolean cancelOverride(@PathVariable("id") long id) { powerControlDeviceService.getDevice(id).cancelOverridingMode(); return true; }
@RequestMapping("/device/{id}") public @ResponseBody ModelAndView getDeviceDetail(@PathVariable("id") long id) { ModelAndView mav = new ModelAndView("device_detail"); mav.addObject("device", powerControlDeviceService.getDevice(id)); return mav; }