Interface CategoryService


public interface CategoryService
  • Field Details

  • Method Details

    • getCategoryTree

      CategoryTree getCategoryTree(CategoryFilter filter, String username, Locale locale)
      Retrieves a CategoryTree with its associated categories with designated depth and limit from the filter. This method will return only visible categories by the user.
      Parameters:
      filter - used filter to query the Category tree
      username - User name/login
      locale - used Locale to retrieve translated name
      Returns:
      CategoryTree matching the used filter
    • findCategories

      List<CategorySearchResult> findCategories(CategorySearchFilter filter, String username, Locale locale)
      Searches Categories in flat mode by a name. This will return only accessible categories by the user.
      Parameters:
      filter - used filter to query the Category tree
      username - User name/login
      locale - used Locale to retrieve translated name
      Returns:
      a List of Category matching the used filter
    • getSubcategoryIds

      default List<Long> getSubcategoryIds(long categoryId, long offset, long limit)
      Retrieve sub category identifiers
      Parameters:
      categoryId - Category identifier
      offset - Request offset
      limit - Request limit. Can be 0 to retrieve all
      Returns:
      List of Sub category ids
    • getSubcategoryIds

      List<Long> getSubcategoryIds(long categoryId, long offset, long limit, long depth)
      Retrieve sub category identifiers
      Parameters:
      categoryId - Category identifier
      offset - Request offset
      limit - Request limit. Can be 0 to retrieve all
      depth - Category Tree depth. Can be 1 to retrieve only selected or -1 to retrieve all subsequent categories
      Returns:
      List of Sub category ids
    • getSubcategoryIds

      List<Long> getSubcategoryIds(String username, long categoryId, long offset, long limit, long depth)
      Retrieve sub category identifiers
      Parameters:
      username - User name/login
      categoryId - Category identifier
      offset - Request offset
      limit - Request limit. Can be 0 to retrieve all
      depth - Category Tree depth. Can be 1 to retrieve only selected or -1 to retrieve all subsequent categories
      Returns:
      List of Sub category ids
    • getAncestorIds

      List<Long> getAncestorIds(long categoryId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Retrieve the List of ancestor Category Ids starting from nearest ancestor to tree root id
      Parameters:
      categoryId - Category identifier
      username - User name/login
      Returns:
      List of technical Category identifiers
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • getAncestorIds

      List<Long> getAncestorIds(long categoryId)
      Retrieve the List of ancestor Category Ids starting from nearest ancestor to tree root id
      Parameters:
      categoryId - Category identifier
      Returns:
      List of technical Category identifiers
    • createCategory

      Category createCategory(Category category, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException
      Creates a new Category
      Parameters:
      category - Category to create
      username - User name/login
      Returns:
      created Category
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the Category designated by the parentId doesn't exist
      IllegalAccessException - when the user isn't allowed to edit a categories by the ownerId field
      org.exoplatform.commons.ObjectAlreadyExistsException - when attempting to recreate an existing root tree element
    • updateCategory

      Category updateCategory(Category category, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Parameters:
      category - Category to create
      username - User name/login
      Returns:
      updated Category
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the Category designated by the parentId or the id of the category itself doesn't exist
      IllegalAccessException - when the user isn't allowed to edit a categories by the ownerId field
    • deleteCategory

      Category deleteCategory(long categoryId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Parameters:
      categoryId - Category identifier
      username - User name/login
      Returns:
      deleted Category
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the Category designated by the the id doesn't exist
      IllegalAccessException - when the user isn't allowed to edit a categories by the ownerId field
    • getCategory

      Category getCategory(long categoryId)
      Parameters:
      categoryId - Category identifier
      Returns:
      Category if found, else null
    • getCategory

      CategoryWithName getCategory(long categoryId, String username, Locale locale) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Parameters:
      categoryId - Category identifier
      username - User name/login
      locale - used Locale to retrieve translated name
      Returns:
      found Category with its associated name for the designated locale
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the Category designated by the the id doesn't exist
      IllegalAccessException - when the user isn't allowed to edit a categories by the ownerId field
    • getRootCategory

      Category getRootCategory(long ownerId)
      Parameters:
      ownerId - Identity identifier
      Returns:
      the root Category of the tree if found, else null
    • canEdit

      boolean canEdit(Category category, String username)
      Parameters:
      category - Category
      username - User name/login
      Returns:
      true if can edit to the category based on its tree ownerId, else false
    • canEdit

      boolean canEdit(long categoryId, String username)
      Parameters:
      categoryId - Category identifier
      username - User name/login
      Returns:
      true if can edit to the category based on its tree ownerId, else false
    • canManageLink

      boolean canManageLink(Category category, String username)
      Parameters:
      category - Category
      username - User name/login
      Returns:
      true if can link an object to the category, else false
    • canManageLink

      boolean canManageLink(long categoryId, String username)
      Parameters:
      categoryId - Category identifier
      username - User name/login
      Returns:
      true if can link an object to the category, else false
    • getCategoryEntries

      CategoryEntryList getCategoryEntries(long categoryId, List<String> objectTypes, String username, long offset, long limit)
      Retrieves the entries linked to a Category, de-duplicated (when the same entry is available under several objectTypes, only the most specific one is kept), filtered by the accessibility of each item to the designated user, ordered by last modification date descending.
      Parameters:
      categoryId - Category identifier
      objectTypes - List of objectTypes to browse
      username - User name/login
      offset - Request offset
      limit - Request limit
      Returns:
      CategoryEntryList matching the used filter