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