예제 #1
0
  @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);
  }
예제 #2
0
  @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;
  }