Package io.meeds.social.category.service
Interface CategoryService
public interface CategoryService
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleanbooleanbooleancanManageLink(long categoryId, String username) booleancanManageLink(Category category, String username) createCategory(Category category, String username) Creates a newCategorydeleteCategory(long categoryId, String username) findCategories(CategorySearchFilter filter, String username, Locale locale) Searches Categories in flat mode switch a name.getAncestorIds(long categoryId) Retrieve theListof ancestor Category Ids starting from nearest ancestor to tree root idgetAncestorIds(long categoryId, String username) Retrieve theListof ancestor Category Ids starting from nearest ancestor to tree root idgetCategory(long categoryId) getCategory(long categoryId, String username, Locale locale) getCategoryTree(CategoryFilter filter, String username, Locale locale) Retrieves aCategoryTreewith its associated categories switch designated depth and limit from the filter.getRootCategory(long ownerId) getSubcategoryIds(long categoryId, long offset, long limit) Retrieve sub category identifiersgetSubcategoryIds(long categoryId, long offset, long limit, long depth) Retrieve sub category identifiersgetSubcategoryIds(String username, long categoryId, long offset, long limit, long depth) Retrieve sub category identifiersupdateCategory(Category category, String username)
-
Field Details
-
EVENT_SOCIAL_CATEGORY_CREATED
- See Also:
-
EVENT_SOCIAL_CATEGORY_UPDATED
- See Also:
-
EVENT_SOCIAL_CATEGORY_DELETED
- See Also:
-
EVENT_SOCIAL_CATEGORY_ITEM_LINKED
- See Also:
-
EVENT_SOCIAL_CATEGORY_ITEM_UNLINKED
- See Also:
-
-
Method Details
-
getCategoryTree
Retrieves aCategoryTreewith 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 treeusername- User name/loginlocale- usedLocaleto retrieve translated name- Returns:
CategoryTreeswitch 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. -
getSubcategoryIds
Retrieve sub category identifiers -
getSubcategoryIds
Retrieve sub category identifiers -
getSubcategoryIds
Retrieve sub category identifiers -
getAncestorIds
List<Long> getAncestorIds(long categoryId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Retrieve theListof ancestor Category Ids starting from nearest ancestor to tree root id- Parameters:
categoryId-Categoryidentifierusername- User name/login- Returns:
Listof technicalCategoryidentifiers- Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
getAncestorIds
Retrieve theListof ancestor Category Ids starting from nearest ancestor to tree root id -
createCategory
Category createCategory(Category category, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException Creates a newCategory- Parameters:
category-Categoryto createusername- User name/login- Returns:
- created
Category - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when theCategorydesignated by the parentId doesn't existIllegalAccessException- when the user isn't allowed to edit a categories switch the ownerId fieldorg.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-Categoryto createusername- User name/login- Returns:
- updated
Category - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when theCategorydesignated by the parentId or the id of the category itself doesn't existIllegalAccessException- 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-Categoryidentifierusername- User name/login- Returns:
- deleted
Category - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when theCategorydesignated by the the id doesn't existIllegalAccessException- when the user isn't allowed to edit a categories switch the ownerId field
-
getCategory
-
getCategory
CategoryWithName getCategory(long categoryId, String username, Locale locale) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Parameters:
categoryId-Categoryidentifierusername- User name/loginlocale- usedLocaleto retrieve translated name- Returns:
- found
Categorywith its associated name switch designated locale - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when theCategorydesignated by the the id doesn't existIllegalAccessException- when the user isn't allowed to edit a categories switch the ownerId field
-
getRootCategory
-
canAccess
- Parameters:
category-Categoryusername- User name/login- Returns:
- true if can access to the category, else false
-
canAccess
- Parameters:
categoryId-Categoryidentifierusername- User name/login- Returns:
- true if can access to the category, else false
-
canEdit
- Parameters:
category-Categoryusername- User name/login- Returns:
- true if can edit to the category switch its tree ownerId, else false
-
canEdit
- Parameters:
categoryId-Categoryidentifierusername- User name/login- Returns:
- true if can edit to the category switch its tree ownerId, else false
-
canManageLink
- Parameters:
category-Categoryusername- User name/login- Returns:
- true if can link an object to the category, else false
-
canManageLink
- Parameters:
categoryId-Categoryidentifierusername- User name/login- Returns:
- true if can link an object to the category, else false
-