예제 #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
 public void deleteTask(Long taskId) {
   Task task = getTaskById(taskId);
   if (!task.getUser().isActive()) throw new InactiveUserTaskException();
   task.setActive(false);
   saveTask(task);
 }
예제 #3
0
 public Task createTaskForUser(Task task, User user) {
   task.setUser(user);
   return saveTask(task);
 }