/** * Retrieves all task categories that contain this projectToBookmark as a task and are owned by * the projectOfLists * * @param db - database connection * @param projectIdOfLists - the id of the project that owns the lists (taskCategories) * @param projectIdToBookmark - the id of the project that is linked by bookmark * @return Map<Integer, TaskCategory> all taskCategories found mapped by their id * @throws SQLException - generated trying to retrieve data */ private Map<Integer, TaskCategory> findExistingTaskCategorysForProjects( Connection db, int projectIdOfLists, int projectIdToBookmark) throws SQLException { Map<Integer, TaskCategory> map = new HashMap<Integer, TaskCategory>(); TaskCategoryList categoryList = new TaskCategoryList(); categoryList.setTaskLinkModuleId(Constants.TASK_CATEGORY_PROJECTS); categoryList.setTaskLinkItemId(projectIdToBookmark); categoryList.setProjectId(projectIdOfLists); categoryList.buildList(db); for (TaskCategory tc : categoryList) { map.put(tc.getId(), tc); } return map; }
/** * Inserts new list (taskCategory) record, and returns the id of the newly inserted record * * @param db - database connection * @param projectId - the project id that will own the new list (taskCategory) * @param description - description that will be saved for the list (taskCategory) * @return int - id of the new list (taskCategory) saved * @throws SQLException - generated trying to retrieve data */ private int saveNewList(Connection db, int projectId, String description) throws SQLException { int id; // Process the category TaskCategory newCategory = new TaskCategory(); newCategory.setLinkModuleId(Constants.TASK_CATEGORY_PROJECTS); newCategory.setLinkItemId(projectId); newCategory.setDescription(description); newCategory.insert(db); id = newCategory.getId(); return id; }