@RequestMapping("/programme_devices_status/{id}") public @ResponseBody DeviceStatus[] getProgrammeDeviceStatus(@PathVariable("id") long id) { ProgrammeDevice[] devices = powerControlDeviceService.getProgrammeStatus(id).getProgrammeDevices(); DeviceStatus[] deviceStatus = new DeviceStatus[devices.length]; for (int i = 0; i < devices.length; i++) { deviceStatus[i] = new DeviceStatus(devices[i].getDevice()); } return deviceStatus; }
@RequestMapping("/programme_detail/{id}") public @ResponseBody ModelAndView getProgrammes(@PathVariable("id") long id) { ModelAndView mav = new ModelAndView("programme_detail"); mav.addObject("programmeStatus", powerControlDeviceService.getProgrammeStatus(id)); return mav; }