示例#1
0
  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);
  }
示例#2
0
 private Task saveTask(Task task) {
   return taskJpaRepository.save(task);
 }
示例#3
0
 private boolean taskExists(Long taskId) {
   return taskJpaRepository.exists(taskId);
 }
示例#4
0
 public Task getTaskById(Long taskId) {
   Task task = taskJpaRepository.findOne(taskId);
   if (task == null) throw new TaskNotFoundException();
   return task;
 }