Esempio n. 1
0
 @Secured("ROLE_ADMIN")
 @RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = "application/json")
 public @ResponseBody Device getAll(@PathVariable int idDevice) {
   log.info("View Device with id=" + idDevice);
   Device device = deviceRepository.findById(idDevice);
   return device;
 }
Esempio n. 2
0
 @Secured("ROLE_ADMIN")
 @RequestMapping(
     method = RequestMethod.PUT,
     produces = "application/json",
     consumes = "application/json")
 public @ResponseBody Device update(@RequestBody Device device) {
   deviceRepository.update(device);
   return device;
 }
Esempio n. 3
0
 @Secured("ROLE_ADMIN")
 @RequestMapping(
     value = "/delete/{id}",
     method = RequestMethod.DELETE,
     produces = "application/json")
 public @ResponseBody Device delete(@PathVariable int id) {
   Device device = new Device();
   device.setId(id);
   deviceRepository.delete(device);
   return device;
 }
Esempio n. 4
0
 @Secured("ROLE_ADMIN")
 @RequestMapping(method = RequestMethod.GET, produces = "application/json")
 public @ResponseBody List<Device> getAll() {
   List<Device> devices = deviceRepository.findAll();
   return devices;
 }