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 switch 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 switch used filter
    • findCategories

      List<CategorySearchResult> findCategories(CategorySearchFilter filter, String username, Locale locale)
      Searches Categories in flat mode switch 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 switch 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 switch 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 switch 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 switch 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 switch 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 switch the ownerId field
    • getRootCategory

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

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

      boolean canAccess(long categoryId, String username)
      Parameters:
      categoryId - Category identifier
      username - User name/login
      Returns:
      true if can access to the category, else false
    • canEdit

      boolean canEdit(Category category, String username)
      Parameters:
      category - Category
      username - User name/login
      Returns:
      true if can edit to the category switch 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 switch 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