// load categories of all tasks of the user @Override public TreeSet<Category> loadCategories(int userId) { TreeSet<Category> categoriesList = new TreeSet< Category>(); // use treeset to disallow duplicates and get alphabetical order of // categories List<Task> tasksList = taskDao.loadTasksofUsers(userId); for (Task task : tasksList) { logger.debug("Processing categories of task - " + task.getTaskName()); Category category = categoryDao.getCategoryofTask(task.getId()); categoriesList.add(category); } logger.info("Loaded categories"); return categoriesList; }
// load tags of all tasks of the user @Override public TreeSet<Tag> loadTags(int userId) { TreeSet<Tag> tagsList = new TreeSet<Tag>(); // use treeset to disallow duplicates and get alphabetical order of tags List<Task> tasksList = taskDao.loadTasksofUsers(userId); for (Task task : tasksList) { logger.debug("Processing tags of task - " + task.getTaskName()); List<Tag> tagsListofTask = new ArrayList<Tag>(); tagsListofTask = tagDao.getTagsofTask(task.getId()); for (Tag tag : tagsListofTask) { tagsList.add(tag); } } logger.info("Loaded tags"); return tagsList; }