Example #1
0
  public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {

    String name = req.getParameter("name");
    String labels = req.getParameter("labels");

    if (name != null) {
      name = name.trim();
      if (!name.isEmpty()) {
        TaskRepository repository = new TaskRepository();
        try {
          repository.addTaskWithLabels(name, labels);
        } finally {
          repository.close();
        }
      }
    }
    resp.sendRedirect("/list/");
  }
Example #2
0
  /** Check if this user id NEW (create default task) */
  private void isThisNewUser() {
    User user = SecurityHelper.getUser();

    UserAccountRepository userRepository = new UserAccountRepository();
    if (!userRepository.existsUser(user.getUserId())) {
      log.info("New user " + SecurityHelper.getUser().getEmail());

      // Add user
      userRepository.addUser(user);

      // Add default tasks
      repository.addTaskWithLabels("Přečíst nápovědu", "todoizer");
      // repository.addTaskWithLabels("Poslat děkovný dopis autorovi aplikace", "todoizer");
    }
  }
Example #3
0
 public void close() {
   repository.close();
 }
Example #4
0
 public List<Task> getTasks() {
   if (tasks == null) {
     tasks = repository.getTasks(labelFilter);
   }
   return tasks;
 }