public Task updateTask(Long taskId, Task task) { if (!taskExists(taskId)) throw new TaskNotFoundException(); Task taskOnDisk = taskJpaRepository.findOne(taskId); taskOnDisk.setDescription(task.getDescription()); return saveTask(taskOnDisk); }
private Task saveTask(Task task) { return taskJpaRepository.save(task); }
private boolean taskExists(Long taskId) { return taskJpaRepository.exists(taskId); }
public Task getTaskById(Long taskId) { Task task = taskJpaRepository.findOne(taskId); if (task == null) throw new TaskNotFoundException(); return task; }