Пример #1
0
  private Integer retrieveCategory(String categoryName) {

    if (categoryName.equals("")) {
      return null;
    }

    Category category = categoryManager.getCategoryByName(categoryName, null);

    if (category == null) {
      category = new Category();
      category.setName(categoryName);
      category.setUsername(ETEAM_USER);
      category = categoryManager.saveCategory(category);
    }

    return Integer.valueOf(category.getCategoryId().intValue());
  }
Пример #2
0
  private Integer retrieveSubCategory(String categoryName, Integer parentId) {

    if (categoryName.equals("") || parentId == null) {
      return null;
    }

    Category category = categoryManager.getCategoryByName(categoryName, parentId);

    if (category == null) {
      category = new Category();
      category.setName(categoryName);
      category.setParentId(Long.valueOf(parentId.longValue()));
      category.setUsername(ETEAM_USER);
      category = categoryManager.saveCategory(category);
    }

    return Integer.valueOf(category.getCategoryId().intValue());
  }