Package io.meeds.social.category.service
Interface CategoryLinkService
public interface CategoryLinkService
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetLinkedIds(CategoryObject object) getLinkedIds(String objectType) getLinkedIds(String objectType, List<String> objectIds) The categories each of several objects is filed under, in one query.getLinkedObjects(long categoryId, List<String> objectTypes, int offset, int limit) booleanisLinked(long categoryId, CategoryObject object) voidlink(long categoryId, CategoryObject object) Creates a link from the designated object to the categoryvoidlink(long categoryId, CategoryObject object, String username) Creates a link from the designated object to the categoryvoidunlink(long categoryId, CategoryObject object) Deletes a link of the designated object from the categoryvoidunlink(long categoryId, CategoryObject object, String username) Deletes a link of the designated object from the category
-
Field Details
-
EVENT_CATEGORY_LINK_ADDED
- See Also:
-
EVENT_CATEGORY_LINK_REMOVED
- See Also:
-
-
Method Details
-
getLinkedIds
- Parameters:
object-CategoryObjectusing type/id to designate any object in the platform (Space, Activity ...)- Returns:
Listof linkedCategoryidentifiers
-
getLinkedIds
The categories each of several objects is filed under, in one query.getLinkedIds(CategoryObject)is the right call for a reader looking at one thing, and the wrong one for a list: a page of rows showing what each is filed under would ask it once per row. This answers the whole page, so the caller decorates its rows by lookup instead of by a query each.- Parameters:
objectType-CategoryObjecttype, example: Space, Activity ...objectIds- the objects' identifiers, in stored form. UnlikegetLinkedIds(CategoryObject), this read does not put its ids throughCategoryPluginService.getObject(io.meeds.social.category.model.CategoryObject)first, so a plugin that rewrites the object - the space one resolves any id form to the space's technical id, the activity one redirects to the activity's metadata object and changes the type with it - is not applied here. Passing a form the plugin would have normalised returns no categories for that id. The keys of the returned map are the ids as given.- Returns:
Mapof linkedCategoryidentifiers keyed by object id; an object with no category is absent from the map rather than present with an empty list
-
getLinkedIds
- Parameters:
objectType-CategoryObjecttype, example: Space, Activity ...- Returns:
Listof linkedCategoryidentifiers
-
getLinkedObjects
List<CategoryObject> getLinkedObjects(long categoryId, List<String> objectTypes, int offset, int limit) - Parameters:
categoryId-CategoryidentifierobjectTypes-ListofCategoryObjecttypes to filter byoffset- offset of objects to retrievelimit- limit of objects to retrieve- Returns:
ListofCategoryObjectlinked to the category, ordered by last modification date descending
-
isLinked
- Parameters:
categoryId-Categoryidentifierobject-CategoryObjectusing type/id to designate any object in the platform (Space, Activity ...)- Returns:
- true if the object is linked to the category
-
link
void link(long categoryId, CategoryObject object, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.commons.ObjectAlreadyExistsException, IllegalAccessException Creates a link from the designated object to the category- Parameters:
categoryId-Categoryidentifierobject-CategoryObjectusing type/id to designate any object in the platform (Space, Activity ...)username- User name/login- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the category doesn't existorg.exoplatform.commons.ObjectAlreadyExistsException- when the object is already linked to the categoryIllegalAccessException- when the user doesn't have 'Link' permission on the category or not having 'edit' permission on the object
-
link
Creates a link from the designated object to the category- Parameters:
categoryId-Categoryidentifierobject-CategoryObjectusing type/id to designate any object in the platform (Space, Activity ...)
-
unlink
void unlink(long categoryId, CategoryObject object, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Deletes a link of the designated object from the category- Parameters:
categoryId-Categoryidentifierobject-CategoryObjectusing type/id to designate any object in the platform (Space, Activity ...)username- User name/login- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the link doesn't existIllegalAccessException- when the user doesn't have 'Link' permission on the category or not having 'edit' permission on the object
-
unlink
Deletes a link of the designated object from the category- Parameters:
categoryId-Categoryidentifierobject-CategoryObjectusing type/id to designate any object in the platform (Space, Activity ...)
-