Package io.meeds.social.category.service
Interface CategoryService
public interface CategoryService
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleancanManageLink(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 by 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) 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.getCategoryTree(CategoryFilter filter, String username, Locale locale) Retrieves aCategoryTreewith its associated categories with 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 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 treeusername- User name/loginlocale- usedLocaleto retrieve translated name- Returns:
CategoryTreematching 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. -
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 by 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 by 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 by 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 for the 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 by the ownerId field
-
getRootCategory
-
canEdit
- Parameters:
category-Categoryusername- User name/login- Returns:
- true if can edit to the category based on its tree ownerId, else false
-
canEdit
- Parameters:
categoryId-Categoryidentifierusername- User name/login- Returns:
- true if can edit to the category based on 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
-
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-CategoryidentifierobjectTypes-Listof objectTypes to browseusername- User name/loginoffset- Request offsetlimit- Request limit- Returns:
CategoryEntryListmatching the used filter
-