Exemplo n.º 1
0
  public void updateTask() {
    if (taskService.taskExists(task.getId())) {
      taskService.mergeTask(task);
      log.info("Task was updated successfully: {}", task.getLabel());

      this.hasTaskEditable = false;
    } else {
      log.error("Cannot update task. It is not in the list: {}", task.getLabel());
    }
  }
Exemplo n.º 2
0
  public String saveNewTask() {
    // initially new tasks are not finished and not editable
    task.setFinished(false);
    task.setUser(user);

    taskService.saveTask(task);
    log.info("Task was created successfully: {}", task.getLabel());
    this.hasNewTask = false;

    return HOME_PAGE;
  }
Exemplo n.º 3
0
  public void removeTask() {
    if (hasNewTask) {
      this.hasNewTask = false;
    }

    if (taskService.taskExists(task.getId())) {
      taskService.removeTask(task);
      log.info("Task was removed successfully: {}", task.getLabel());

      this.hasTaskEditable = false;
    } else {
      log.error("Cannot remove task. It is not in the list: {}", task.getLabel());
    }
  }
Exemplo n.º 4
0
  public void refreshTaskList() {
    tasks = new ArrayList<Task>();
    // TODO use user instead. Problems with refresh after dealing with couple of users.
    final List<Task> all =
        taskService.loadForUserAndStatus(loginController.getUser(), displayCloseTasks);

    if (categoryFilter != null) {
      for (final Task task : all) {
        if (task.getCategory() == categoryFilter) {
          tasks.add(task);
        }
      }
    } else {
      tasks = all;
    }
  }
Exemplo n.º 5
0
 public boolean getIsTaskEditable(final Task task) {
   return (task != null)
       && getHasTaskEditable()
       && this.task.getId() != null
       && (this.task.getId().equals(task.getId()));
 }