@RequestMapping( value = "/api/logs/{id}", method = RequestMethod.DELETE, headers = "Accept=application/json") public @ResponseBody ActivityLog delete(@PathVariable("id") String id) { logger.debug("Deleting activityLog with id: " + id); ActivityLog deleted = activityLogRepository.findOne(id); activityLogRepository.delete(deleted); return deleted; }
@RequestMapping( value = "/api/logs", method = RequestMethod.POST, headers = "Accept=application/json") public @ResponseBody ActivityLog create(@RequestBody ActivityLogDTO activityLogDTO) { logger.debug("Creating a new activityLog with information: " + activityLogDTO); ActivityLog activityLog = new ActivityLog(); activityLog.setName(activityLogDTO.getName()); activityLog.setDescription(activityLogDTO.getDescription()); return activityLogRepository.save(activityLog); }
@RequestMapping( value = "/api/logs/{id}", method = RequestMethod.PUT, headers = "Accept=application/json") public @ResponseBody ActivityLog update( @PathVariable("id") Long id, @RequestBody ActivityLogDTO updated) { logger.debug("Updating activityLog with information: " + updated); ActivityLog activityLog = activityLogRepository.findOne(updated.getId()); activityLog.setName(updated.getName()); activityLog.setDescription(updated.getDescription()); return activityLog; }
@RequestMapping(value = "/api/logs/{id}", method = RequestMethod.GET) public @ResponseBody ActivityLog findById(@PathVariable("id") String id) { logger.debug("Finding activityLog by id: " + id); return activityLogRepository.findOne(id); }
@RequestMapping(value = "/api/logs", method = RequestMethod.GET) public @ResponseBody List<ActivityLog> findAll() { logger.debug("Finding all logs"); return activityLogRepository.findAll(); }