Package com.atlassian.confluence.like
Interface LikeManager
- All Known Implementing Classes:
DefaultLikeManager
@Transactional
public interface LikeManager
Controls all access to Like-ing and Unlike-ing content.
- Since:
- 4.3
-
Method Summary
Modifier and TypeMethodDescriptionaddLike
(ContentEntityObject contentEntity, ConfluenceUser user) Add a like for the provided user.int
countLikes
(Searchable searchable) Count the number of likes for the given objectcountLikes
(Collection<? extends Searchable> searchables) Count the number of likes for the given objectsgetLikes
(ContentEntityObject contentEntity) Gets all the likes for the specified content entity (likes are ordered such that recent likes come first)getLikes
(Collection<? extends ContentEntityObject> contentEntities) Gets all the likes for the specified content entities (likes are ordered such that recent likes come first).boolean
hasLike
(ContentEntityObject contentEntity, ConfluenceUser user) Returns true if the provided user likes this content entity.void
removeAllLikesFor
(@NonNull com.atlassian.sal.api.user.UserKey key) Remove all likes for the given userkey.void
removeAllLikesOn
(ContentEntityObject content) Removes all likes (for any user) from the specified content entity.void
removeLike
(ContentEntityObject contentEntity, ConfluenceUser user) Remove like from content entity for the current logged in user.
-
Method Details
-
addLike
Add a like for the provided user.- Parameters:
contentEntity
- the content entity to add a like touser
- the user- Since:
- 9.5
-
removeLike
Remove like from content entity for the current logged in user.- Parameters:
contentEntity
- content entity to remove like fromuser
- the user- Since:
- 9.5
-
removeAllLikesOn
Removes all likes (for any user) from the specified content entity.- Parameters:
content
- content entity
-
removeAllLikesFor
void removeAllLikesFor(@NonNull com.atlassian.sal.api.user.UserKey key) Remove all likes for the given userkey.- Parameters:
key
- a userKey. If no such user exists, this method will be a noop.
-
hasLike
Returns true if the provided user likes this content entity.- Parameters:
contentEntity
- the content entityuser
- the user who would like this content- Returns:
- true if the provided user likes this content entity.
- Since:
- 9.5
-
getLikes
Gets all the likes for the specified content entity (likes are ordered such that recent likes come first)- Parameters:
contentEntity
- the content entity- Returns:
- all the likes for the specified content entity.
-
getLikes
@Transactional(readOnly=true) Map<Long,List<Like>> getLikes(Collection<? extends ContentEntityObject> contentEntities) Gets all the likes for the specified content entities (likes are ordered such that recent likes come first).- Parameters:
contentEntities
- content entities- Returns:
- a map of contentId to a set of all the likes for that piece of content.
-
countLikes
@Transactional(readOnly=true) Map<Searchable,Integer> countLikes(Collection<? extends Searchable> searchables) Count the number of likes for the given objects- Parameters:
searchables
- A searchable object whose ID must be set- Returns:
- A map mapping the object to the number of likes it has. If an object no longer exists, it has 0 likes.
-
countLikes
Count the number of likes for the given object- Parameters:
searchable
- A searchable object whose ID must be set- Returns:
- The number of likes it has. If an object no longer exists, it has 0 likes.
-